OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <link id="harness" rel="import" href="resources/import-events-target.html"> | 5 <link id="harness" rel="import" href="resources/import-events-target.html"> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 description("Test that events can be fired on imported documents."); | 9 description("Test that events can be fired on imported documents."); |
10 | 10 |
11 function handle(list, id, event) | 11 function handle(list, id, event) |
12 { | 12 { |
13 list.push(event.type + "@" + id); | 13 list.push(event.type + "@" + id); |
14 } | 14 } |
15 | 15 |
16 function testEventsFiredOn(doc) | 16 function testEventsFiredOn(doc) |
17 { | 17 { |
18 window.caughtFoo = []; | 18 window.caughtFoo = []; |
19 var root = doc.documentElement; | 19 var root = doc.documentElement; |
20 var target = doc.getElementById("target"); | 20 var target = doc.getElementById("target"); |
21 | 21 |
22 target.addEventListener("foo", handle.bind(null, caughtFoo, "target")); | 22 target.addEventListener("foo", handle.bind(null, caughtFoo, "target")); |
23 root.addEventListener("foo", handle.bind(null, caughtFoo, "root")); | 23 root.addEventListener("foo", handle.bind(null, caughtFoo, "root")); |
24 target.dispatchEvent(new CustomEvent("foo", { bubbles: true })); | 24 target.dispatchEvent(new CustomEvent("foo", { bubbles: true })); |
25 | 25 |
26 shouldBe("window.caughtFoo", "['foo@target', 'foo@root']"); | 26 shouldBe("window.caughtFoo", "['foo@target', 'foo@root']"); |
27 } | 27 } |
28 | 28 |
29 testEventsFiredOn(harness.import); | 29 testEventsFiredOn(harness.import); |
30 </script> | 30 </script> |
31 </body> | 31 </body> |
32 </html> | 32 </html> |
OLD | NEW |