|
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 <?xml-stylesheet href="../treeview.css" |
|
6 type="text/css"?> |
|
7 |
|
8 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
9 title="Accessible XUL tree states tests"> |
|
10 |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
13 |
|
14 <script type="application/javascript" |
|
15 src="../treeview.js" /> |
|
16 |
|
17 <script type="application/javascript" |
|
18 src="../common.js" /> |
|
19 <script type="application/javascript" |
|
20 src="../role.js" /> |
|
21 <script type="application/javascript" |
|
22 src="../states.js" /> |
|
23 <script type="application/javascript" |
|
24 src="../events.js" /> |
|
25 |
|
26 <script type="application/javascript"> |
|
27 <![CDATA[ |
|
28 //////////////////////////////////////////////////////////////////////////// |
|
29 // Test |
|
30 |
|
31 /** |
|
32 * Event queue invoker object to test accessible states for XUL tree |
|
33 * accessible. |
|
34 */ |
|
35 function statesChecker(aTreeID, aView) |
|
36 { |
|
37 this.DOMNode = getNode(aTreeID); |
|
38 |
|
39 this.invoke = function statesChecker_invoke() |
|
40 { |
|
41 this.DOMNode.treeBoxObject.view = aView; |
|
42 } |
|
43 |
|
44 this.check = function statesChecker_check() |
|
45 { |
|
46 var tree = getAccessible(this.DOMNode); |
|
47 |
|
48 // tree states |
|
49 testStates(tree, STATE_READONLY); |
|
50 |
|
51 if (this.DOMNode.getAttribute("seltype") != "single") |
|
52 testStates(tree, STATE_MULTISELECTABLE); |
|
53 else |
|
54 testStates(tree, 0, 0, STATE_MULTISELECTABLE); |
|
55 |
|
56 // tree item states |
|
57 var expandedItem = tree.getChildAt(2); |
|
58 testStates(expandedItem, |
|
59 STATE_SELECTABLE | STATE_FOCUSABLE | STATE_EXPANDED); |
|
60 |
|
61 var collapsedItem = tree.getChildAt(5); |
|
62 testStates(collapsedItem, |
|
63 STATE_SELECTABLE | STATE_FOCUSABLE | STATE_COLLAPSED); |
|
64 |
|
65 // cells states if any |
|
66 var cells = collapsedItem.children; |
|
67 if (cells && cells.length) { |
|
68 for (var idx = 0; idx < cells.length; idx++) { |
|
69 var cell = cells.queryElementAt(idx, nsIAccessible); |
|
70 testStates(cell, STATE_SELECTABLE); |
|
71 } |
|
72 |
|
73 var checkboxCell = cells.queryElementAt(3, nsIAccessible); |
|
74 testStates(checkboxCell, STATE_CHECKABLE | STATE_CHECKED); |
|
75 } |
|
76 } |
|
77 |
|
78 this.getID = function statesChecker_getID() |
|
79 { |
|
80 return "tree processor for " + prettyName(aTreeID); |
|
81 } |
|
82 } |
|
83 |
|
84 gA11yEventDumpToConsole = true; // debug stuff |
|
85 |
|
86 var gQueue = null; |
|
87 |
|
88 function doTest() |
|
89 { |
|
90 gQueue = new eventQueue(EVENT_REORDER); |
|
91 gQueue.push(new statesChecker("tree", new nsTreeTreeView())); |
|
92 gQueue.push(new statesChecker("treesingle", new nsTreeTreeView())); |
|
93 gQueue.push(new statesChecker("tabletree", new nsTreeTreeView())); |
|
94 |
|
95 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
96 } |
|
97 |
|
98 if (MAC && (navigator.userAgent.indexOf("Mac OS X 10.6") != -1)) { |
|
99 todo(false, |
|
100 "Re-enable on Mac OS 10.6 after fixing bug 845095 - intermittent orange"); |
|
101 } else { |
|
102 SimpleTest.waitForExplicitFinish(); |
|
103 addA11yLoadEvent(doTest); |
|
104 } |
|
105 ]]> |
|
106 </script> |
|
107 |
|
108 <hbox flex="1" style="overflow: auto;"> |
|
109 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
110 <a target="_blank" |
|
111 href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" |
|
112 title="Reorganize implementation of XUL tree accessibility"> |
|
113 Mozilla Bug 503727 |
|
114 </a><br/> |
|
115 <p id="display"></p> |
|
116 <div id="content" style="display: none"> |
|
117 </div> |
|
118 <pre id="test"> |
|
119 </pre> |
|
120 </body> |
|
121 |
|
122 <vbox flex="1"> |
|
123 <tree id="tree" flex="1"> |
|
124 <treecols> |
|
125 <treecol id="col" flex="1" primary="true" label="column"/> |
|
126 </treecols> |
|
127 <treechildren/> |
|
128 </tree> |
|
129 |
|
130 <tree id="treesingle" flex="1" seltype="single"> |
|
131 <treecols> |
|
132 <treecol id="col_single" flex="1" primary="true" label="column"/> |
|
133 </treecols> |
|
134 <treechildren/> |
|
135 </tree> |
|
136 |
|
137 <tree id="tabletree" flex="1" editable="true"> |
|
138 <treecols> |
|
139 <treecol id="tabletree_col1" cycler="true" label="cycler"/> |
|
140 <treecol id="tabletree_col2" flex="1" primary="true" label="column1"/> |
|
141 <treecol id="tabletree_col3" flex="1" label="column2"/> |
|
142 <treecol id="tabletree_col4" flex="1" label="checker" |
|
143 type="checkbox" editable="true"/> |
|
144 </treecols> |
|
145 <treechildren/> |
|
146 </tree> |
|
147 |
|
148 <vbox id="debug"/> |
|
149 </vbox> |
|
150 </hbox> |
|
151 |
|
152 </window> |
|
153 |