2008-06-26 05:17:35 -07:00
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>nsIAccessibleDocument chrome tests</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
|
|
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
|
2009-02-04 21:43:46 -08:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
2009-03-07 03:23:25 -08:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
2009-02-04 21:43:46 -08:00
|
|
|
<script type="application/javascript"
|
2009-05-22 09:09:51 -07:00
|
|
|
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
2008-06-26 05:17:35 -07:00
|
|
|
|
2009-02-04 21:43:46 -08:00
|
|
|
<script type="application/javascript">
|
2008-06-26 05:17:35 -07:00
|
|
|
function doTest()
|
|
|
|
{
|
2009-02-04 21:43:46 -08:00
|
|
|
var docAcc = getAccessible(document, [nsIAccessibleDocument]);
|
2008-06-26 05:17:35 -07:00
|
|
|
if (docAcc) {
|
|
|
|
// nsIAccessible
|
|
|
|
is(docAcc.name, "nsIAccessibleDocument chrome tests",
|
|
|
|
"Name for document accessible not correct!");
|
2009-03-07 03:23:25 -08:00
|
|
|
|
|
|
|
testRole(docAcc, ROLE_DOCUMENT);
|
2008-06-26 05:17:35 -07:00
|
|
|
|
|
|
|
// check if it is focusable, read-only.
|
2009-02-04 21:43:46 -08:00
|
|
|
testStates(docAcc, (STATE_READONLY | STATE_FOCUSABLE));
|
2008-06-26 05:17:35 -07:00
|
|
|
|
|
|
|
// No actions wanted on doc
|
|
|
|
is(docAcc.numActions, 0, "Wrong number of actions for document!");
|
|
|
|
|
|
|
|
// attributes should contain tag:body
|
|
|
|
attributes = docAcc.attributes;
|
|
|
|
is(attributes.getStringProperty("tag"), "BODY",
|
|
|
|
"Wrong attribute on document!");
|
|
|
|
|
|
|
|
// nsIAccessibleDocument
|
|
|
|
is(docAcc.URL, "chrome://mochikit/content/a11y/accessible/test_nsIAccessibleDocument.html",
|
|
|
|
"Wrong URL for document!");
|
|
|
|
is(docAcc.title, "nsIAccessibleDocument chrome tests",
|
|
|
|
"Wrong title for document!");
|
|
|
|
is(docAcc.mimeType, "text/html",
|
|
|
|
"Wrong mime type for document!");
|
|
|
|
// nsDocAccessible::getDocType currently returns NS_ERROR_FAILURE.
|
|
|
|
// See bug 442005. After fixing, please remove this comment and
|
|
|
|
// uncomment the below two lines to enable the test.
|
|
|
|
// is(docAcc.docType, "HTML",
|
|
|
|
// "Wrong type of document!");
|
|
|
|
|
|
|
|
// Test for correct nsIDOMDocument retrieval.
|
|
|
|
var domDoc = null;
|
|
|
|
try {
|
|
|
|
domDoc = docAcc.document.QueryInterface(nsIDOMDocument);
|
|
|
|
} catch(e) {}
|
|
|
|
ok(domDoc, "no nsIDOMDocument for this doc accessible!");
|
|
|
|
is(domDoc, document, "Document nodes do not match!");
|
|
|
|
|
|
|
|
// Test for correct nsIDOMWindow retrieval.
|
|
|
|
var domWindow = null;
|
|
|
|
try {
|
|
|
|
domWindow = docAcc.window.QueryInterface(nsIDOMWindow);
|
|
|
|
} catch(e) {}
|
|
|
|
ok(domWindow, "no nsIDOMWindow for this doc accessible!");
|
|
|
|
is(domWindow, window, "Window nodes do not match!");
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addLoadEvent(doTest);
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=441737"
|
|
|
|
title="nsAccessibleDocument chrome tests">
|
|
|
|
Mozilla Bug 441737
|
|
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|