dom/events/test/test_bug502818.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/test/test_bug502818.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=502818
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 502818</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=502818">Mozilla Bug 502818</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 502818 **/
    1.24 +
    1.25 +  var count = 0;
    1.26 +
    1.27 +  function listener(evt) {
    1.28 +    ++count;
    1.29 +    is(evt.foo, 'bar', "Event.prototype should be accessible from " + evt.type);
    1.30 +  }
    1.31 +
    1.32 +  Event.prototype.foo = 'bar';
    1.33 +  window.addEventListener('DOMMouseScroll', listener, false);
    1.34 +  window.addEventListener('MozMousePixelScroll', listener, false);
    1.35 +  window.addEventListener('foobar', listener, false);
    1.36 +
    1.37 +  var e = document.createEvent("mousescrollevents");
    1.38 +  e.initMouseScrollEvent("DOMMouseScroll", true, true, window,
    1.39 +                         0, 0, 0, 0, 0, false, false, false, false,
    1.40 +                         0, null, 1);
    1.41 +  window.dispatchEvent(e);
    1.42 +
    1.43 +  e.initMouseScrollEvent("MozMousePixelScroll", true, true, window,
    1.44 +                         0, 0, 0, 0, 0, false, false, false, false,
    1.45 +                         0, null, 1);
    1.46 +  window.dispatchEvent(e);
    1.47 +
    1.48 +  e.initMouseScrollEvent("foobar", true, true, window,
    1.49 +                         0, 0, 0, 0, 0, false, false, false, false,
    1.50 +                         0, null, 1);
    1.51 +  window.dispatchEvent(e);
    1.52 +
    1.53 +  is(count, 3, "Wrong number tests run!");
    1.54 +</script>
    1.55 +</pre>
    1.56 +</body>
    1.57 +</html>

mercurial