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 /editor/libeditor/tests/test_bug915962.html | |
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 'editor/libeditor/tests/test_bug915962.html')
-rw-r--r-- | editor/libeditor/tests/test_bug915962.html | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_bug915962.html b/editor/libeditor/tests/test_bug915962.html new file mode 100644 index 000000000..32968b310 --- /dev/null +++ b/editor/libeditor/tests/test_bug915962.html @@ -0,0 +1,100 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=915962 +--> +<head> + <title>Test for Bug 915962</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915962">Mozilla Bug 915962</a> +<p id="display"></p> +<div id="content"> +</div> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 915962 **/ + +var smoothScrollPref = "general.smoothScroll"; +SimpleTest.waitForExplicitFinish(); +var win = window.open("file_bug915962.html", "_blank", + "width=600,height=600,scrollbars=yes"); + +// grab the timer right at the start +var cwu = SpecialPowers.getDOMWindowUtils(win); +function step() { + cwu.advanceTimeAndRefresh(100); +} +SimpleTest.waitForFocus(function() { + SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest); +}, win); +function startTest() { + // Make sure that pressing Space when a tabindex=-1 element is focused + // will scroll the page. + var button = win.document.querySelector("button"); + var sc = win.document.querySelector("div"); + sc.focus(); + is(win.scrollY, 0, "Sanity check"); + synthesizeKey(" ", {}, win); + + step(); + + isnot(win.scrollY, 0, "Page is scrolled down"); + var oldY = win.scrollY; + synthesizeKey(" ", {shiftKey: true}, win); + + step(); + + ok(win.scrollY < oldY, "Page is scrolled up"); + + // Make sure that pressing Space when a tabindex=-1 element is focused + // will not scroll the page, and will activate the element. + button.focus(); + var clicked = false; + button.onclick = () => clicked = true; + oldY = win.scrollY; + synthesizeKey(" ", {}, win); + + step(); + + ok(win.scrollY <= oldY, "Page is not scrolled down"); + ok(clicked, "The button should be clicked"); + synthesizeKey("VK_TAB", {}, win); + + step(); + + oldY = win.scrollY; + synthesizeKey(" ", {}, win); + + step() + + ok(win.scrollY >= oldY, "Page is scrolled down"); + + win.close(); + cwu.restoreNormalRefresh(); + + win = window.open("file_bug915962.html", "_blank", + "width=600,height=600,scrollbars=yes"); + cwu = SpecialPowers.getDOMWindowUtils(win); + SimpleTest.waitForFocus(function() { + is(win.scrollY, 0, "Sanity check"); + synthesizeKey(" ", {}, win); + + step(); + + isnot(win.scrollY, 0, "Page is scrolled down without crashing"); + + win.close(); + cwu.restoreNormalRefresh(); + + SimpleTest.finish(); + }, win); +} +</script> +</pre> +</body> +</html> |