mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Bug 419811 - bustage fix, added missed file
This commit is contained in:
parent
f058f691fc
commit
449b0851de
155
accessible/tests/mochitest/test_nsIAccessibleTable_4.html
Normal file
155
accessible/tests/mochitest/test_nsIAccessibleTable_4.html
Normal file
@ -0,0 +1,155 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<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>
|
||||
<script type="text/javascript">
|
||||
|
||||
function doTest()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var accService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
|
||||
getService(Components.interfaces.nsIAccessibleRetrieval);
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
// Test table with display:inline. We shouldn't create table accessible and
|
||||
// table cell accessible in this case
|
||||
var table1 = document.getElementById("table1");
|
||||
var accNotCreated = false;
|
||||
try {
|
||||
var accTable1 = accService.getAccessibleFor(table1);
|
||||
} catch (e) {
|
||||
accNotCreated = true;
|
||||
}
|
||||
ok(accNotCreated, "wrongly created table accessible");
|
||||
|
||||
if (accNotCreated) {
|
||||
var div = document.getElementById("div");
|
||||
var accDiv = accService.getAccessibleFor(div);
|
||||
is(accDiv.firstChild.name, "cell", "wrongly created table cell accessible");
|
||||
}
|
||||
|
||||
// Test table with display:inline and have an another outside table
|
||||
var table2 = document.getElementById("table2");
|
||||
accNotCreated = false;
|
||||
try {
|
||||
var accTable2 = accService.getAccessibleFor(table2);
|
||||
} catch (e) {
|
||||
accNotCreated = true;
|
||||
}
|
||||
ok(accNotCreated, "wrongly created table accessible");
|
||||
|
||||
var cell = document.getElementById("cell");
|
||||
accNotCreated = false;
|
||||
try {
|
||||
var accCell = accService.getAccessibleFor(cell);
|
||||
} catch (e) {
|
||||
accNotCreated = true;
|
||||
}
|
||||
ok(accNotCreated, "wrongly created table cell accessible");
|
||||
|
||||
// Test table with role=alert.
|
||||
var table3 = document.getElementById("table3");
|
||||
var accTable3;
|
||||
var tableInterfaceExposed = true;
|
||||
try {
|
||||
accTable3 = accService.getAccessibleFor(table3).
|
||||
QueryInterface(Components.interfaces.nsIAccessibleTable);
|
||||
} catch (e) {
|
||||
tableInterfaceExposed = false;
|
||||
}
|
||||
ok(tableInterfaceExposed, "table interface is not exposed");
|
||||
|
||||
if (tableInterfaceExposed) {
|
||||
is(accTable3.finalRole, Ci.nsIAccessibleRole.ROLE_ALERT, "wrong role");
|
||||
|
||||
is(accTable3.cellRefAt(0,0).firstChild.name, "cell0", "wrong cell");
|
||||
is(accTable3.cellRefAt(0,1).firstChild.name, "cell1", "wrong cell");
|
||||
}
|
||||
|
||||
// Test table with role=log and aria property in tr. We create accessible for
|
||||
// tr in this case.
|
||||
var table4 = document.getElementById("table4");
|
||||
var accTable4;
|
||||
tableInterfaceExposed = true;
|
||||
try {
|
||||
accTable4 = accService.getAccessibleFor(table4).
|
||||
QueryInterface(Components.interfaces.nsIAccessibleTable);
|
||||
} catch (e) {
|
||||
tableInterfaceExposed = false;
|
||||
}
|
||||
ok(tableInterfaceExposed, "table interface is not exposed");
|
||||
|
||||
if (tableInterfaceExposed) {
|
||||
var tr = document.getElementById("tr");
|
||||
accNotCreated = false;
|
||||
try {
|
||||
var accTr = accService.getAccessibleFor(tr);
|
||||
} catch (e) {
|
||||
accNotCreated = true;
|
||||
}
|
||||
ok(!accNotCreated, "missed tr accessible");
|
||||
|
||||
is(accTable4.role, Ci.nsIAccessibleRole.ROLE_TABLE, "wrong role");
|
||||
|
||||
is(accTable4.cellRefAt(0,0).firstChild.name, "cell0", "wrong cell");
|
||||
is(accTable4.cellRefAt(0,1).firstChild.name, "cell1", "wrong cell");
|
||||
is(accTable4.cellRefAt(1,0).firstChild.name, "cell2", "wrong cell");
|
||||
is(accTable4.cellRefAt(1,1).firstChild.name, "cell3", "wrong cell");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body >
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=419811">Mozilla Bug 419811</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<!-- Test Table -->
|
||||
<br><br><b> Testing Table:</b><br><br>
|
||||
<center>
|
||||
<div id="div">
|
||||
<table id="table1" border="1" style="display:inline">
|
||||
<tr>
|
||||
<td>cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<table><tr><td>
|
||||
<table id="table2" border="1" style="display:inline">
|
||||
<tr>
|
||||
<td id="cell">cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr></table>
|
||||
|
||||
<table id="table3" border="1" role="alert">
|
||||
<tr>
|
||||
<td>cell0</td>
|
||||
<td>cell1</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table id="table4" border="1" role="log">
|
||||
<tr aria-live="polite" id="tr">
|
||||
<td>cell0</td>
|
||||
<td>cell1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cell2</td>
|
||||
<td>cell3</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user