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

Side by Side Diff: sky/tests/events/custom-event.sky

Issue 938003004: Make it possible to create reasonable subclasses of Event (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « sky/engine/core/events/Event.idl ('k') | sky/tests/events/custom-event-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <script>
2 import "../resources/third_party/unittest/unittest.dart";
3 import "../resources/unit.dart";
4
5 import "dart:sky";
6
7 class MyEvent extends Event {
8 MyEvent() : super("awesome", bubbles: true);
9
10 bool get isCustom => true;
11 }
12
13 void main() {
14 initUnit();
15
16 test("should be able to dispatch", () {
17 var event = new MyEvent();
18 expect(event.isCustom, isTrue);
19 expect(event.type, equals("awesome"));
20 expect(event.bubbles, isTrue);
21 expect(event.cancelable, isFalse);
22 expect(event.isCustom, isTrue);
23
24 bool gotEvent = false;
25 var element = document.createElement("div");
26 element.addEventListener("awesome", (e) {
27 expect(e, equals(event));
28 expect(event.isCustom, isTrue);
29 gotEvent = true;
30 });
31 element.dispatchEvent(event);
32 expect(gotEvent, isTrue);
33 });
34 }
35 </script>
OLDNEW
« no previous file with comments | « sky/engine/core/events/Event.idl ('k') | sky/tests/events/custom-event-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698