|
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="XUL tree focus testing"> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/MochiKit/packed.js" /> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
13 <script type="application/javascript" |
|
14 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
|
15 |
|
16 <script type="application/javascript" |
|
17 src="../treeview.js" /> |
|
18 |
|
19 <script type="application/javascript" |
|
20 src="../common.js" /> |
|
21 <script type="application/javascript" |
|
22 src="../role.js" /> |
|
23 <script type="application/javascript" |
|
24 src="../states.js" /> |
|
25 <script type="application/javascript" |
|
26 src="../events.js" /> |
|
27 |
|
28 <script type="application/javascript"> |
|
29 <![CDATA[ |
|
30 |
|
31 //////////////////////////////////////////////////////////////////////////// |
|
32 // Invokers |
|
33 |
|
34 function focusTree(aTreeID) |
|
35 { |
|
36 var checker = new focusChecker(getFirstTreeItem, aTreeID); |
|
37 this.__proto__ = new synthFocus(aTreeID, [ checker ]); |
|
38 } |
|
39 |
|
40 function moveToNextItem(aTreeID) |
|
41 { |
|
42 var checker = new focusChecker(getSecondTreeItem, aTreeID); |
|
43 this.__proto__ = new synthDownKey(aTreeID, [ checker ]); |
|
44 } |
|
45 |
|
46 //////////////////////////////////////////////////////////////////////////// |
|
47 // Helpers |
|
48 |
|
49 function getTreeItemAt(aTreeID, aIdx) |
|
50 { return getAccessible(aTreeID).getChildAt(aIdx + 1); } |
|
51 |
|
52 function getFirstTreeItem(aTreeID) |
|
53 { return getTreeItemAt(aTreeID, 0); } |
|
54 |
|
55 function getSecondTreeItem(aTreeID) |
|
56 { return getTreeItemAt(aTreeID, 1); } |
|
57 |
|
58 //////////////////////////////////////////////////////////////////////////// |
|
59 // Test |
|
60 |
|
61 var gQueue = null; |
|
62 |
|
63 //gA11yEventDumpID = "debug"; // debugging |
|
64 //gA11yEventDumpToConsole = true; // debugging |
|
65 |
|
66 function doTest() |
|
67 { |
|
68 gQueue = new eventQueue(); |
|
69 |
|
70 gQueue.push(new focusTree("tree")); |
|
71 gQueue.push(new moveToNextItem("tree")); |
|
72 gQueue.push(new synthFocus("emptytree")); |
|
73 |
|
74 // no focus event for changed current item for unfocused tree |
|
75 gQueue.push(new changeCurrentItem("tree", 0)); |
|
76 |
|
77 gQueue.invoke(); |
|
78 } |
|
79 |
|
80 SimpleTest.waitForExplicitFinish(); |
|
81 addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(5)); |
|
82 ]]> |
|
83 </script> |
|
84 |
|
85 <hbox flex="1" style="overflow: auto;"> |
|
86 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
87 <a target="_blank" |
|
88 href="https://bugzilla.mozilla.org/show_bug.cgi?id=386821" |
|
89 title="Need better solution for firing delayed event against xul tree"> |
|
90 Mozilla Bug 386821 |
|
91 </a> |
|
92 <a target="_blank" |
|
93 href="https://bugzilla.mozilla.org/show_bug.cgi?id=406308" |
|
94 title="Don't fire accessible focus events if widget is not actually in focus, confuses screen readers"> |
|
95 Mozilla Bug 406308 |
|
96 </a> |
|
97 <p id="display"></p> |
|
98 <div id="content" style="display: none"> |
|
99 </div> |
|
100 <pre id="test"> |
|
101 </pre> |
|
102 </body> |
|
103 |
|
104 <vbox id="debug"/> |
|
105 <tree id="tree" flex="1"> |
|
106 <treecols> |
|
107 <treecol id="col1" flex="1" primary="true" label="column"/> |
|
108 <treecol id="col2" flex="1" label="column 2"/> |
|
109 </treecols> |
|
110 <treechildren id="treechildren"/> |
|
111 </tree> |
|
112 <tree id="emptytree" flex="1"> |
|
113 <treecols> |
|
114 <treecol id="emptytree_col1" flex="1" primary="true" label="column"/> |
|
115 <treecol id="emptytree_col2" flex="1" label="column 2"/> |
|
116 </treecols> |
|
117 <treechildren id="emptytree_treechildren"/> |
|
118 </tree> |
|
119 </hbox> |
|
120 |
|
121 </window> |
|
122 |