accessible/tests/mochitest/events/test_focus_tabbox.xul

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     4                  type="text/css"?>
     6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     7         title="Tabbox focus testing">
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    11   <script type="application/javascript"
    12           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    14   <script type="application/javascript"
    15           src="../common.js" />
    16   <script type="application/javascript"
    17           src="../role.js" />
    18   <script type="application/javascript"
    19           src="../states.js" />
    20   <script type="application/javascript"
    21           src="../events.js" />
    23   <script type="application/javascript">
    24     //gA11yEventDumpID = "eventdump"; // debug stuff
    25     //gA11yEventDumpToConsole = true; // debug stuff
    27     var gQueue = null;
    28     function doTests()
    29     {
    30       if (MAC) {
    31         todo(false, "Tests disabled because of imminent failure.");
    32         SimpleTest.finish();
    33         return;
    34       }
    36       // Test focus events.
    37       gQueue = new eventQueue();
    39       var textbox = getNode("textbox").inputField;
    40       gQueue.push(new synthClick("tab1", new focusChecker("tab1")));
    41       gQueue.push(new synthTab("tab1", new focusChecker("checkbox1")));
    42       gQueue.push(new synthKey("tab1", "VK_TAB", { ctrlKey: true },
    43                                new focusChecker(textbox)));
    44       gQueue.push(new synthKey("tab2", "VK_TAB", { ctrlKey: true },
    45                                new focusChecker("tab3")));
    46       gQueue.push(new synthKey("tab3", "VK_TAB", { ctrlKey: true },
    47                                new focusChecker("tab1")));
    49       gQueue.invoke(); // Will call SimpleTest.finish();
    50     }
    52     SimpleTest.waitForExplicitFinish();
    53     addA11yLoadEvent(doTests);
    54   </script>
    56   <hbox flex="1" style="overflow: auto;">
    57     <body xmlns="http://www.w3.org/1999/xhtml">
    58       <a target="_blank"
    59          href="https://bugzilla.mozilla.org/show_bug.cgi?id=370396"
    60          title="Control+Tab to an empty tab panel in a tabbox causes focus to leave the tabbox">
    61         Mozilla Bug 370396
    62       </a>
    63       <p id="display"></p>
    64       <div id="content" style="display: none"></div>
    65       <pre id="test">
    66       </pre>
    67     </body>
    69     <vbox flex="1">
    70       <tabbox>
    71         <tabs>
    72           <tab id="tab1" label="Tab1" selected="true"/>
    73           <tab id="tab2" label="Tab2" />
    74           <tab id="tab3" label="Tab3" />
    75         </tabs>
    76         <tabpanels>
    77           <tabpanel orient="vertical">
    78             <groupbox orient="vertical">
    79               <checkbox id="checkbox1" label="Monday" width="75"/>
    80               <checkbox label="Tuesday" width="75"/>
    81               <checkbox label="Wednesday" width="75"/>
    82               <checkbox label="Thursday" width="75"/>
    83               <checkbox label="Friday" width="75"/>
    84               <checkbox label="Saturday" width="75"/>
    85               <checkbox label="Sunday" width="75"/>
    86             </groupbox>
    88             <spacer style="height: 10px" />
    89             <label value="Label After checkboxes" />
    90           </tabpanel>
    91           <tabpanel orient="vertical">
    92             <textbox id="textbox" />
    93           </tabpanel>
    94           <tabpanel orient="vertical">
    95             <description>Tab 3 content</description>
    96           </tabpanel>
    97         </tabpanels>
    98       </tabbox>
   100       <vbox id="eventdump"/>
   101     </vbox>
   102   </hbox>
   103 </window>

mercurial