refactor(directives): directives use declare that they listen to onChange in the annotations

This commit is contained in:
vsavkin
2015-02-06 13:19:47 -08:00
parent ee3f709fbf
commit 9240b09011
7 changed files with 91 additions and 27 deletions
@@ -0,0 +1,23 @@
import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/test_lib';
import {Directive, onChange} from 'angular2/src/core/annotations/annotations';
export function main() {
describe("Directive", () => {
describe("lifecycle", () => {
it("should be false when no lifecycle specified", () => {
var d = new Directive();
expect(d.hasLifecycleHook(onChange)).toBe(false);
});
it("should be false when the lifecycle does not contain the hook", () => {
var d = new Directive({lifecycle:[]});
expect(d.hasLifecycleHook(onChange)).toBe(false);
});
it("should be true otherwise", () => {
var d = new Directive({lifecycle:[onChange]});
expect(d.hasLifecycleHook(onChange)).toBe(true);
});
});
});
}