diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/svg/test/test_a_href_01.xhtml | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'dom/svg/test/test_a_href_01.xhtml')
-rw-r--r-- | dom/svg/test/test_a_href_01.xhtml | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/dom/svg/test/test_a_href_01.xhtml b/dom/svg/test/test_a_href_01.xhtml new file mode 100644 index 000000000..908633889 --- /dev/null +++ b/dom/svg/test/test_a_href_01.xhtml @@ -0,0 +1,96 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=620295 +https://bugzilla.mozilla.org/show_bug.cgi?id=1245751 +--> +<head> + <title>Test that activating SVG 'a' elements navigate to their xlink:href or href</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=620295">Mozilla Bug 620295</a> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1245751">Mozilla Bug 1245751</a> +<p id="display"></p> +<pre id="test"> +<script class="testbody" type="text/javascript"><![CDATA[ + +SimpleTest.waitForExplicitFinish(); + +var testCount = 7; +var didWindowLoad = false; +var frameLoadCount = 0; +var navigationCount = 0; + +function endsWith(s1, s2) { + s1 = String(s1); + return s1.length >= s2.length && s1.substring(s1.length - s2.length) == s2; +} + +function windowLoaded() { + didWindowLoad = true; + doNavigationIfReady(); +} + +function frameLoaded() { + frameLoadCount++; + doNavigationIfReady(); +} + +function doNavigationIfReady() { + if (didWindowLoad && frameLoadCount == testCount) { + doNavigation(); + } +} + +function doNavigation() { + // Test clicking on an unmodified <a>. + doNavigationTest(1, "a_href_helper_01.svg"); + // Test clicking on an <a> whose xlink:href is modified by assigning to href.baseVal. + doNavigationTest(2, "a_href_helper_02_03.svg", function(a) { a.href.baseVal = "a_href_destination.svg"; }); + // Test clicking on an <a> whose xlink:href is modified by a setAttributeNS call. + doNavigationTest(3, "a_href_helper_02_03.svg", function(a) { a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "a_href_destination.svg"); }); + // Test clicking on an <a> whose xlink:href is modified by animation. + doNavigationTest(4, "a_href_helper_04.svg"); + // Test clicking on an unmodified <a> with both href and xlink:href. + doNavigationTest(5, "a_href_helper_05.svg"); + // Test clicking on an <a> whose href is modified by a setAttribute call. + doNavigationTest(6, "a_href_helper_06.svg", function(a) { a.setAttribute("href", "a_href_destination.svg"); }); + // Test clicking on an <a> whose href is modified by animation. + doNavigationTest(7, "a_href_helper_07.svg"); +} + +function doNavigationTest(testNumber, initialHref, f) { + var iframe = document.getElementById("iframe" + testNumber); + var a = iframe.contentDocument.getElementById("a"); + ok(endsWith(iframe.contentWindow.location, initialHref), "Initial href of test " + testNumber); + is("pointer", window.getComputedStyle(a).getPropertyValue("cursor"), "expected pointer cursor"); + iframe.onload = function() { + ok(endsWith(iframe.contentWindow.location, "a_href_destination.svg"), "Final href of test " + testNumber); + if (++navigationCount == testCount) { + SimpleTest.finish(); + } + }; + if (f) { + f(a); + } + sendMouseEvent({type:'click'}, a); +} + +window.onload = windowLoaded; + +]]></script> +</pre> +<div id="content" style="visibility: hidden"> +<!-- These must come after frameLoaded is defined --> +<iframe id="iframe1" src="a_href_helper_01.svg" onload="frameLoaded()"></iframe> +<iframe id="iframe2" src="a_href_helper_02_03.svg" onload="frameLoaded()"></iframe> +<iframe id="iframe3" src="a_href_helper_02_03.svg" onload="frameLoaded()"></iframe> +<iframe id="iframe4" src="a_href_helper_04.svg" onload="frameLoaded()"></iframe> +<iframe id="iframe5" src="a_href_helper_05.svg" onload="frameLoaded()"></iframe> +<iframe id="iframe6" src="a_href_helper_06.svg" onload="frameLoaded()"></iframe> +<iframe id="iframe7" src="a_href_helper_07.svg" onload="frameLoaded()"></iframe> +</div> +</body> +</html> |