dom/events/test/test_eventctors.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
     4 <!--
     5 https://bugzilla.mozilla.org/show_bug.cgi?id=675884
     6 -->
     7 <window title="Mozilla Bug 675884"
     8         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    11   <!-- test results are displayed in the html:body -->
    12   <body xmlns="http://www.w3.org/1999/xhtml">
    13   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=675884"
    14      target="_blank">Mozilla Bug 675884</a>
    15   </body>
    17   <!-- test code goes here -->
    18   <script type="application/javascript">
    19   <![CDATA[
    20   /** Test for Bug 675884 **/
    22   // Most of the tests are in .html file, but test here that
    23   // isTrusted is handled correctly in chrome.
    25   var receivedEvent;
    26   document.addEventListener("hello", function(e) { receivedEvent = e; }, true);
    28   // Event
    29   var e;
    30   var ex = false;
    31   try {
    32     e = new Event();
    33   } catch(exp) {
    34     ex = true;
    35   }
    36   ok(ex, "First parameter is required!");
    37   ex = false;
    39   e = new Event("hello");
    40   ok(e.type, "hello", "Wrong event type!");
    41   ok(e.isTrusted, "Event should be trusted!");
    42   ok(!e.bubbles, "Event shouldn't bubble!");
    43   ok(!e.cancelable, "Event shouldn't be cancelable!");
    44   document.dispatchEvent(e);
    45   is(receivedEvent, e, "Wrong event!");
    47   ]]>
    48   </script>
    49 </window>

mercurial