Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
<!DOCTYPE html>
<html>
<head>
<title>Test accessible recreation</title>
<link rel="stylesheet" type="text/css"
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../promisified-events.js"></script>
<script type="application/javascript">
async function doTest() {
let events, msg;
msg = "Assign a 'button' role to a span";
events = waitForOrderedEvents(
[[EVENT_HIDE], [EVENT_SHOW, "span"], [EVENT_REORDER, "container"]], msg);
document.getElementById("span").setAttribute("role", "button");
await events;
msg = "Remove the 'button' role from a span";
events = waitForOrderedEvents(
[[EVENT_HIDE, "span"], [EVENT_SHOW], [EVENT_REORDER, "container"]], msg);
document.getElementById("span").removeAttribute("role");
await events;
msg = "Assign a 'button' role to a div";
events = waitForOrderedEvents(
[[EVENT_HIDE, "div1"], [EVENT_SHOW, "div1"], [EVENT_REORDER, "container"]], msg);
document.getElementById("div1").setAttribute("role", "button");
await events;
msg = "Change a password field to a text field";
events = waitForOrderedEvents(
[[EVENT_HIDE, "password"], [EVENT_SHOW, "password"], [EVENT_REORDER, "container"]], msg);
document.getElementById("password").setAttribute("type", "text");
await events;
msg = "Change a text field to a password field";
events = waitForOrderedEvents(
[[EVENT_HIDE, "text"], [EVENT_SHOW, "text"], [EVENT_REORDER, "container"]], msg);
document.getElementById("text").setAttribute("type", "password");
await events;
msg = "Add aria-label to a span";
ok(!isAccessible("span2"), "span2 has no accessible");
events = waitForOrderedEvents(
[[EVENT_SHOW, "span2"], [EVENT_REORDER, "container"]], msg);
document.getElementById("span2").setAttribute("aria-label", "label");
await events;
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Rework accessible tree update code"
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="container">
<span id="span">span</span>
<div id="div1">div</div>
<a id="anchor">anchor</a>
<div id="div3" role="listbox">list</div>
<input type="password" id="password"/>
<input type="text" id="text"/>
<span id="span2"></span>
</div>
<div id="eventdump"></div>
</body>
</html>