summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/attributes/test_obj.html
blob: 9e147e1d1760f5229b57da87dd29fddad8a656f2 (plain)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=475006
https://bugzilla.mozilla.org/show_bug.cgi?id=391829
https://bugzilla.mozilla.org/show_bug.cgi?id=581952
https://bugzilla.mozilla.org/show_bug.cgi?id=558036
-->
<head>
  <title>Group attributes tests</title>
  <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="../common.js"></script>
  <script type="application/javascript"
          src="../attributes.js"></script>

  <script type="application/javascript">
    function doTest()
    {
      // aria
      testAttrs("atomic", {"atomic" : "true", "container-atomic" : "true"}, true);
      testAttrs(getNode("atomic").firstChild, {"container-atomic" : "true"}, true);
      testAbsentAttrs("atomic_false", {"atomic" : "false", "container-atomic" : "false"});
      testAbsentAttrs(getNode("atomic_false").firstChild, {"container-atomic" : "false"});

      testAttrs("autocomplete", {"autocomplete" : "true"}, true);
      testAttrs("checkbox", {"checkable" : "true"}, true);
      testAttrs("checkedCheckbox", {"checkable" : "true"}, true);
      testAttrs("checkedMenuitem", {"checkable" : "true"}, true);
      testAttrs("checkedOption", {"checkable" : "true"}, true);
      testAttrs("checkedRadio", {"checkable" : "true"}, true);
      testAttrs("checkedTreeitem", {"checkable" : "true"}, true);
      testAttrs("dropeffect", {"dropeffect" : "copy"}, true);
      testAttrs("grabbed", {"grabbed" : "true"}, true);
      testAbsentAttrs("haspopup", { "haspopup": "false" });
      testAttrs("hidden", {"hidden" : "true"}, true);
      testAbsentAttrs("hidden_false", { "hidden": "false" });
      testAbsentAttrs("modal", {"modal" : "true"});
      testAttrs("sortAscending", {"sort" : "ascending"}, true);
      testAttrs("sortDescending", {"sort" : "descending"}, true);
      testAttrs("sortNone", {"sort" : "none"}, true);
      testAttrs("sortOther", {"sort" : "other"}, true);
      testAttrs("roledescr", {"roledescription" : "spreadshit"}, true);
      testAttrs("currentPage", {"current" : "page"}, true);

      // inherited attributes by subdocuments
      var subdoc = getAccessible("iframe").firstChild;
      testAttrs(subdoc, {"busy" : "true"}, true);

      // live object attribute

      // HTML
      testAttrs("output", {"live" : "polite"}, true);

      // ARIA
      testAttrs("live", {"live" : "polite"}, true);
      testAttrs("live2", {"live" : "polite"}, true);
      testAbsentAttrs("live3", {"live" : ""});
      testAttrs("log", {"live" : "polite"}, true);
      testAttrs("logAssertive", {"live" : "assertive"}, true);
      testAttrs("marquee", {"live" : "off"}, true);
      testAttrs("status", {"live" : "polite"}, true);
      testAttrs("timer", {"live" : "off"}, true);
      testAbsentAttrs("tablist", {"live" : "polite"});

      // container-live object attribute
      testAttrs("liveChild", {"container-live" : "polite"}, true);
      testAttrs("live2Child", {"container-live" : "polite"}, true);
      testAttrs("logChild", {"container-live" : "polite"}, true);
      testAttrs("logAssertiveChild", {"container-live" : "assertive"}, true);
      testAttrs("marqueeChild", {"container-live" : "off"}, true);
      testAttrs("statusChild", {"container-live" : "polite"}, true);
      testAttrs("timerChild", {"container-live" : "off"}, true);
      testAbsentAttrs("tablistChild", {"container-live" : "polite"});

      // container-live-role object attribute
      testAttrs("log", {"container-live-role" : "log"}, true);
      testAttrs("logAssertive", {"container-live-role" : "log"}, true);
      testAttrs("marquee", {"container-live-role" : "marquee"}, true);
      testAttrs("status", {"container-live-role" : "status"}, true);
      testAttrs("timer", {"container-live-role" : "timer"}, true);
      testAttrs("logChild", {"container-live-role" : "log"}, true);
      testAttrs("logAssertive", {"container-live-role" : "log"}, true);
      testAttrs("logAssertiveChild", {"container-live-role" : "log"}, true);
      testAttrs("marqueeChild", {"container-live-role" : "marquee"}, true);
      testAttrs("statusChild", {"container-live-role" : "status"}, true);
      testAttrs("timerChild", {"container-live-role" : "timer"}, true);
      testAbsentAttrs("tablistChild", {"container-live-role" : "tablist"});

      // absent aria-label and aria-labelledby object attribute
      testAbsentAttrs("label", {"label" : "foo"});
      testAbsentAttrs("labelledby", {"labelledby" : "label"});

      // container that has no default live attribute
      testAttrs("liveGroup", {"live" : "polite"}, true);
      testAttrs("liveGroupChild", {"container-live" : "polite"}, true);
      testAttrs("liveGroup", {"container-live-role" : "group"}, true);
      testAttrs("liveGroupChild", {"container-live-role" : "group"}, true);

      // text input type
      testAbsentAttrs("button", { "text-input-type": "button"});
      testAbsentAttrs("checkbox", { "text-input-type": "checkbox"});
      testAbsentAttrs("radio", { "text-input-type": "radio"});
      testAttrs("email", {"text-input-type" : "email"}, true);
      testAttrs("search", {"text-input-type" : "search"}, true);
      testAttrs("tel", {"text-input-type" : "tel"}, true);
      testAttrs("url", {"text-input-type" : "url"}, true);

      // ARIA
      testAttrs("searchbox", {"text-input-type" : "search"}, true);

      // html
      testAttrs("radio", {"checkable" : "true"}, true); 
      testAttrs("checkbox", {"checkable" : "true"}, true); 
      testAttrs("draggable", {"draggable" : "true"}, true);
      testAttrs("th1", { "abbr": "SS#" }, true);
      testAttrs("th2", { "abbr": "SS#" }, true);
      testAttrs("th2", { "axis": "social" }, true);

      // don't barf on an empty abbr element.
      testAbsentAttrs("th3", { "abbr": "" }, true);

      // application accessible
      if (WIN) {
        var gfxInfo = Components.classes["@mozilla.org/gfx/info;1"].
          getService(Components.interfaces.nsIGfxInfo);
        var attrs = {
          "D2D": (gfxInfo.D2DEnabled ? "true" : "false")
        }
        testAttrs(getApplicationAccessible(), attrs, false);
      }

      // no object attributes
      testAbsentAttrs(getAccessible("listitem").firstChild, { "tag": "" });

      // experimental aria
      testAttrs("experimental", {"blah" : "true"}, true);

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>
<body>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=475006"
     title="Extend nsARIAMap to capture ARIA attribute characteristics">
    Mozilla Bug 475006
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=391829"
     title="Add support for container-live-role to object attributes">
    Mozilla Bug 391829
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=581952"
     title="Make explicit that aria-label is not an object attribute">
    Mozilla Bug 475006
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=558036"
     title="make HTML <output> accessible">
    Mozilla Bug 558036
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=896400"
     title="Tablist should no longer be an implicit live region">
    Mozilla Bug 896400
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=563862"
     title="Expand support for nsIAccessibleEvent::OBJECT_ATTRIBUTE_CHANGE">
    Mozilla Bug 563862
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=819303"
     title="crash in nsTextEquivUtils::AppendTextEquivFromTextContent">
    Mozilla Bug 819303
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=838407"
     title="aria-hidden false value shouldn't be exposed via object attributes">
    Mozilla Bug 838407
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121518"
     title="ARIA 1.1: Support role 'searchbox'">
    Mozilla Bug 1121518
  </a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <!-- aria -->
  <div id="atomic" aria-atomic="true">live region</div>
  <div id="atomic_false" aria-atomic="false">live region</div>
  <div id="autocomplete" role="textbox" aria-autocomplete="true"></div>
  <div id="checkbox" role="checkbox"></div>
  <div id="checkedCheckbox" role="checkbox" aria-checked="true"></div>
  <div id="checkedMenuitem" role="menuitem" aria-checked="true"></div>
  <div id="checkedOption" role="option" aria-checked="true"></div>
  <div id="checkedRadio" role="radio" aria-checked="true"></div>
  <div id="checkedTreeitem" role="treeitem" aria-checked="true"></div>
  <div id="dropeffect" aria-dropeffect="copy"></div>
  <div id="grabbed" aria-grabbed="true"></div>
  <div id="haspopup" aria-haspopup="true"></div>
  <div id="hidden" aria-hidden="true"></div>
  <div id="hidden_false" aria-hidden="false"></div>
  <div id="modal" aria-modal="true"></div>
  <div id="sortAscending" role="columnheader" aria-sort="ascending"></div>
  <div id="sortDescending" role="columnheader" aria-sort="descending"></div>
  <div id="sortNone" role="columnheader" aria-sort="none"></div>
  <div id="sortOther" role="columnheader" aria-sort="other"></div>
  <div id="roledescr" aria-roledescription="spreadshit"></div>
  <div id="currentPage" aria-current="page"></div>

  <!-- inherited from iframe -->
  <iframe id="iframe" src="data:text/html,<html><body></body></html>"
          aria-busy="true"></iframe>

  <!-- html -->
  <output id="output"></output>

  <!-- back to aria -->
  <div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div>
  <div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div>
  <div id="live3" role="region">excuse</div>
  <div id="log" role="log">excuse <div id="logChild">me</div></div>
  <div id="logAssertive" role="log" aria-live="assertive">excuse <div id="logAssertiveChild">me</div></div>
  <div id="marquee" role="marquee">excuse <div id="marqueeChild">me</div></div>
  <div id="status" role="status">excuse <div id="statusChild">me</div></div>
  <div id="tablist" role="tablist">tablist <div id="tablistChild">tab</div></div>
  <div id="timer" role="timer">excuse <div id="timerChild">me</div></div>

  <!-- aria-label[ledby] should not be an object attribute -->
  <div id="label" role="checkbox" aria-label="foo"></div>
  <div id="labelledby" role="checkbox" aria-labelledby="label"></div>

  <!-- unusual live case -->
  <div id="liveGroup" role="group" aria-live="polite">
    excuse <div id="liveGroupChild">me</div>
  </div>

  <!-- text input type -->
  <input id="button" type="button"/>
  <input id="email" type="email"/>
  <input id="search" type="search"/>
  <input id="tel" type="tel"/>
  <input id="url" type="url"/>
  <div id="searchbox" role="searchbox"></div>

  <!-- html -->
  <input id="radio" type="radio"/>
  <input id="checkbox" type="checkbox"/>
  <div id="draggable" draggable="true">Draggable div</div>
  <table>
    <tr>
      <th id="th1"><abbr title="Social Security Number">SS#</abbr></th>
      <th id="th2" abbr="SS#" axis="social">Social Security Number</th>
      <th id="th3"><abbr></abbr></th>
    </tr>
  </table>

  <ul>
    <li id="listitem">item
  </ul>

  <!-- experimental aria -->
  <div id="experimental" aria-blah="true">Fake beer</div>
</body>
</html>