|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Tests AccessFu TraversalRules</title> |
|
5 <meta charset="utf-8" /> |
|
6 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
7 |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"> |
|
10 </script> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/chrome-harness.js"> |
|
13 </script> |
|
14 |
|
15 <script type="application/javascript" src="../common.js"></script> |
|
16 <script type="application/javascript" src="../browser.js"></script> |
|
17 <script type="application/javascript" src="../events.js"></script> |
|
18 <script type="application/javascript" src="../role.js"></script> |
|
19 <script type="application/javascript" src="../states.js"></script> |
|
20 <script type="application/javascript" src="../pivot.js"></script> |
|
21 <script type="application/javascript" src="../layout.js"></script> |
|
22 |
|
23 <script type="application/javascript"> |
|
24 Components.utils.import("resource://gre/modules/accessibility/TraversalRules.jsm"); |
|
25 var gBrowserWnd = null; |
|
26 var gQueue = null; |
|
27 |
|
28 function doTest() |
|
29 { |
|
30 var doc = currentTabDocument(); |
|
31 var docAcc = getAccessible(doc, [nsIAccessibleDocument]); |
|
32 |
|
33 gQueue = new eventQueue(); |
|
34 |
|
35 gQueue.onFinish = function onFinish() |
|
36 { |
|
37 closeBrowserWindow(); |
|
38 } |
|
39 |
|
40 queueTraversalSequence(gQueue, docAcc, TraversalRules.Heading, null, |
|
41 ['heading-1', 'heading-2', 'heading-3', 'heading-5']); |
|
42 |
|
43 queueTraversalSequence(gQueue, docAcc, TraversalRules.Entry, null, |
|
44 ['input-1-1', 'label-1-2', 'input-1-3', |
|
45 'input-1-4', 'input-1-5']); |
|
46 |
|
47 // move back an element to hit all the form elements, because the VC is |
|
48 // currently at the first input element |
|
49 gQueue.push(new setVCPosInvoker(docAcc, "movePrevious", |
|
50 TraversalRules.Heading, "heading-1")); |
|
51 |
|
52 queueTraversalSequence(gQueue, docAcc, TraversalRules.FormElement, null, |
|
53 ['input-1-1', 'label-1-2', 'button-1-1', |
|
54 'radio-1-1', 'radio-1-2', 'input-1-3', |
|
55 'input-1-4', 'button-1-2', 'checkbox-1-1', |
|
56 'select-1-1', 'select-1-2', 'checkbox-1-2', |
|
57 'select-1-3', 'input-1-5', 'button-1-3', |
|
58 'button-2-1', 'button-2-2', 'button-2-3', |
|
59 'button-2-4']); |
|
60 |
|
61 queueTraversalSequence(gQueue, docAcc, TraversalRules.Button, null, |
|
62 ['button-1-1', 'button-1-2', 'button-1-3', |
|
63 'button-2-1', 'button-2-2', 'button-2-3', |
|
64 'button-2-4']); |
|
65 |
|
66 queueTraversalSequence(gQueue, docAcc, TraversalRules.RadioButton, null, |
|
67 ['radio-1-1', 'radio-1-2']); |
|
68 |
|
69 queueTraversalSequence(gQueue, docAcc, TraversalRules.Checkbox, null, |
|
70 ['checkbox-1-1', 'checkbox-1-2']); |
|
71 |
|
72 queueTraversalSequence(gQueue, docAcc, TraversalRules.Combobox, null, |
|
73 ['select-1-1', 'select-1-2', 'select-1-3']); |
|
74 |
|
75 queueTraversalSequence(gQueue, docAcc, TraversalRules.List, null, |
|
76 ['list-1', 'list-2', 'list-3']); |
|
77 |
|
78 queueTraversalSequence(gQueue, docAcc, TraversalRules.ListItem, null, |
|
79 ['listitem-1-1', 'listitem-2-1', 'listitem-2-2', |
|
80 'listitem-3-1', 'listitem-3-2', 'listitem-3-3', |
|
81 'listitem-2-3']); |
|
82 |
|
83 queueTraversalSequence(gQueue, docAcc, TraversalRules.Graphic, null, |
|
84 ['image-2', 'image-3']); |
|
85 |
|
86 queueTraversalSequence(gQueue, docAcc, TraversalRules.Link, null, |
|
87 ['link-1', 'link-2', 'link-3']); |
|
88 |
|
89 queueTraversalSequence(gQueue, docAcc, TraversalRules.Anchor, null, |
|
90 ['anchor-1', 'anchor-2']); |
|
91 |
|
92 queueTraversalSequence(gQueue, docAcc, TraversalRules.Separator, null, |
|
93 ['separator-1', 'separator-2']); |
|
94 |
|
95 queueTraversalSequence(gQueue, docAcc, TraversalRules.Table, null, |
|
96 ['table-1', 'table-2']); |
|
97 |
|
98 queueTraversalSequence(gQueue, docAcc, TraversalRules.Simple, null, |
|
99 ['heading-1', 'Name:', 'input-1-1', 'label-1-2', |
|
100 'button-1-1', 'Radios are old: ', 'radio-1-1', |
|
101 'Radios are new: ', 'radio-1-2', 'Password:', |
|
102 'input-1-3', 'Unlucky number:', 'input-1-4', |
|
103 'button-1-2', 'Check me: ', 'checkbox-1-1', |
|
104 'select-1-1', 'Value 1', 'Value 2', 'Value 3', |
|
105 'Check me too: ', 'checkbox-1-2', 'But not me: ', |
|
106 'Or me! ', 'Value 1', 'Value 2', 'Value 3', |
|
107 'Electronic mailing address:', 'input-1-5', |
|
108 'button-1-3', 'heading-2', 'heading-3', |
|
109 'button-2-1', 'button-2-2', 'button-2-3', |
|
110 'button-2-4', 'Programming Language', |
|
111 'A esoteric weapon wielded by only the most ' + |
|
112 'formidable warriors, for its unrelenting strict' + |
|
113 ' power is unfathomable.', |
|
114 'Lists of Programming Languages', 'Lisp ', |
|
115 'Scheme', 'Racket', 'Clojure', 'JavaScript', 'heading-5', |
|
116 'image-2', 'image-3', 'Not actually an image', |
|
117 'link-1', 'anchor-1', 'link-2', 'anchor-2', 'link-3', |
|
118 '3', '1', '4', '1', 'Just an innocuous separator', |
|
119 'Dirty Words', 'Meaning', 'Mud', 'Wet Dirt', |
|
120 'Dirt', 'Messy Stuff']); |
|
121 |
|
122 gQueue.invoke(); |
|
123 } |
|
124 |
|
125 SimpleTest.waitForExplicitFinish(); |
|
126 addLoadEvent(function () { |
|
127 /* We open a new browser because we need to test with a top-level content |
|
128 document. */ |
|
129 openBrowserWindow( |
|
130 doTest, |
|
131 getRootDirectory(window.location.href) + "doc_traversal.html"); |
|
132 }); |
|
133 </script> |
|
134 </head> |
|
135 <body id="body"> |
|
136 |
|
137 <a target="_blank" |
|
138 title="Add tests for AccessFu TraversalRules" |
|
139 href="https://bugzilla.mozilla.org/show_bug.cgi?id=933808">Mozilla Bug 933808</a> |
|
140 <p id="display"></p> |
|
141 <div id="content" style="display: none"></div> |
|
142 <pre id="test"> |
|
143 </pre> |
|
144 </body> |
|
145 </html> |