accessible/tests/mochitest/focus/test_takeFocus.xul

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     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="Accessible 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           src="../treeview.js" />
    26   <script type="application/javascript">
    27   <![CDATA[
    28     ////////////////////////////////////////////////////////////////////////////
    29     // Invokers
    31     function takeFocusInvoker(aID, aArgConverterFunc)
    32     {
    33       this.targetFunc = aArgConverterFunc ? aArgConverterFunc : getAccessible;
    35       this.eventSeq = [ new focusChecker(this.targetFunc, aID) ];
    37       this.invoke = function takeFocusInvoker_invoke()
    38       {
    39         this.targetFunc.call(null, aID).takeFocus();
    40       }
    42       this.getID = function takeFocusInvoker_getID()
    43       {
    44         return "takeFocus for " + prettyName(aID);
    45       }
    46     }
    48     function getLastChild(aID)
    49     {
    50       return getAccessible(aID).lastChild;
    51     }
    53     ////////////////////////////////////////////////////////////////////////////
    54     // Tests
    56     //gA11yEventDumpID = "eventdump"; // debug stuff
    57     //gA11yEventDumpToConsole = true; // debug stuff
    59     var gQueue = null;
    60     function doTests()
    61     {
    62       // Test focus events.
    63       gQueue = new eventQueue();
    65       gQueue.push(new takeFocusInvoker("tree", getLastChild));
    66       gQueue.push(new takeFocusInvoker("listitem2"));
    68       gQueue.invoke(); // Will call SimpleTest.finish();
    69     }
    71     SimpleTest.waitForExplicitFinish();
    72     addA11yXULTreeLoadEvent(doTests, "tree", new nsTableTreeView(5));
    73   ]]>
    74   </script>
    76   <hbox flex="1" style="overflow: auto;">
    77     <body xmlns="http://www.w3.org/1999/xhtml">
    78       <a target="_blank"
    79          href="https://bugzilla.mozilla.org/show_bug.cgi?id=706067"
    80          title="Make takeFocus work on widget items">
    81         Mozilla Bug 706067
    82       </a>
    83       <p id="display"></p>
    84       <div id="content" style="display: none"></div>
    85       <pre id="test">
    86       </pre>
    87     </body>
    89     <vbox flex="1">
    90       <tree id="tree" flex="1">
    91         <treecols>
    92           <treecol id="col1" flex="1" primary="true" label="column"/>
    93           <treecol id="col2" flex="1" label="column 2"/>
    94         </treecols>
    95         <treechildren id="treechildren"/>
    96       </tree>
    98       <listbox id="listbox">
    99         <listitem id="listitem1">item1</listitem>
   100         <listitem id="listitem2">item2</listitem>
   101       </listbox>
   103       <vbox id="eventdump"/>
   104     </vbox>
   105   </hbox>
   106 </window>

mercurial