mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
In order to make the Dart Analyzer stop complaining about
Event not having a default constructor (and all Event subclasses
not having an explicit constructor, thus having an implicit one
which calls the default Event() constructor), I made all of
Event()'s parameters named and thus optional, but did not update
our one sky test which used Event().
The real fix is probably to make the autogenerator smart enough
to have FooEvent() call super("foo"), but I was lazy.
This at least fixes the tests (and greens the waterfall) for now.
TBR=abarth@chromium.org
BUG=
Review URL: https://codereview.chromium.org/988573002
36 lines
834 B
Plaintext
36 lines
834 B
Plaintext
<script>
|
|
import "../resources/third_party/unittest/unittest.dart";
|
|
import "../resources/unit.dart";
|
|
|
|
import "dart:sky";
|
|
|
|
class MyEvent extends Event {
|
|
MyEvent() : super(type: "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>
|