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