diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/content/tests/chrome/test_tabbox.xul | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/content/tests/chrome/test_tabbox.xul')
-rw-r--r-- | toolkit/content/tests/chrome/test_tabbox.xul | 224 |
1 files changed, 0 insertions, 224 deletions
diff --git a/toolkit/content/tests/chrome/test_tabbox.xul b/toolkit/content/tests/chrome/test_tabbox.xul deleted file mode 100644 index 3cbacb15a..000000000 --- a/toolkit/content/tests/chrome/test_tabbox.xul +++ /dev/null @@ -1,224 +0,0 @@ -<?xml version="1.0"?> -<?xml-stylesheet href="chrome://global/skin" type="text/css"?> -<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> -<!-- - XUL Widget Test for tabboxes - --> -<window title="Tabbox Test" width="500" height="600" - onload="setTimeout(test_tabbox, 0);" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> - <script type="application/javascript" src="xul_selectcontrol.js"/> - -<vbox id="tabboxes"> - -<tabbox id="tabbox"> - <tabs id="tabs"> - <tab id="tab1" label="Tab 1"/> - <tab id="tab2" label="Tab 2"/> - </tabs> - <tabpanels id="tabpanels"> - <button id="panel1" label="Panel 1"/> - <button id="panel2" label="Panel 2"/> - </tabpanels> -</tabbox> - -<tabbox id="tabbox-initwithvalue"> - <tabs id="tabs-initwithvalue" value="two"> - <tab label="Tab 1" value="one"/> - <tab label="Tab 2" value="two"/> - <tab label="Tab 3" value="three"/> - </tabs> - <tabpanels id="tabpanels-initwithvalue"> - <button label="Panel 1"/> - <button label="Panel 2"/> - <button label="Panel 3"/> - </tabpanels> -</tabbox> - -<tabbox id="tabbox-initwithselected"> - <tabs id="tabs-initwithselected" value="two"> - <tab label="Tab 1" value="one"/> - <tab label="Tab 2" value="two"/> - <tab label="Tab 3" value="three" selected="true"/> - </tabs> - <tabpanels id="tabpanels-initwithselected"> - <button label="Panel 1"/> - <button label="Panel 2"/> - <button label="Panel 3"/> - </tabpanels> -</tabbox> - -</vbox> - -<tabbox id="tabbox-nofocus"> - <textbox id="textbox-extra" hidden="true"/> - <tabs> - <tab label="Tab 1" value="one"/> - <tab id="tab-nofocus" label="Tab 2" value="two"/> - </tabs> - <tabpanels> - <tabpanel> - <button id="tab-nofocus-button" label="Label"/> - </tabpanel> - <tabpanel id="tabpanel-nofocusinpaneltab"> - <label id="tablabel" value="Label"/> - </tabpanel> - </tabpanels> -</tabbox> - - <!-- test results are displayed in the html:body --> - <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/> - - <!-- test code goes here --> - <script type="application/javascript"><![CDATA[ - -SimpleTest.waitForExplicitFinish(); - -function test_tabbox() -{ - var tabbox = document.getElementById("tabbox"); - var tabs = document.getElementById("tabs"); - var tabpanels = document.getElementById("tabpanels"); - - test_tabbox_State(tabbox, "tabbox initial", 0, tabs.firstChild, tabpanels.firstChild); - - // check the selectedIndex property - tabbox.selectedIndex = 1; - test_tabbox_State(tabbox, "tabbox selectedIndex 1", 1, tabs.lastChild, tabpanels.lastChild); - - tabbox.selectedIndex = 2; - test_tabbox_State(tabbox, "tabbox selectedIndex 2", 1, tabs.lastChild, tabpanels.lastChild); - - // tabbox must have a selection, so setting to -1 should do nothing - tabbox.selectedIndex = -1; - test_tabbox_State(tabbox, "tabbox selectedIndex -1", 1, tabs.lastChild, tabpanels.lastChild); - - // check the selectedTab property - tabbox.selectedTab = tabs.firstChild; - test_tabbox_State(tabbox, "tabbox selected", 0, tabs.firstChild, tabpanels.firstChild); - - // setting selectedTab to null should not do anything - tabbox.selectedTab = null; - test_tabbox_State(tabbox, "tabbox selectedTab null", 0, tabs.firstChild, tabpanels.firstChild); - - // check the selectedPanel property - tabbox.selectedPanel = tabpanels.lastChild; - test_tabbox_State(tabbox, "tabbox selectedPanel", 0, tabs.firstChild, tabpanels.lastChild); - - // setting selectedPanel to null should not do anything - tabbox.selectedPanel = null; - test_tabbox_State(tabbox, "tabbox selectedPanel null", 0, tabs.firstChild, tabpanels.lastChild); - - tabbox.selectedIndex = 0; - test_tabpanels(tabpanels, tabbox); - - tabs.removeChild(tabs.firstChild); - tabs.removeChild(tabs.firstChild); - - test_tabs(tabs); - - test_tabbox_focus(); -} - -function test_tabpanels(tabpanels, tabbox) -{ - var tab = tabbox.selectedTab; - - // changing the selection on the tabpanels should not affect the tabbox - // or tabs within - // check the selectedIndex property - tabpanels.selectedIndex = 1; - test_tabbox_State(tabbox, "tabpanels tabbox selectedIndex 1", 0, tab, tabpanels.lastChild); - test_tabpanels_State(tabpanels, "tabpanels selectedIndex 1", 1, tabpanels.lastChild); - - tabpanels.selectedIndex = 0; - test_tabbox_State(tabbox, "tabpanels tabbox selectedIndex 2", 0, tab, tabpanels.firstChild); - test_tabpanels_State(tabpanels, "tabpanels selectedIndex 2", 0, tabpanels.firstChild); - - // setting selectedIndex to -1 should do nothing - tabpanels.selectedIndex = 1; - tabpanels.selectedIndex = -1; - test_tabbox_State(tabbox, "tabpanels tabbox selectedIndex -1", 0, tab, tabpanels.lastChild); - test_tabpanels_State(tabpanels, "tabpanels selectedIndex -1", 1, tabpanels.lastChild); - - // check the tabpanels.selectedPanel property - tabpanels.selectedPanel = tabpanels.lastChild; - test_tabbox_State(tabbox, "tabpanels tabbox selectedPanel", 0, tab, tabpanels.lastChild); - test_tabpanels_State(tabpanels, "tabpanels selectedPanel", 1, tabpanels.lastChild); - - // check setting the tabpanels.selectedPanel property to null - tabpanels.selectedPanel = null; - test_tabbox_State(tabbox, "tabpanels selectedPanel null", 0, tab, tabpanels.lastChild); -} - -function test_tabs(tabs) -{ - test_nsIDOMXULSelectControlElement(tabs, "tab", "tabs"); - // XXXndeakin would test the UI aspect of tabs, but the mouse - // events on tabs are fired in a timeout causing the generic - // test_nsIDOMXULSelectControlElement_UI method not to work - // test_nsIDOMXULSelectControlElement_UI(tabs, null); -} - -function test_tabbox_State(tabbox, testid, index, tab, panel) -{ - is(tabbox.selectedIndex, index, testid + " selectedIndex"); - is(tabbox.selectedTab, tab, testid + " selectedTab"); - is(tabbox.selectedPanel, panel, testid + " selectedPanel"); -} - -function test_tabpanels_State(tabpanels, testid, index, panel) -{ - is(tabpanels.selectedIndex, index, testid + " selectedIndex"); - is(tabpanels.selectedPanel, panel, testid + " selectedPanel"); -} - -function test_tabbox_focus() -{ - $("tabboxes").hidden = true; - $(document.activeElement).blur(); - - var tabbox = $("tabbox-nofocus"); - var tab = $("tab-nofocus"); - - when_tab_focused(tab, function () { - ok(document.activeElement, tab, "focus in tab with no focusable elements"); - - tabbox.selectedIndex = 0; - $("tab-nofocus-button").focus(); - - when_tab_focused(tab, function () { - ok(document.activeElement, tab, "focus in tab with no focusable elements, but with something in another tab focused"); - - var textboxExtra = $("textbox-extra"); - textboxExtra.addEventListener("focus", function () { - textboxExtra.removeEventListener("focus", arguments.callee, true); - ok(document.activeElement, textboxExtra, "focus in tab with focus currently in textbox that is sibling of tabs"); - - SimpleTest.finish(); - }, true); - - tabbox.selectedIndex = 0; - textboxExtra.hidden = false; - synthesizeMouseAtCenter(tab, { }); - }); - - synthesizeMouseAtCenter(tab, { }); - }); - - synthesizeMouseAtCenter(tab, { }); -} - -function when_tab_focused(tab, callback) { - tab.addEventListener("focus", function onFocused() { - tab.removeEventListener("focus", onFocused, true); - SimpleTest.executeSoon(callback); - }, true); -} - -]]> -</script> - -</window> |