|
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 XUL tree actions tests"> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../treeview.js" /> |
|
14 |
|
15 <script type="application/javascript" |
|
16 src="../common.js" /> |
|
17 <script type="application/javascript" |
|
18 src="../role.js" /> |
|
19 <script type="application/javascript" |
|
20 src="../states.js" /> |
|
21 <script type="application/javascript" |
|
22 src="../events.js" /> |
|
23 <script type="application/javascript" |
|
24 src="../actions.js" /> |
|
25 |
|
26 <script type="application/javascript"> |
|
27 <![CDATA[ |
|
28 //////////////////////////////////////////////////////////////////////////// |
|
29 // Accessible tree testers |
|
30 |
|
31 function stateFocusChecker(aAcc, aStates) |
|
32 { |
|
33 this.__proto__ = new focusChecker(aAcc); |
|
34 |
|
35 this.check = function focusChecker_check(aEvent) |
|
36 { |
|
37 var states = aStates ? aStates : 0; |
|
38 testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states); |
|
39 } |
|
40 } |
|
41 |
|
42 //////////////////////////////////////////////////////////////////////////// |
|
43 // Test |
|
44 |
|
45 // gA11yEventDumpID = "debug"; |
|
46 //gA11yEventDumpToConsole = true; // debug |
|
47 |
|
48 function doTest() |
|
49 { |
|
50 var treeNode = getNode("tree"); |
|
51 |
|
52 var treeBodyNode = treeNode.boxObject.treeBody; |
|
53 |
|
54 var tree = getAccessible(treeNode); |
|
55 var expandedTreeItem = tree.getChildAt(2); |
|
56 var collapsedTreeItem = tree.getChildAt(5); |
|
57 |
|
58 var actions = [ |
|
59 { |
|
60 ID: expandedTreeItem, |
|
61 actionName: "activate", |
|
62 actionIndex: 0, |
|
63 events: CLICK_EVENTS, |
|
64 targetID: treeBodyNode, |
|
65 eventSeq: [ |
|
66 new stateFocusChecker(expandedTreeItem, STATE_EXPANDED) |
|
67 ] |
|
68 }, |
|
69 { |
|
70 ID: collapsedTreeItem, |
|
71 actionName: "expand", |
|
72 actionIndex: 1, |
|
73 events: CLICK_EVENTS, |
|
74 targetID: treeBodyNode, |
|
75 checkOnClickEvent: function check(aEvent) |
|
76 { |
|
77 testStates(this.ID, STATE_EXPANDED); |
|
78 } |
|
79 }, |
|
80 { |
|
81 ID: collapsedTreeItem, |
|
82 actionName: "collapse", |
|
83 actionIndex: 1, |
|
84 events: CLICK_EVENTS, |
|
85 targetID: treeBodyNode, |
|
86 checkOnClickEvent: function check(aEvent) |
|
87 { |
|
88 testStates(this.ID, STATE_COLLAPSED); |
|
89 } |
|
90 } |
|
91 ]; |
|
92 |
|
93 testActions(actions); // Will call SimpleTest.finish(); |
|
94 } |
|
95 |
|
96 SimpleTest.waitForExplicitFinish(); |
|
97 addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView()); |
|
98 ]]> |
|
99 </script> |
|
100 |
|
101 <hbox flex="1" style="overflow: auto;"> |
|
102 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
103 <a target="_blank" |
|
104 href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" |
|
105 title="Reorganize implementation of XUL tree accessibility"> |
|
106 Mozilla Bug 503727 |
|
107 </a><br/> |
|
108 <p id="display"></p> |
|
109 <div id="content" style="display: none"> |
|
110 </div> |
|
111 <pre id="test"> |
|
112 </pre> |
|
113 </body> |
|
114 |
|
115 <vbox flex="1"> |
|
116 <tree id="tree" flex="1" minheight="100px"> |
|
117 <treecols> |
|
118 <treecol id="col" flex="1" primary="true" label="column"/> |
|
119 </treecols> |
|
120 <treechildren/> |
|
121 </tree> |
|
122 |
|
123 <vbox id="debug"/> |
|
124 </vbox> |
|
125 </hbox> |
|
126 |
|
127 </window> |
|
128 |