accessible/tests/mochitest/focus/test_takeFocus.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
michael@0 4 type="text/css"?>
michael@0 5
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Accessible focus testing">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11 <script type="application/javascript"
michael@0 12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
michael@0 13
michael@0 14 <script type="application/javascript"
michael@0 15 src="../common.js" />
michael@0 16 <script type="application/javascript"
michael@0 17 src="../role.js" />
michael@0 18 <script type="application/javascript"
michael@0 19 src="../states.js" />
michael@0 20 <script type="application/javascript"
michael@0 21 src="../events.js" />
michael@0 22
michael@0 23 <script type="application/javascript"
michael@0 24 src="../treeview.js" />
michael@0 25
michael@0 26 <script type="application/javascript">
michael@0 27 <![CDATA[
michael@0 28 ////////////////////////////////////////////////////////////////////////////
michael@0 29 // Invokers
michael@0 30
michael@0 31 function takeFocusInvoker(aID, aArgConverterFunc)
michael@0 32 {
michael@0 33 this.targetFunc = aArgConverterFunc ? aArgConverterFunc : getAccessible;
michael@0 34
michael@0 35 this.eventSeq = [ new focusChecker(this.targetFunc, aID) ];
michael@0 36
michael@0 37 this.invoke = function takeFocusInvoker_invoke()
michael@0 38 {
michael@0 39 this.targetFunc.call(null, aID).takeFocus();
michael@0 40 }
michael@0 41
michael@0 42 this.getID = function takeFocusInvoker_getID()
michael@0 43 {
michael@0 44 return "takeFocus for " + prettyName(aID);
michael@0 45 }
michael@0 46 }
michael@0 47
michael@0 48 function getLastChild(aID)
michael@0 49 {
michael@0 50 return getAccessible(aID).lastChild;
michael@0 51 }
michael@0 52
michael@0 53 ////////////////////////////////////////////////////////////////////////////
michael@0 54 // Tests
michael@0 55
michael@0 56 //gA11yEventDumpID = "eventdump"; // debug stuff
michael@0 57 //gA11yEventDumpToConsole = true; // debug stuff
michael@0 58
michael@0 59 var gQueue = null;
michael@0 60 function doTests()
michael@0 61 {
michael@0 62 // Test focus events.
michael@0 63 gQueue = new eventQueue();
michael@0 64
michael@0 65 gQueue.push(new takeFocusInvoker("tree", getLastChild));
michael@0 66 gQueue.push(new takeFocusInvoker("listitem2"));
michael@0 67
michael@0 68 gQueue.invoke(); // Will call SimpleTest.finish();
michael@0 69 }
michael@0 70
michael@0 71 SimpleTest.waitForExplicitFinish();
michael@0 72 addA11yXULTreeLoadEvent(doTests, "tree", new nsTableTreeView(5));
michael@0 73 ]]>
michael@0 74 </script>
michael@0 75
michael@0 76 <hbox flex="1" style="overflow: auto;">
michael@0 77 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 78 <a target="_blank"
michael@0 79 href="https://bugzilla.mozilla.org/show_bug.cgi?id=706067"
michael@0 80 title="Make takeFocus work on widget items">
michael@0 81 Mozilla Bug 706067
michael@0 82 </a>
michael@0 83 <p id="display"></p>
michael@0 84 <div id="content" style="display: none"></div>
michael@0 85 <pre id="test">
michael@0 86 </pre>
michael@0 87 </body>
michael@0 88
michael@0 89 <vbox flex="1">
michael@0 90 <tree id="tree" flex="1">
michael@0 91 <treecols>
michael@0 92 <treecol id="col1" flex="1" primary="true" label="column"/>
michael@0 93 <treecol id="col2" flex="1" label="column 2"/>
michael@0 94 </treecols>
michael@0 95 <treechildren id="treechildren"/>
michael@0 96 </tree>
michael@0 97
michael@0 98 <listbox id="listbox">
michael@0 99 <listitem id="listitem1">item1</listitem>
michael@0 100 <listitem id="listitem2">item2</listitem>
michael@0 101 </listbox>
michael@0 102
michael@0 103 <vbox id="eventdump"/>
michael@0 104 </vbox>
michael@0 105 </hbox>
michael@0 106 </window>

mercurial