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