dom/events/test/test_eventctors.xul

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:486fa07baef0
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"/>
10
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>
16
17 <!-- test code goes here -->
18 <script type="application/javascript">
19 <![CDATA[
20 /** Test for Bug 675884 **/
21
22 // Most of the tests are in .html file, but test here that
23 // isTrusted is handled correctly in chrome.
24
25 var receivedEvent;
26 document.addEventListener("hello", function(e) { receivedEvent = e; }, true);
27
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;
38
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!");
46
47 ]]>
48 </script>
49 </window>

mercurial