summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/states/test_link.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/states/test_link.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/states/test_link.html')
-rw-r--r--accessible/tests/mochitest/states/test_link.html144
1 files changed, 144 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/states/test_link.html b/accessible/tests/mochitest/states/test_link.html
new file mode 100644
index 000000000..3f89f9f7f
--- /dev/null
+++ b/accessible/tests/mochitest/states/test_link.html
@@ -0,0 +1,144 @@
+<html>
+
+<head>
+ <title>HTML link states testing</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="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+ <script type="application/javascript"
+ src="../common.js"></script>
+ <script type="application/javascript"
+ src="../role.js"></script>
+ <script type="application/javascript"
+ src="../states.js"></script>
+ <script type="application/javascript"
+ src="../events.js"></script>
+
+ <script type="application/javascript">
+ //gA11yEventDumpToConsole = true; // debug stuff
+
+ var gLinkWindow = null;
+ function closeDocChecker()
+ {
+ this.__proto__ = new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE);
+
+ this.check = function closeDocChecker_check(aEvent)
+ {
+ gLinkWindow = aEvent.accessible.rootDocument.window;
+ }
+
+ this.match = function closeDocChecker_match(aEvent)
+ {
+ // A temporary about:blank document gets loaded before 'example.com'
+ // document.
+ return aEvent.DOMNode.URL == "http://www.example.com/";
+ }
+ }
+
+ function clickLink(aID)
+ {
+ this.eventSeq = [
+ new stateChangeChecker(STATE_TRAVERSED, false, true, "link_traversed"),
+ new closeDocChecker()
+ ];
+
+ this.invoke = function clickLink_invoke()
+ {
+ synthesizeMouse(getNode("link_traversed"), 1, 1, { shiftKey: true });
+ }
+
+ this.getID = function clickLink_getID()
+ {
+ return "link + '" + aID + "' clicked.";
+ }
+ }
+
+ var gQueue = null;
+ function doTest()
+ {
+ // a@href and its text node
+ testStates("link_href", STATE_LINKED);
+ testStates(getAccessible("link_href").firstChild, STATE_LINKED);
+
+ // a@onclick
+ testStates("link_click", STATE_LINKED);
+
+ // a@onmousedown
+ testStates("link_mousedown", STATE_LINKED);
+
+ // a@onmouseup
+ testStates("link_mouseup", STATE_LINKED);
+
+ // a@role="link"
+ testStates("link_arialink", STATE_LINKED);
+
+ // a@role="button"
+ testStates("link_ariabutton", 0, 0, STATE_LINKED);
+
+ // a (no @href, no click event listener)
+ testStates("link_notlink", 0, 0, STATE_LINKED);
+
+ // a: no traversed state
+ testStates("link_traversed", 0, 0, STATE_TRAVERSED);
+
+ // a: traversed state
+ //enableLogging("docload"); // debug stuff
+
+ gQueue = new eventQueue();
+ gQueue.push(new clickLink("link_traversed"));
+ gQueue.onFinish =
+ function()
+ {
+ gLinkWindow.close();
+ //disableLogging(); // debug stuff
+ }
+
+ gQueue.invoke(); // will call SimpleTest.finsih();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addA11yLoadEvent(doTest);
+ </script>
+
+</head>
+
+<body>
+
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409"
+ title="Expose click action if mouseup and mousedown are registered">
+ Mozilla Bug 423409
+ </a>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=754830"
+ title="Calculate link states separately">
+ Mozilla Bug 754830
+ </a>
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=757774"
+ title="Fire state change event when link is traversed">
+ Mozilla Bug 757774
+ </a>
+ <p id="display"></p>
+ <div id="content" style="display: none"></div>
+ <pre id="test">
+ </pre>
+
+ <a id="link_href" href="http://mozilla.org">link</a>
+ <a id="link_click" onclick="">link</a>
+ <a id="link_mousedown" onmousedown="">link</a>
+ <a id="link_mouseup" onmouseup="">link</a>
+ <a id="link_arialink" role="link">aria link</a>
+ <a id="link_ariabutton" role="button">aria button</a>
+ <a id="link_notlink">not link</a>
+
+ <a id="link_traversed" href="http://www.example.com" target="_top">example.com</a>
+
+</body>
+</html>