diff --git a/modules/angular2/test/core/annotations/annotations_spec.js b/modules/angular2/test/core/annotations/annotations_spec.js index 67f97f080f..9745958ac5 100644 --- a/modules/angular2/test/core/annotations/annotations_spec.js +++ b/modules/angular2/test/core/annotations/annotations_spec.js @@ -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); }); }); diff --git a/modules/angular2/test/core/compiler/element_injector_spec.js b/modules/angular2/test/core/compiler/element_injector_spec.js index cdddd1e8b6..9187a5ff33 100644 --- a/modules/angular2/test/core/compiler/element_injector_spec.js +++ b/modules/angular2/test/core/compiler/element_injector_spec.js @@ -14,6 +14,8 @@ import {LightDom, DestinationLightDom} from 'angular2/src/core/compiler/shadow_d import {Directive} from 'angular2/src/core/annotations/annotations'; import {BindingPropagationConfig} from 'angular2/change_detection'; +class DummyDirective extends Directive { constructor({lifecycle}) { super({lifecycle}); } } + @proxy @IMPLEMENTS(View) class DummyView extends SpyObject {noSuchMethod(m){super.noSuchMethod(m)}} @@ -445,10 +447,10 @@ export function main() { '(A_Needs_B -> B_Needs_A -> A_Needs_B)'); }); - it("should call onDestroy on directives subscribed to this event", function () { - var inj = injector([ - DirectiveBinding.createFromType(DirectiveWithDestroy, new Directive({lifecycle: [onDestroy]})) - ]); + it("should call onDestroy on directives subscribed to this event", function() { + var inj = injector([DirectiveBinding.createFromType( + DirectiveWithDestroy, + new DummyDirective({lifecycle: [onDestroy]}))]); var destroy = inj.get(DirectiveWithDestroy); inj.clearDirectives(); expect(destroy.onDestroyCounter).toBe(1); @@ -484,7 +486,7 @@ export function main() { expect(inj.get(BindingPropagationConfig)).toEqual(config); }); }); - + describe("createPrivateComponent", () => { it("should create a private component", () => { var inj = injector([]); @@ -524,7 +526,9 @@ export function main() { it("should support rehydrating the private component", () => { var inj = injector([]); - inj.createPrivateComponent(DirectiveWithDestroy, new Directive({lifecycle: [onDestroy]})); + inj.createPrivateComponent( + DirectiveWithDestroy, + new DummyDirective({lifecycle: [onDestroy]})); var dir = inj.getPrivateComponent(); inj.clearDirectives(); @@ -537,7 +541,7 @@ export function main() { expect(inj.getPrivateComponent()).not.toBe(null); }); }); - + describe('event emitters', () => { it('should be injectable and callable', () => { var called = false; diff --git a/modules/angular2/test/core/compiler/view_spec.js b/modules/angular2/test/core/compiler/view_spec.js index 7d6b4e6cac..7701d87f15 100644 --- a/modules/angular2/test/core/compiler/view_spec.js +++ b/modules/angular2/test/core/compiler/view_spec.js @@ -17,6 +17,10 @@ import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone'; import {EventManager, DomEventsPlugin} from 'angular2/src/core/events/event_manager'; import {reflector} from 'angular2/src/reflection/reflection'; +class DummyDirective extends Directive { + constructor({lifecycle = []}) { super({lifecycle}); } +} + @proxy @IMPLEMENTS(ViewContainer) class FakeViewContainer { @@ -351,7 +355,7 @@ export function main() { el('