gecko-dev/layout/base/tests/test_scroll_event_ordering.html
Brian Grinstead ede8c44ef2 Bug 1544322 - Part 2.1 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in everything except for dom/ r=bzbarsky
This excludes dom/, otherwise the file size is too large for phabricator to handle.

This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 2` argument.

Differential Revision: https://phabricator.services.mozilla.com/D27456

--HG--
extra : moz-landing-system : lando
2019-04-16 03:50:44 +00:00

64 lines
1.7 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=785588
-->
<head>
<title>Test for Bug 785588 --- ordering of scroll-related events</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script 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=785588">Mozilla Bug 785588</a>
<div id="content">
<div id="d" style="border:2px solid black; width:100px; height:100px; overflow:auto">
<div id="inner" style="height:200px;">Hello</div>
</div>
</div>
<pre id="test">
<script>
SimpleTest.waitForExplicitFinish();
var smoothScrollPref = "general.smoothScroll";
var d = document.getElementById("d");
d.scrollTop = 0;
var inner = document.getElementById("inner");
var state = "initial";
function onFrame() {
is(state, "didOnScroll", "Must have got scroll event already");
state = "didOnFrame";
SimpleTest.finish();
}
function onScroll() {
is(state, "initial", "Must be in initial state");
ok(d.scrollTop > 0, "Must have scrolled by some amount (got " + d.scrollTop + ")");
state = "didOnScroll";
}
function doTest() {
window.getSelection().collapse(inner.firstChild, 0);
window.requestAnimationFrame(onFrame);
d.onscroll = onScroll;
sendKey("DOWN");
}
function prepareTest() {
// Start the test after we've gotten at least one rAF callback, to make sure
// that rAF is no longer throttled. (See bug 1145439.)
window.requestAnimationFrame(function() {
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, doTest);
});
}
SimpleTest.waitForFocus(prepareTest);
</script>
</pre>
</body>
</html>