-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Renamed AotAware to LiComponent
- Loading branch information
Showing
4 changed files
with
55 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { Template, Spec } from "detest-bdd"; | ||
import { Spec } from "detest-bdd"; | ||
import { AotAware } from "../src/aot"; | ||
import { AngularLifecycleType } from "../src/lifecycle-event"; | ||
import { LiComponent } from "../src/component"; | ||
|
||
const spec = Spec.create<{ | ||
targetClass: AotAware | ||
}>(); | ||
const spec = Spec.create<{}>(); | ||
|
||
describe("Given an AotAware class", () => { | ||
|
||
Template.withInputs<{ methodName: AngularLifecycleType }>(["methodName"], (methodName: AngularLifecycleType) => { | ||
|
||
spec.beforeEach(params => { params.targetClass = new class extends AotAware {} }); | ||
|
||
spec.it(`should define a ${methodName} method`, (params) => { | ||
const angularFn = params.targetClass[methodName]; | ||
|
||
expect(() => angularFn()).not.toThrow(); | ||
|
||
expect(params.targetClass[methodName]).toEqual(jasmine.any(Function)); | ||
}); | ||
}, ...AngularLifecycleType.values.map(methodName => ({ methodName })))(); | ||
spec.it("it should equal LiComponent", () => { | ||
expect(AotAware).toBe(LiComponent) | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Template, Spec } from "detest-bdd"; | ||
import { LiComponent } from "../src/component"; | ||
import { AngularLifecycleType } from "../src/lifecycle-event"; | ||
|
||
const spec = Spec.create<{ | ||
targetClass: LiComponent | ||
}>(); | ||
|
||
describe("Given a LiComponent class", () => { | ||
|
||
spec.it("it should extend TemplateDynamic", () => { | ||
expect(Object.getPrototypeOf(LiComponent).name).toEqual("TemplateDynamic"); | ||
}); | ||
|
||
Template.withInputs<{ methodName: AngularLifecycleType }>(["methodName"], (methodName: AngularLifecycleType) => { | ||
|
||
spec.beforeEach(params => { params.targetClass = new class extends LiComponent {} }); | ||
|
||
spec.it(`should define a ${methodName} method`, (params) => { | ||
const angularFn = params.targetClass[methodName]; | ||
|
||
expect(() => angularFn()).not.toThrow(); | ||
|
||
expect(params.targetClass[methodName]).toEqual(jasmine.any(Function)); | ||
}); | ||
}, ...AngularLifecycleType.values.map(methodName => ({ methodName })))(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
// Enable dynamic templating in AoT compiled components | ||
export function AotDynamic(): new(...args: any[]) => { [K in keyof any]: any[K]; } { | ||
return class {}; | ||
} | ||
import { LiComponent } from "./component"; | ||
|
||
export class AotAware extends AotDynamic() { | ||
public ngOnChanges() { } | ||
public ngOnInit() { } | ||
public ngOnDestroy() { } | ||
public ngDoCheck() { } | ||
public ngAfterContentInit() { } | ||
public ngAfterContentChecked() { } | ||
public ngAfterViewInit() { } | ||
public ngAfterViewChecked() { } | ||
} | ||
/** | ||
* @deprecated | ||
* @see LiComponent | ||
*/ | ||
export const AotAware = LiComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters