Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<html>
<head>
<title>Accessible mutation events testing</title>
<link rel="stylesheet" type="text/css"
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../promisified-events.js"></script>
<script type="application/javascript">
function textChangeMatcher(aID, aText, aIsInserted) {
return e => {
if (!(e instanceof nsIAccessibleTextChangeEvent)) {
return false;
}
return (
e.accessible === getAccessible(aID) &&
e.modifiedText === aText &&
e.isInserted === aIsInserted
);
};
}
// //////////////////////////////////////////////////////////////////////////
// Do tests
// gA11yEventDumpToConsole = true; // debugging
async function doTests() {
let removed1 = waitForEvent(EVENT_TEXT_REMOVED,
textChangeMatcher("div1", "hello", false));
let removed2 = waitForEvent(EVENT_TEXT_REMOVED,
textChangeMatcher("div2", "world", false));
let inserted1 = waitForEvent(EVENT_TEXT_INSERTED,
textChangeMatcher("div1", "a", true));
let inserted2 = waitForEvent(EVENT_TEXT_INSERTED,
textChangeMatcher("div2", "b", true));
getNode("div1").textContent = "a";
getNode("div2").textContent = "b";
await Promise.all([removed1, removed2, inserted1, inserted2]);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
</head>
<body>
<a target="_blank"
title="missing text change events when multiple elements updated at once">
Mozilla Bug 1322593
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="div1">hello</div>
<div id="div2">world</div>
</body>
</html>