bug 476209 - refactor test_nsIAccessibleDocument.html, r=MarcoZ

This commit is contained in:
David Bolter 2009-02-05 06:43:46 +01:00
Родитель 050661290a
Коммит 0832e07bf0
2 изменённых файлов: 10 добавлений и 29 удалений

Просмотреть файл

@ -33,7 +33,10 @@ const nsIAccessibleValue = Components.interfaces.nsIAccessibleValue;
const nsIObserverService = Components.interfaces.nsIObserverService;
const nsIDOMDocument = Components.interfaces.nsIDOMDocument;
const nsIDOMNode = Components.interfaces.nsIDOMNode;
const nsIDOMWindow = Components.interfaces.nsIDOMWindow;
const nsIPropertyElement = Components.interfaces.nsIPropertyElement;
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -9,34 +9,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
<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>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
<script type="application/javascript">
const nsIAccessibleRetrieval = Components.interfaces.nsIAccessibleRetrieval;
const nsIAccessibleRole = Components.interfaces.nsIAccessibleRole;
const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument;
const nsIDOMDocument = Components.interfaces.nsIDOMDocument;
const nsIDOMWindow = Components.interfaces.nsIDOMWindow;
// needed state flag
const state_focusable =
Components.interfaces.nsIAccessibleStates.STATE_FOCUSABLE;
const state_readonly =
Components.interfaces.nsIAccessibleStates.STATE_READONLY;
var gAccRetrieval = null;
function doTest()
{
gAccRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
getService(nsIAccessibleRetrieval);
// Get accessible for body tag.
var docAcc = null;
try {
docAcc = gAccRetrieval.getAccessibleFor(document).
QueryInterface(nsIAccessibleDocument);
} catch(e) {}
ok(docAcc, "No accessible with interface for document!");
var docAcc = getAccessible(document, [nsIAccessibleDocument]);
if (docAcc) {
// nsIAccessible
is(docAcc.name, "nsIAccessibleDocument chrome tests",
@ -45,11 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
"Wrong role for document!");
// check if it is focusable, read-only.
var state = {}, extraState = {}
docAcc.getState(state, extraState);
var desiredStates = (state_focusable | state_readonly);
is(state.value & desiredStates, desiredStates,
"Wrong state bits for document!");
testStates(docAcc, (STATE_READONLY | STATE_FOCUSABLE));
// No actions wanted on doc
is(docAcc.numActions, 0, "Wrong number of actions for document!");