|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>states of document</title> |
|
5 <link rel="stylesheet" type="text/css" |
|
6 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
7 |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
10 |
|
11 <script type="application/javascript" |
|
12 src="../common.js"></script> |
|
13 <script type="application/javascript" |
|
14 src="../role.js"></script> |
|
15 <script type="application/javascript" |
|
16 src="../states.js"></script> |
|
17 |
|
18 <script type="application/javascript"> |
|
19 function doTest() |
|
20 { |
|
21 // Bug 566542: root accesible should expose active state when focused. |
|
22 testStates(getRootAccessible(), 0, EXT_STATE_ACTIVE); |
|
23 |
|
24 // Bug 509696, 607219. |
|
25 testStates(document, STATE_READONLY, 0); // role="" |
|
26 |
|
27 document.body.setAttribute("role","banner"); // no platform mapping |
|
28 testStates(document, STATE_READONLY); |
|
29 document.body.setAttribute("role","foo"); // bogus role |
|
30 testStates(document, STATE_READONLY); |
|
31 document.body.removeAttribute("role"); |
|
32 testStates(document, STATE_READONLY); |
|
33 |
|
34 // Bugs 454997 and 467387 |
|
35 testStates(document, STATE_READONLY); |
|
36 testStates("document", STATE_READONLY); |
|
37 testStates("editable_document", 0, EXT_STATE_EDITABLE, STATE_READONLY); |
|
38 |
|
39 document.designMode = "on"; |
|
40 |
|
41 testStates(document, 0, EXT_STATE_EDITABLE, STATE_READONLY); |
|
42 testStates("p", 0, EXT_STATE_EDITABLE, STATE_READONLY); |
|
43 testStates("document", 0, EXT_STATE_EDITABLE, STATE_READONLY); |
|
44 testStates("editable_document", 0, EXT_STATE_EDITABLE, STATE_READONLY); |
|
45 |
|
46 document.designMode = "off"; |
|
47 |
|
48 testStates(document, STATE_READONLY); |
|
49 testStates("document", STATE_READONLY); |
|
50 testStates("editable_document", 0, EXT_STATE_EDITABLE, STATE_READONLY); |
|
51 |
|
52 SimpleTest.finish(); |
|
53 } |
|
54 |
|
55 SimpleTest.waitForExplicitFinish(); |
|
56 addA11yLoadEvent(doTest); |
|
57 </script> |
|
58 </head> |
|
59 |
|
60 <body role=""> |
|
61 |
|
62 <a target="_blank" |
|
63 title="<body contenteditable='true'> exposed incorrectly" |
|
64 href="https://bugzilla.mozilla.org/show_bug.cgi?id=454997">Mozilla Bug 454997</a> |
|
65 <a target="_blank" |
|
66 title="nsIAccessible states tests of editable document" |
|
67 href="https://bugzilla.mozilla.org/show_bug.cgi?id=467387">Mozilla Bug 467387</a> |
|
68 <a target="_blank" |
|
69 title="Role attribute on body with empty string causes DocAccessible not to have read-only state." |
|
70 href="https://bugzilla.mozilla.org/show_bug.cgi?id=509696">Mozilla Bug 509696</a> |
|
71 <a target="_blank" |
|
72 title="Frame for firefox does not implement the state "active" when firefox is the active frame" |
|
73 href="https://bugzilla.mozilla.org/show_bug.cgi?id=566542">Mozilla Bug 566542</a> |
|
74 <a target="_blank" |
|
75 title="Dynamic role attribute change on body doesn't affect on document role" |
|
76 href="https://bugzilla.mozilla.org/show_bug.cgi?id=607219">Mozilla Bug 607219</a> |
|
77 |
|
78 <p id="display"></p> |
|
79 <div id="content" style="display: none"></div> |
|
80 <pre id="test"> |
|
81 </pre> |
|
82 |
|
83 <p id="p">hello</p> |
|
84 |
|
85 <div id="document" role="document">document</div> |
|
86 <div id="editable_document" role="document" contentEditable="true">editable document</doc> |
|
87 |
|
88 </body> |
|
89 </html> |