|
1 <html> |
|
2 <!-- |
|
3 https://bugzilla.mozilla.org/show_bug.cgi?id=441737 |
|
4 --> |
|
5 <head> |
|
6 <title>nsIAccessibleDocument chrome tests</title> |
|
7 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <script type="application/javascript" 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 src="chrome://mochikit/content/chrome-harness.js"></script> |
|
20 |
|
21 <script type="application/javascript"> |
|
22 function doTest() |
|
23 { |
|
24 var docAcc = getAccessible(document, [nsIAccessibleDocument]); |
|
25 if (docAcc) { |
|
26 // nsIAccessible |
|
27 is(docAcc.name, "nsIAccessibleDocument chrome tests", |
|
28 "Name for document accessible not correct!"); |
|
29 |
|
30 testRole(docAcc, ROLE_DOCUMENT); |
|
31 |
|
32 // check if it is focusable, read-only. |
|
33 testStates(docAcc, (STATE_READONLY | STATE_FOCUSABLE)); |
|
34 |
|
35 // No actions wanted on doc |
|
36 is(docAcc.actionCount, 0, "Wrong number of actions for document!"); |
|
37 |
|
38 // attributes should contain tag:body |
|
39 attributes = docAcc.attributes; |
|
40 is(attributes.getStringProperty("tag"), "body", |
|
41 "Wrong attribute on document!"); |
|
42 |
|
43 // Document URL. |
|
44 var rootDir = getRootDirectory(window.location.href); |
|
45 is(docAcc.URL, rootDir + "test_nsIAccessibleDocument.html", |
|
46 "Wrong URL for document!"); |
|
47 |
|
48 // Document title and mime type. |
|
49 is(docAcc.title, "nsIAccessibleDocument chrome tests", |
|
50 "Wrong title for document!"); |
|
51 is(docAcc.mimeType, "text/html", |
|
52 "Wrong mime type for document!"); |
|
53 |
|
54 // DocAccessible::getDocType currently returns NS_ERROR_FAILURE. |
|
55 // See bug 442005. After fixing, please remove this comment and |
|
56 // uncomment the below two lines to enable the test. |
|
57 // is(docAcc.docType, "HTML", |
|
58 // "Wrong type of document!"); |
|
59 |
|
60 // Test for correct nsIDOMDocument retrieval. |
|
61 var domDoc = null; |
|
62 try { |
|
63 domDoc = docAcc.DOMDocument.QueryInterface(nsIDOMDocument); |
|
64 } catch(e) {} |
|
65 ok(domDoc, "no nsIDOMDocument for this doc accessible!"); |
|
66 is(domDoc, document, "Document nodes do not match!"); |
|
67 |
|
68 // Test for correct nsIDOMWindow retrieval. |
|
69 var domWindow = null; |
|
70 try { |
|
71 domWindow = docAcc.window.QueryInterface(nsIDOMWindow); |
|
72 } catch(e) {} |
|
73 ok(domWindow, "no nsIDOMWindow for this doc accessible!"); |
|
74 is(domWindow, window, "Window nodes do not match!"); |
|
75 } |
|
76 |
|
77 SimpleTest.finish(); |
|
78 } |
|
79 |
|
80 SimpleTest.waitForExplicitFinish(); |
|
81 addA11yLoadEvent(doTest); |
|
82 </script> |
|
83 </head> |
|
84 <body> |
|
85 |
|
86 <a target="_blank" |
|
87 href="https://bugzilla.mozilla.org/show_bug.cgi?id=441737" |
|
88 title="nsAccessibleDocument chrome tests"> |
|
89 Mozilla Bug 441737 |
|
90 </a> |
|
91 <p id="display"></p> |
|
92 <div id="content" style="display: none"></div> |
|
93 <pre id="test"> |
|
94 </pre> |
|
95 </body> |
|
96 </html> |