feat(core): added support for detecting lifecycle events based on interfaces

This commit is contained in:
vsavkin
2015-05-27 08:08:14 -07:00
parent 2b6a653050
commit 30b6542fc8
12 changed files with 257 additions and 60 deletions
@@ -1,23 +0,0 @@
import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/test_lib';
import {Directive, onChange} from 'angular2/src/core/annotations_impl/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);
});
});
});
}