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/tests/mochitest/general/test_spacetopagedown.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 'dom/tests/mochitest/general/test_spacetopagedown.html')
-rw-r--r-- | dom/tests/mochitest/general/test_spacetopagedown.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/dom/tests/mochitest/general/test_spacetopagedown.html b/dom/tests/mochitest/general/test_spacetopagedown.html new file mode 100644 index 000000000..03f840f3d --- /dev/null +++ b/dom/tests/mochitest/general/test_spacetopagedown.html @@ -0,0 +1,76 @@ +<html> +<head> + <meta charset="utf-8"> + <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> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> + <script type="application/javascript;version=1.7"> + +SimpleTest.waitForExplicitFinish(); + +Components.utils.import("resource://gre/modules/Task.jsm"); + +var windowUtils = SpecialPowers.getDOMWindowUtils(window); + +function pressKey(isShift) +{ + return new Promise(resolve => { + synthesizeKey(" ", { shiftKey: isShift }); + windowUtils.advanceTimeAndRefresh(100); + SimpleTest.executeSoon(resolve); + }); +} + +function initTest() +{ + SpecialPowers.pushPrefEnv({"set":[["general.smoothScroll", false]]}, runTest); +} + +function runTest() +{ + Task.async(function () { + yield pressKey(false); + + ok(window.scrollY > 0, "Space with no focus" + window.scrollY); + yield pressKey(true); + is(window.scrollY, 0, "Shift+Space with no focus"); + + let checkbox = document.getElementById("checkbox"); + checkbox.focus(); + yield pressKey(false); + + is(window.scrollY, 0, "Space with checkbox focused"); + ok(checkbox.checked, "Space with checkbox focused, checked"); + yield pressKey(true); + is(window.scrollY, 0, "Shift+Space with checkbox focused"); + ok(!checkbox.checked, "Space with checkbox focused, unchecked"); + + let input = document.getElementById("input"); + input.focus(); + yield pressKey(false); + is(window.scrollY, 0, "Space with input focused"); + is(input.value, " ", "Space with input focused, value"); + yield pressKey(true); + is(window.scrollY, 0, "Shift+Space with input focused"); + is(input.value, " ", "Space with input focused, value"); + + windowUtils.restoreNormalRefresh(); + SimpleTest.finish(); + })(); +} + + </script> +</head> +<body onload="SimpleTest.waitForFocus(initTest)"> + +<input id="checkbox" type="checkbox">Checkbox +<input id="input"> +<p style="height: 4000px">Text</p> + +<p id="display"></p> +<div id="content" style="display: none"> +</div> +<pre id="test"> +</pre> +</body> +</html> |