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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/events/custom-event.sky
diff --git a/sky/tests/events/custom-event.sky b/sky/tests/events/custom-event.sky
new file mode 100644
index 0000000000000000000000000000000000000000..4a86eb2831aa5fd0733fe1ebbf607b16f9686d90
--- /dev/null
+++ b/sky/tests/events/custom-event.sky
@@ -0,0 +1,35 @@
+<script>
+import "../resources/third_party/unittest/unittest.dart";
+import "../resources/unit.dart";
+
+import "dart:sky";
+
+class MyEvent extends Event {
+ MyEvent() : super("awesome", bubbles: true);
+
+ bool get isCustom => true;
+}
+
+void main() {
+ initUnit();
+
+ test("should be able to dispatch", () {
+ var event = new MyEvent();
+ expect(event.isCustom, isTrue);
+ expect(event.type, equals("awesome"));
+ expect(event.bubbles, isTrue);
+ expect(event.cancelable, isFalse);
+ expect(event.isCustom, isTrue);
+
+ bool gotEvent = false;
+ var element = document.createElement("div");
+ element.addEventListener("awesome", (e) {
+ expect(e, equals(event));
+ expect(event.isCustom, isTrue);
+ gotEvent = true;
+ });
+ element.dispatchEvent(event);
+ expect(gotEvent, isTrue);
+ });
+}
+</script>
« 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