fix(dart): don't instantiate abstract directive.

Directive is an abstract class, so it should not
be instantiated directly in tests.
This commit is contained in:
Martin Probst
2015-03-30 17:26:22 -07:00
parent 123ee8e06f
commit 136f64f4ac
3 changed files with 31 additions and 16 deletions
+7 -3
View File
@@ -1,21 +1,25 @@
import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/test_lib';
import {Directive, onChange} from 'angular2/src/core/annotations/annotations';
class DummyDirective extends Directive {
constructor({lifecycle = []} = {}) { super({lifecycle}); }
}
export function main() {
describe("Directive", () => {
describe("lifecycle", () => {
it("should be false when no lifecycle specified", () => {
var d = new Directive();
var d = new DummyDirective();
expect(d.hasLifecycleHook(onChange)).toBe(false);
});
it("should be false when the lifecycle does not contain the hook", () => {
var d = new Directive({lifecycle:[]});
var d = new DummyDirective({lifecycle:[]});
expect(d.hasLifecycleHook(onChange)).toBe(false);
});
it("should be true otherwise", () => {
var d = new Directive({lifecycle:[onChange]});
var d = new DummyDirective({lifecycle:[onChange]});
expect(d.hasLifecycleHook(onChange)).toBe(true);
});
});