Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Window/script-tests/dispatchEvent.js

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 description("Test window.dispatchEvent().");
2
3 // Test that non-events throw
4 var event = {};
5 shouldThrow("window.dispatchEvent(event)");
6
7 // Test that non-initialized events throw
8 event = document.createEvent("Event");
9 shouldThrow("window.dispatchEvent(event)");
10
11 // Test basic dispatch
12 var myEventDispatched = false;
13 var target;
14 var currentTarget;
15 window.addEventListener("myEvent", function(evt) {
16 myEventDispatched = true;
17 target = evt.target;
18 currentTarget = evt.currentTarget;
19 }, false);
20 event = document.createEvent("Event");
21 event.initEvent("myEvent", false, false);
22 window.dispatchEvent(event);
23 shouldBeTrue("myEventDispatched");
24 shouldBe("target", "window");
25 shouldBe("currentTarget", "window");
26
27 // Test that both useCapture and non-useCapture listeners are dispatched to
28 var useCaptureDispatched = false;
29 window.addEventListener("myEvent", function(evt) {
30 useCaptureDispatched = true;
31 }, true);
32 var nonUseCaptureDispatched = false;
33 window.addEventListener("myEvent", function(evt) {
34 nonUseCaptureDispatched = true;
35 }, false);
36 event = document.createEvent("Event");
37 event.initEvent("myEvent", false, false);
38 window.dispatchEvent(event);
39 shouldBeTrue("useCaptureDispatched");
40 shouldBeTrue("nonUseCaptureDispatched");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698