summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/treeupdate/test_recreation.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /accessible/tests/mochitest/treeupdate/test_recreation.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'accessible/tests/mochitest/treeupdate/test_recreation.html')
-rw-r--r--accessible/tests/mochitest/treeupdate/test_recreation.html155
1 files changed, 155 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/treeupdate/test_recreation.html b/accessible/tests/mochitest/treeupdate/test_recreation.html
new file mode 100644
index 000000000..7754eb703
--- /dev/null
+++ b/accessible/tests/mochitest/treeupdate/test_recreation.html
@@ -0,0 +1,155 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>Test accessible recreation</title>
+
+ <link rel="stylesheet" type="text/css"
+ href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+ <script type="application/javascript"
+ src="../common.js"></script>
+ <script type="application/javascript"
+ src="../role.js"></script>
+ <script type="application/javascript"
+ src="../events.js"></script>
+
+ <script type="application/javascript">
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Invokers
+
+ function recreateAccessible(aID, aWontBeAccessible)
+ {
+ this.node = getNode(aID);
+ this.accessible =
+ isAccessible(this.node) ? getAccessible(this.node) : null;
+
+ this.eventSeq = [ ];
+
+ if (this.accessible)
+ this.eventSeq.push(new invokerChecker(EVENT_HIDE,
+ this.accessible));
+
+ if (!aWontBeAccessible)
+ this.eventSeq.push(new invokerChecker(EVENT_SHOW, getAccessible,
+ this.node));
+
+ this.eventSeq.push(new invokerChecker(EVENT_REORDER,
+ getContainerAccessible(this.node)));
+
+ if (this.accessible) {
+ this.unexpectedEventSeq = [
+ new invokerChecker(EVENT_SHOW, this.accessible)
+ ];
+ }
+ }
+
+ function changeAttr(aID, aAttr, aValue)
+ {
+ this.__proto__ = new recreateAccessible(aID);
+
+ this.invoke = function changeAttr_invoke()
+ {
+ this.node.setAttribute(aAttr, aValue);
+ }
+
+ this.getID = function changeAttr_getID()
+ {
+ return "change " + aAttr + "attribute for " + aID;
+ }
+ }
+
+ function removeAttr(aID, aAttr)
+ {
+ this.__proto__ = new recreateAccessible(aID, true);
+
+ this.invoke = function remvoeAttr_invoke()
+ {
+ this.node.removeAttribute(aAttr);
+ }
+
+ this.getID = function remvoeAttr_getID()
+ {
+ return "remove " + aAttr + "attribute for " + aID;
+ }
+ }
+
+ function changeRole(aID, aHasAccessible)
+ {
+ this.__proto__ = new changeAttr(aID, "role", "button");
+ }
+
+ function removeRole(aID)
+ {
+ this.__proto__ = new removeAttr(aID, "role");
+ }
+
+ function changeHref(aID)
+ {
+ this.__proto__ = new changeAttr(aID, "href", "www");
+ }
+
+ function changeMultiselectable(aID)
+ {
+ this.__proto__ = new changeAttr(aID, "aria-multiselectable", "true");
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Test
+
+ //gA11yEventDumpID = "eventdump"; // debug stuff
+ //gA11yEventDumpToConsole = true;
+
+ var gQueue = null;
+
+ function doTest()
+ {
+ gQueue = new eventQueue();
+
+ // make the accessible an inaccessible
+ gQueue.push(new changeRole("span"));
+
+ // make the inaccessible an accessible
+ gQueue.push(new removeRole("span"));
+
+ // recreate an accessible by role change
+ gQueue.push(new changeRole("div1"));
+
+ // recreate an accessible by href change
+ gQueue.push(new changeHref("anchor"));
+
+ // recreate an accessible by aria-multiselectable change
+ gQueue.push(new changeMultiselectable("div3"));
+
+ gQueue.invoke(); // SimpleTest.finish() will be called in the end
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addA11yLoadEvent(doTest);
+ </script>
+</head>
+<body>
+
+ <a target="_blank"
+ title="Rework accessible tree update code"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=570275">
+ Mozilla Bug 570275
+ </a>
+
+ <p id="display"></p>
+ <div id="content" style="display: none"></div>
+ <pre id="test">
+ </pre>
+
+ <span id="span">span</span>
+ <div id="div1">div</div>
+ <a id="anchor">anchor</a>
+ <div id="div3" role="listbox">list</div>
+
+ <div id="eventdump"></div>
+</body>
+</html>