dom/browser-element/mochitest/browserElement_ScrollEvent.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/browser-element/mochitest/browserElement_ScrollEvent.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +/* Any copyright is dedicated to the public domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Test that scroll event bubbles up.
     1.8 +"use strict";
     1.9 +
    1.10 +SimpleTest.waitForExplicitFinish();
    1.11 +browserElementTestHelpers.setEnabledPref(true);
    1.12 +browserElementTestHelpers.addPermission();
    1.13 +
    1.14 +function runTest() {
    1.15 +  var iframe = document.createElement('iframe');
    1.16 +  SpecialPowers.wrap(iframe).mozbrowser = true;
    1.17 +  document.body.appendChild(iframe);
    1.18 +
    1.19 +  iframe.addEventListener("mozbrowserscroll", function(e) {
    1.20 +    ok(true, "got mozbrowserscroll event.");
    1.21 +    ok(e.detail, "event.detail is not null.");
    1.22 +    ok(e.detail.top === 4000, "top position is correct.");
    1.23 +    ok(e.detail.left === 4000, "left position is correct.");
    1.24 +    SimpleTest.finish();
    1.25 +  });
    1.26 +
    1.27 +  iframe.src = "data:text/html,<html><body style='min-height: 5000px; min-width: 5000px;'></body><script>window.scrollTo(4000, 4000);</script></html>";
    1.28 +}
    1.29 +
    1.30 +addEventListener('testready', runTest);

mercurial