|
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"?> |
|
5 |
|
6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
7 title="Accessible focus testing"> |
|
8 |
|
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"/> |
|
13 |
|
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" /> |
|
22 |
|
23 <script type="application/javascript" |
|
24 src="../treeview.js" /> |
|
25 |
|
26 <script type="application/javascript"> |
|
27 <![CDATA[ |
|
28 //////////////////////////////////////////////////////////////////////////// |
|
29 // Invokers |
|
30 |
|
31 function takeFocusInvoker(aID, aArgConverterFunc) |
|
32 { |
|
33 this.targetFunc = aArgConverterFunc ? aArgConverterFunc : getAccessible; |
|
34 |
|
35 this.eventSeq = [ new focusChecker(this.targetFunc, aID) ]; |
|
36 |
|
37 this.invoke = function takeFocusInvoker_invoke() |
|
38 { |
|
39 this.targetFunc.call(null, aID).takeFocus(); |
|
40 } |
|
41 |
|
42 this.getID = function takeFocusInvoker_getID() |
|
43 { |
|
44 return "takeFocus for " + prettyName(aID); |
|
45 } |
|
46 } |
|
47 |
|
48 function getLastChild(aID) |
|
49 { |
|
50 return getAccessible(aID).lastChild; |
|
51 } |
|
52 |
|
53 //////////////////////////////////////////////////////////////////////////// |
|
54 // Tests |
|
55 |
|
56 //gA11yEventDumpID = "eventdump"; // debug stuff |
|
57 //gA11yEventDumpToConsole = true; // debug stuff |
|
58 |
|
59 var gQueue = null; |
|
60 function doTests() |
|
61 { |
|
62 // Test focus events. |
|
63 gQueue = new eventQueue(); |
|
64 |
|
65 gQueue.push(new takeFocusInvoker("tree", getLastChild)); |
|
66 gQueue.push(new takeFocusInvoker("listitem2")); |
|
67 |
|
68 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
69 } |
|
70 |
|
71 SimpleTest.waitForExplicitFinish(); |
|
72 addA11yXULTreeLoadEvent(doTests, "tree", new nsTableTreeView(5)); |
|
73 ]]> |
|
74 </script> |
|
75 |
|
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> |
|
88 |
|
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> |
|
97 |
|
98 <listbox id="listbox"> |
|
99 <listitem id="listitem1">item1</listitem> |
|
100 <listitem id="listitem2">item2</listitem> |
|
101 </listbox> |
|
102 |
|
103 <vbox id="eventdump"/> |
|
104 </vbox> |
|
105 </hbox> |
|
106 </window> |