refactor: add types (#9116)
This commit is contained in:
committed by
Miško Hevery
parent
b60eecfc47
commit
7ce0fc7d47
@@ -89,7 +89,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should return a promise with rejected errors even if the exceptionHandler is not rethrowing',
|
||||
inject([AsyncTestCompleter, Injector], (async: any /** TODO #9100 */, injector: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter, Injector], (async: AsyncTestCompleter, injector: Injector) => {
|
||||
var ref = createApplication([]);
|
||||
var promise = ref.run(() => PromiseWrapper.reject('Test', null));
|
||||
PromiseWrapper.catchError(promise, (e) => {
|
||||
@@ -102,7 +102,7 @@ export function main() {
|
||||
|
||||
describe("coreLoadAndBootstrap", () => {
|
||||
it("should wait for asynchronous app initializers",
|
||||
inject([AsyncTestCompleter, Injector], (async: any /** TODO #9100 */, injector: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter, Injector], (async: AsyncTestCompleter, injector: Injector) => {
|
||||
let completer: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
var initializerDone = false;
|
||||
TimerWrapper.setTimeout(() => {
|
||||
@@ -121,7 +121,7 @@ export function main() {
|
||||
|
||||
describe("coreBootstrap", () => {
|
||||
it("should throw if an APP_INITIIALIZER is not yet resolved",
|
||||
inject([Injector], (injector: any /** TODO #9100 */) => {
|
||||
inject([Injector], (injector: Injector) => {
|
||||
var app = createApplication([
|
||||
{provide: APP_INITIALIZER, useValue: () => PromiseWrapper.completer().promise, multi: true}
|
||||
]);
|
||||
|
||||
@@ -39,7 +39,7 @@ class MessageDir {
|
||||
|
||||
constructor(logger: Logger) { this.logger = logger; }
|
||||
|
||||
set message(newMessage: any /** TODO #9100 */) { this.logger.add(newMessage); }
|
||||
set message(newMessage: string) { this.logger.add(newMessage); }
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -193,7 +193,7 @@ class TestApp {
|
||||
export function main() {
|
||||
describe('debug element', function() {
|
||||
it('should list all child nodes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -205,7 +205,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list all component child elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
@@ -239,7 +239,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list conditional component child elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ConditionalParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -265,7 +265,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list child elements within viewports',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(UsingFor).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -282,7 +282,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list element attributes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(TestApp).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
var bankElem = fixture.debugElement.children[0];
|
||||
@@ -294,7 +294,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list element classes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(TestApp).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
var bankElem = fixture.debugElement.children[0];
|
||||
@@ -306,7 +306,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list element styles',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(TestApp).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
var bankElem = fixture.debugElement.children[0];
|
||||
@@ -318,7 +318,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should query child elements by css',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -334,7 +334,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should query child elements by directive',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -352,7 +352,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list providerTokens',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
@@ -365,7 +365,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list locals',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(LocalsComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -377,7 +377,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should allow injecting from the element injector',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
@@ -391,7 +391,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list event listeners',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(EventsComp)
|
||||
.then((fixture) => {
|
||||
@@ -406,7 +406,7 @@ export function main() {
|
||||
|
||||
|
||||
it('should trigger event handlers',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(EventsComp)
|
||||
.then((fixture) => {
|
||||
|
||||
@@ -290,7 +290,7 @@ export function main() {
|
||||
|
||||
it('should support overriding factory dependencies', () => {
|
||||
var injector = createInjector(
|
||||
[Engine, {provide: Car, useFactory: (e: any /** TODO #9100 */) => new SportsCar(e), deps: [Engine]}]);
|
||||
[Engine, {provide: Car, useFactory: (e: Engine) => new SportsCar(e), deps: [Engine]}]);
|
||||
|
||||
var car = injector.get(Car);
|
||||
expect(car).toBeAnInstanceOf(SportsCar);
|
||||
@@ -483,7 +483,7 @@ export function main() {
|
||||
it("should return a dependency from self", () => {
|
||||
var inj = ReflectiveInjector.resolveAndCreate([
|
||||
Engine,
|
||||
{provide: Car, useFactory: (e: any /** TODO #9100 */) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
{provide: Car, useFactory: (e: Engine) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
]);
|
||||
|
||||
expect(inj.get(Car)).toBeAnInstanceOf(Car);
|
||||
@@ -492,7 +492,7 @@ export function main() {
|
||||
it("should throw when not requested provider on self", () => {
|
||||
var parent = ReflectiveInjector.resolveAndCreate([Engine]);
|
||||
var child = parent.resolveAndCreateChild([
|
||||
{provide: Car, useFactory: (e: any /** TODO #9100 */) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
{provide: Car, useFactory: (e: Engine) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
]);
|
||||
|
||||
expect(() => child.get(Car))
|
||||
@@ -505,7 +505,7 @@ export function main() {
|
||||
var parent = ReflectiveInjector.resolveAndCreate([Engine]);
|
||||
var child = parent.resolveAndCreateChild([
|
||||
{provide: Engine, useClass: TurboEngine},
|
||||
{provide: Car, useFactory: (e: any /** TODO #9100 */) => new Car(e), deps: [Engine]}
|
||||
{provide: Car, useFactory: (e: Engine) => new Car(e), deps: [Engine]}
|
||||
]);
|
||||
|
||||
expect(child.get(Car).engine).toBeAnInstanceOf(TurboEngine);
|
||||
|
||||
@@ -29,7 +29,7 @@ export function main() {
|
||||
|
||||
it('should invoke lifecycle methods ngOnChanges > ngOnInit > ngDoCheck > ngAfterContentChecked',
|
||||
inject([TestComponentBuilder, Log, AsyncTestCompleter], (tcb: TestComponentBuilder, log: Log,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp5,
|
||||
new ViewMetadata(
|
||||
|
||||
@@ -16,7 +16,7 @@ export function main() {
|
||||
describe("Observable", () => {
|
||||
describe("#core", () => {
|
||||
|
||||
it("should call next with values", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it("should call next with values", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
|
||||
let o = new Observable((sink: any /** TODO #9100 */) => { sink.next(1); });
|
||||
|
||||
@@ -27,7 +27,7 @@ export function main() {
|
||||
|
||||
}));
|
||||
|
||||
it("should call next and then complete", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it("should call next and then complete", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
|
||||
let o = new Observable((sink: any /** TODO #9100 */) => {
|
||||
sink.next(1);
|
||||
@@ -42,7 +42,7 @@ export function main() {
|
||||
|
||||
}));
|
||||
|
||||
it("should call error with errors", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it("should call error with errors", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
|
||||
let o = new Observable((sink: any /** TODO #9100 */) => { sink.error('oh noes!'); });
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import {asNativeElements} from '@angular/core';
|
||||
export function main() {
|
||||
describe("forwardRef integration", function() {
|
||||
it('should instantiate components which are declared using forwardRef',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(App).then((tc) => {
|
||||
tc.detectChanges();
|
||||
expect(asNativeElements(tc.debugElement.children)).toHaveText('frame(lock)');
|
||||
|
||||
@@ -19,16 +19,11 @@ import {
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
|
||||
import {
|
||||
isPresent,
|
||||
isBlank,
|
||||
isNumber,
|
||||
isJsObject,
|
||||
FunctionWrapper,
|
||||
NumberWrapper,
|
||||
normalizeBool
|
||||
} from '../../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {MapWrapper, StringMapWrapper} from '../../src/facade/collection';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
import {
|
||||
@@ -130,7 +125,7 @@ export function main() {
|
||||
]);
|
||||
|
||||
beforeEach(inject([TestComponentBuilder, ElementSchemaRegistry, RenderLog, DirectiveLog],
|
||||
(_tcb: any /** TODO #9100 */, _elSchema: any /** TODO #9100 */, _renderLog: any /** TODO #9100 */, _directiveLog: any /** TODO #9100 */) => {
|
||||
(_tcb: TestComponentBuilder, _elSchema: MockSchemaRegistry, _renderLog: RenderLog, _directiveLog: DirectiveLog) => {
|
||||
tcb = _tcb;
|
||||
elSchema = _elSchema;
|
||||
renderLog = _renderLog;
|
||||
|
||||
@@ -28,7 +28,7 @@ export function main() {
|
||||
describe("loading next to a location", () => {
|
||||
it('should work',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoaded,
|
||||
@@ -44,7 +44,7 @@ export function main() {
|
||||
it('should return a disposable component ref',
|
||||
inject(
|
||||
[DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoaded, tc.componentInstance.viewContainerRef)
|
||||
@@ -67,7 +67,7 @@ export function main() {
|
||||
|
||||
it('should update host properties',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
|
||||
@@ -90,7 +90,7 @@ export function main() {
|
||||
|
||||
it('should leave the view tree in a consistent state if hydration fails',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc: ComponentFixture<any>) => {
|
||||
tc.detectChanges();
|
||||
PromiseWrapper.catchError(
|
||||
@@ -107,7 +107,7 @@ export function main() {
|
||||
|
||||
it('should allow to pass projectable nodes',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
|
||||
@@ -124,7 +124,7 @@ export function main() {
|
||||
|
||||
it('should not throw if not enough projectable nodes are passed in',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
|
||||
@@ -138,7 +138,7 @@ export function main() {
|
||||
describe('loadAsRoot', () => {
|
||||
it('should allow to create, update and destroy components',
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async: any /** TODO #9100 */, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
(async: AsyncTestCompleter, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
var rootEl = createRootElement(doc, 'child-cmp');
|
||||
getDOM().appendChild(doc.body, rootEl);
|
||||
loader.loadAsRoot(ChildComp, null, injector)
|
||||
@@ -167,7 +167,7 @@ export function main() {
|
||||
|
||||
it('should allow to pass projectable nodes',
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async: any /** TODO #9100 */, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
(async: AsyncTestCompleter, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
var rootEl = createRootElement(doc, 'dummy');
|
||||
getDOM().appendChild(doc.body, rootEl);
|
||||
loader.loadAsRoot(DynamicallyLoadedWithNgContent, null, injector, null,
|
||||
|
||||
@@ -103,7 +103,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
describe('react to record changes', function() {
|
||||
it('should consume text node changes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<div>{{ctxProp}}</div>'}))
|
||||
.createAsync(MyComp)
|
||||
.then((fixture) => {
|
||||
@@ -116,7 +116,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should update text node with a blank string when interpolation evaluates to null',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<div>{{null}}{{ctxProp}}</div>'}))
|
||||
.createAsync(MyComp)
|
||||
.then((fixture) => {
|
||||
@@ -129,7 +129,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should consume element binding changes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<div [id]="ctxProp"></div>'}))
|
||||
.createAsync(MyComp)
|
||||
.then((fixture) => {
|
||||
@@ -143,7 +143,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should consume binding to aria-* attributes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<div [attr.aria-label]="ctxProp"></div>'}))
|
||||
|
||||
@@ -166,7 +166,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should remove an attribute when attribute expression evaluates to null',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<div [attr.foo]="ctxProp"></div>'}))
|
||||
|
||||
@@ -190,7 +190,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should remove style when when style expression evaluates to null',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<div [style.height.px]="ctxProp"></div>'}))
|
||||
|
||||
@@ -212,7 +212,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should consume binding to property names where attr name and property name do not match',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<div [tabindex]="ctxNumProp"></div>'}))
|
||||
|
||||
@@ -231,7 +231,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should consume binding to camel-cased properties',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<input [readOnly]="ctxBoolProp">'}))
|
||||
|
||||
@@ -250,7 +250,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should consume binding to innerHtml',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<div innerHtml="{{ctxProp}}"></div>'}))
|
||||
|
||||
@@ -272,7 +272,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should consume binding to className using class alias',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata({template: '<div class="initial" [class]="ctxProp"></div>'}))
|
||||
@@ -292,7 +292,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should consume directive watch expression change.',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var tpl = '<span>' +
|
||||
'<div my-dir [elprop]="ctxProp"></div>' +
|
||||
'<div my-dir elprop="Hi there!"></div>' +
|
||||
@@ -320,7 +320,7 @@ function declareTests(isJit: boolean) {
|
||||
describe('pipes', () => {
|
||||
it("should support pipes in bindings",
|
||||
inject(
|
||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: '<div my-dir #dir="mydir" [elprop]="ctxProp | double"></div>',
|
||||
@@ -341,7 +341,7 @@ function declareTests(isJit: boolean) {
|
||||
});
|
||||
|
||||
it('should support nested components.',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata({template: '<child-cmp></child-cmp>', directives: [ChildComp]}))
|
||||
@@ -358,7 +358,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
// GH issue 328 - https://github.com/angular/angular/issues/328
|
||||
it('should support different directive types on a single node',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<child-cmp my-dir [elprop]="ctxProp"></child-cmp>',
|
||||
directives: [MyDir, ChildComp]
|
||||
@@ -380,7 +380,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support directives where a binding attribute is not given',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
// No attribute "el-prop" specified.
|
||||
template: '<p my-dir></p>',
|
||||
@@ -392,7 +392,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should execute a given directive once, even if specified multiple times',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: '<p no-duplicate></p>',
|
||||
@@ -406,7 +406,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support directives where a selector matches property binding',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata(
|
||||
{template: '<p [id]="ctxProp"></p>', directives: [IdDir]}))
|
||||
|
||||
@@ -428,7 +428,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support directives where a selector matches event binding',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata(
|
||||
@@ -443,7 +443,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should read directives metadata from their binding token',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div public-api><div needs-public-api></div></div>',
|
||||
directives: [PrivateImpl, NeedsPublicApi]
|
||||
@@ -454,7 +454,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support template directives via `<template>` elements.',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -477,7 +477,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should not detach views in ViewContainers when the parent view is destroyed.',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -506,7 +506,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should use a comment while stamping out `<template>` elements.',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<template></template>'}))
|
||||
|
||||
.createAsync(MyComp)
|
||||
@@ -519,7 +519,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support template directives via `template` attribute.',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -541,7 +541,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should allow to transplant TemplateRefs into other ViewContainers',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -564,7 +564,7 @@ function declareTests(isJit: boolean) {
|
||||
describe("reference bindings", () => {
|
||||
it('should assign a component to a ref-',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<p><child-cmp ref-alice></child-cmp></p>',
|
||||
directives: [ChildComp]
|
||||
@@ -580,7 +580,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should assign a directive to a ref-',
|
||||
inject(
|
||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div><div export-dir #localdir="dir"></div></div>',
|
||||
directives: [ExportDir]
|
||||
@@ -598,7 +598,7 @@ function declareTests(isJit: boolean) {
|
||||
it('should make the assigned component accessible in property bindings, even if they were declared before the component',
|
||||
inject(
|
||||
[TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -617,7 +617,7 @@ function declareTests(isJit: boolean) {
|
||||
it('should assign two component instances each with a ref-',
|
||||
inject(
|
||||
[TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -641,7 +641,7 @@ function declareTests(isJit: boolean) {
|
||||
it('should assign the component instance to a ref- with shorthand syntax',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {tcb.overrideView(MyComp, new ViewMetadata({
|
||||
async: AsyncTestCompleter) => {tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<child-cmp #alice></child-cmp>',
|
||||
directives: [ChildComp]
|
||||
}))
|
||||
@@ -657,7 +657,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should assign the element instance to a user-defined variable',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div><div ref-alice><i>Hello</i></div></div>'
|
||||
}))
|
||||
@@ -675,7 +675,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should assign the TemplateRef to a user-defined variable',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata(
|
||||
{template: '<template ref-alice></template>'}))
|
||||
|
||||
@@ -690,7 +690,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should preserve case',
|
||||
inject(
|
||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<p><child-cmp ref-superAlice></child-cmp></p>',
|
||||
directives: [ChildComp]
|
||||
@@ -709,7 +709,7 @@ function declareTests(isJit: boolean) {
|
||||
describe('variables', () => {
|
||||
it('should allow to use variables in a for loop',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -733,7 +733,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it("should use ChangeDetectorRef to manually request a check",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<push-cmp-with-ref #cmp></push-cmp-with-ref>',
|
||||
@@ -760,7 +760,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it("should be checked when its bindings got updated",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<push-cmp [prop]="ctxProp" #cmp></push-cmp>',
|
||||
@@ -806,7 +806,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it("should be checked when an event is fired",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<push-cmp [prop]="ctxProp" #cmp></push-cmp>',
|
||||
@@ -847,7 +847,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should not affect updating properties on the component',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -903,7 +903,7 @@ function declareTests(isJit: boolean) {
|
||||
it('should create a component that injects an @Host',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {tcb.overrideView(MyComp, new ViewMetadata({
|
||||
async: AsyncTestCompleter) => {tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: `
|
||||
<some-directive>
|
||||
<p>
|
||||
@@ -926,7 +926,7 @@ function declareTests(isJit: boolean) {
|
||||
})}));
|
||||
|
||||
it('should create a component that injects an @Host through viewcontainer directive',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: `
|
||||
<some-directive>
|
||||
@@ -951,7 +951,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support events via EventEmitter on regular elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div emitter listener></div>',
|
||||
directives: [DirectiveEmittingEvent, DirectiveListeningEvent]
|
||||
@@ -985,7 +985,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support events via EventEmitter on template elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: '<template emitter listener (event)="ctxProp=$event"></template>',
|
||||
@@ -1015,7 +1015,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support [()] syntax',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div [(control)]="ctxProp" two-way></div>',
|
||||
directives: [DirectiveWithTwoWayBinding]
|
||||
@@ -1041,7 +1041,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support render events',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata(
|
||||
@@ -1069,7 +1069,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support render global events',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata(
|
||||
@@ -1096,7 +1096,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support updating host element via hostAttributes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div update-host-attributes></div>',
|
||||
directives: [DirectiveUpdatingHostAttributes]
|
||||
@@ -1115,7 +1115,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support updating host element via hostProperties',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div update-host-properties></div>',
|
||||
directives: [DirectiveUpdatingHostProperties]
|
||||
@@ -1140,7 +1140,7 @@ function declareTests(isJit: boolean) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should support preventing default on render events',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template:
|
||||
@@ -1171,7 +1171,7 @@ function declareTests(isJit: boolean) {
|
||||
}
|
||||
|
||||
it('should support render global events from multiple directives',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: '<div *ngIf="ctxBoolProp" listener listenerother></div>',
|
||||
@@ -1215,7 +1215,7 @@ function declareTests(isJit: boolean) {
|
||||
describe('dynamic ViewContainers', () => {
|
||||
it('should allow to create a ViewContainerRef at any bound location',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter, ComponentResolver],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */, compiler: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter, compiler: ComponentResolver) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div><dynamic-vp #dynamic></dynamic-vp></div>',
|
||||
directives: [DynamicViewport]
|
||||
@@ -1237,7 +1237,7 @@ function declareTests(isJit: boolean) {
|
||||
});
|
||||
|
||||
it('should support static attributes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata(
|
||||
@@ -1257,7 +1257,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
describe("dependency injection", () => {
|
||||
it("should support bindings",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: `
|
||||
@@ -1278,7 +1278,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it("should support viewProviders",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(DirectiveProvidingInjectableInView, new ViewMetadata({
|
||||
template: `
|
||||
<directive-consuming-injectable #consuming>
|
||||
@@ -1296,7 +1296,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it("should support unbounded lookup",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: `
|
||||
<directive-providing-injectable>
|
||||
@@ -1326,7 +1326,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it("should support the event-bus scenario",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: `
|
||||
<grand-parent-providing-event-bus>
|
||||
@@ -1362,7 +1362,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it("should instantiate bindings lazily",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: `
|
||||
@@ -1391,7 +1391,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
describe("corner cases", () => {
|
||||
it('should remove script tags from templates',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: `
|
||||
<script>alert("Ooops");</script>
|
||||
@@ -1409,7 +1409,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
describe("error handling", () => {
|
||||
it('should report a meaningful error when a directive is missing annotation',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb = tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata({template: '', directives: [SomeDirectiveMissingAnnotation]}));
|
||||
@@ -1433,7 +1433,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should report a meaningful error when a directive is null',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb = tcb.overrideView(MyComp, new ViewMetadata({directives: [[null]], template: ''}));
|
||||
|
||||
@@ -1446,7 +1446,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should provide an error context when an error happens in DI',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb =
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
@@ -1464,7 +1464,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should provide an error context when an error happens in change detection',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb = tcb.overrideView(
|
||||
MyComp, new ViewMetadata({template: `<input [value]="one.two.three" #local>`}));
|
||||
@@ -1488,7 +1488,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should provide an error context when an error happens in change detection (text node)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb = tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: `<div>{{one.two.three}}</div>`}));
|
||||
@@ -1540,7 +1540,7 @@ function declareTests(isJit: boolean) {
|
||||
if (!IS_DART) {
|
||||
it('should report a meaningful error when a directive is undefined',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
|
||||
var undefinedValue: any /** TODO #9100 */;
|
||||
|
||||
@@ -1558,7 +1558,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should specify a location of an error that happened during change detection (text)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<div>{{a.b}}</div>'}))
|
||||
|
||||
@@ -1572,7 +1572,7 @@ function declareTests(isJit: boolean) {
|
||||
it('should specify a location of an error that happened during change detection (element property)',
|
||||
inject(
|
||||
[TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: '<div [title]="a.b"></div>'}))
|
||||
|
||||
@@ -1584,7 +1584,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should specify a location of an error that happened during change detection (directive property)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<child-cmp [title]="a.b"></child-cmp>',
|
||||
@@ -1600,7 +1600,7 @@ function declareTests(isJit: boolean) {
|
||||
});
|
||||
|
||||
it('should support imperative views',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<simple-imp-cmp></simple-imp-cmp>',
|
||||
directives: [SimpleImperativeViewComponent]
|
||||
@@ -1614,7 +1614,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should support moving embedded views around',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter, ANCHOR_ELEMENT],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */, anchorElement: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter, anchorElement: any /** TODO #9100 */) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<div><div *someImpvp="ctxBoolProp">hello</div></div>',
|
||||
directives: [SomeImperativeViewport]
|
||||
@@ -1641,7 +1641,7 @@ function declareTests(isJit: boolean) {
|
||||
if (!IS_DART) {
|
||||
it('should throw on bindings to unknown properties',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb =
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<div unknown="{{ctxProp}}"></div>'}))
|
||||
@@ -1656,7 +1656,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should not throw for property binding to a non-existing property when there is a matching directive property',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp,
|
||||
new ViewMetadata(
|
||||
@@ -1667,7 +1667,7 @@ function declareTests(isJit: boolean) {
|
||||
}
|
||||
|
||||
it('should not be created when there is a directive with the same property',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<span [title]="ctxProp"></span>',
|
||||
directives: [DirectiveWithTitle]
|
||||
@@ -1686,7 +1686,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should work when a directive uses hostProperty to update the DOM element',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<span [title]="ctxProp"></span>',
|
||||
directives: [DirectiveWithTitleAndHostProperty]
|
||||
@@ -1710,7 +1710,7 @@ function declareTests(isJit: boolean) {
|
||||
() => [{provide: CompilerConfig, useValue: new CompilerConfig(true, true, isJit)}]);
|
||||
|
||||
it('should reflect property values as attributes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var tpl = '<div>' +
|
||||
'<div my-dir [elprop]="ctxProp"></div>' +
|
||||
'</div>';
|
||||
@@ -1728,7 +1728,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should reflect property values on template comments',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var tpl = '<template [ngIf]="ctxBoolProp"></template>';
|
||||
tcb.overrideView(MyComp, new ViewMetadata({template: tpl, directives: [NgIf]}))
|
||||
|
||||
@@ -1746,7 +1746,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
describe('property decorators', () => {
|
||||
it('should support property decorators',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: '<with-prop-decorators elProp="aaa"></with-prop-decorators>',
|
||||
@@ -1762,7 +1762,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support host binding decorators',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<with-prop-decorators></with-prop-decorators>',
|
||||
directives: [DirectiveWithPropDecorators]
|
||||
@@ -1803,7 +1803,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should support host listener decorators',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<with-prop-decorators></with-prop-decorators>',
|
||||
directives: [DirectiveWithPropDecorators]
|
||||
@@ -1822,7 +1822,7 @@ function declareTests(isJit: boolean) {
|
||||
}
|
||||
|
||||
it('should support defining views in the component decorator',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<component-with-template></component-with-template>',
|
||||
directives: [ComponentWithTemplate]
|
||||
@@ -1842,7 +1842,7 @@ function declareTests(isJit: boolean) {
|
||||
describe('svg', () => {
|
||||
it('should support svg elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp,
|
||||
new ViewMetadata({template: '<svg><use xlink:href="Port" /></svg>'}))
|
||||
.createAsync(MyComp)
|
||||
@@ -1874,7 +1874,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should support attributes with namespace',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(SomeCmp, new ViewMetadata({template: '<svg:use xlink:href="#id" />'}))
|
||||
.createAsync(SomeCmp)
|
||||
.then((fixture) => {
|
||||
@@ -1887,7 +1887,7 @@ function declareTests(isJit: boolean) {
|
||||
|
||||
it('should support binding to attributes with namespace',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(SomeCmp,
|
||||
new ViewMetadata({template: '<svg:use [attr.xlink:href]="value" />'}))
|
||||
.createAsync(SomeCmp)
|
||||
|
||||
@@ -35,7 +35,7 @@ import {getAllDebugNodes} from '@angular/core/src/debug/debug_node';
|
||||
export function main() {
|
||||
describe('projection', () => {
|
||||
it('should support simple components',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<simple>' +
|
||||
'<div>A</div>' +
|
||||
@@ -50,7 +50,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support simple components with text interpolation as direct children',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '{{\'START(\'}}<simple>' +
|
||||
'{{text}}' +
|
||||
@@ -68,7 +68,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support projecting text interpolation to a non bound element',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
Simple,
|
||||
new ViewMetadata(
|
||||
@@ -88,7 +88,7 @@ export function main() {
|
||||
|
||||
|
||||
it('should support projecting text interpolation to a non bound element with other bound elements after it',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
Simple, new ViewMetadata({
|
||||
template:
|
||||
@@ -109,7 +109,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should project content components',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
Simple,
|
||||
new ViewMetadata(
|
||||
@@ -129,7 +129,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should not show the light dom even if there is no content tag',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp,
|
||||
new ViewMetadata({template: '<empty>A</empty>', directives: [Empty]}))
|
||||
.createAsync(MainComp)
|
||||
@@ -141,7 +141,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support multiple content tags',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<multiple-content-tags>' +
|
||||
'<div>B</div>' +
|
||||
@@ -159,7 +159,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should redistribute only direct children',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<multiple-content-tags>' +
|
||||
'<div>B<div class="left">A</div></div>' +
|
||||
@@ -176,7 +176,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should redistribute direct child viewcontainers when the light dom changes",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<multiple-content-tags>' +
|
||||
'<template manual class="left"><div>A1</div></template>' +
|
||||
@@ -204,7 +204,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should support nested components",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<outer-with-indirect-nested>' +
|
||||
'<div>A</div>' +
|
||||
@@ -221,7 +221,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should support nesting with content being direct child of a nested component",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<outer>' +
|
||||
'<template manual class="left"><div>A</div></template>' +
|
||||
@@ -246,7 +246,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should redistribute when the shadow dom changes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<conditional-content>' +
|
||||
'<div class="left">A</div>' +
|
||||
@@ -278,7 +278,7 @@ export function main() {
|
||||
// important as we are removing the ng-content element during compilation,
|
||||
// which could skrew up text node indices.
|
||||
it('should support text nodes after content tags',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(
|
||||
MainComp,
|
||||
@@ -299,7 +299,7 @@ export function main() {
|
||||
// important as we are moving style tags around during compilation,
|
||||
// which could skrew up text node indices.
|
||||
it('should support text nodes after style tags',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(
|
||||
MainComp,
|
||||
@@ -316,7 +316,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support moving non projected light dom around',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<empty>' +
|
||||
' <template manual><div>A</div></template>' +
|
||||
@@ -349,7 +349,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support moving projected light dom around',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<simple><template manual><div>A</div></template></simple>' +
|
||||
'START(<div project></div>)END',
|
||||
@@ -373,7 +373,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support moving ng-content around',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MainComp, new ViewMetadata({
|
||||
template: '<conditional-content>' +
|
||||
@@ -411,7 +411,7 @@ export function main() {
|
||||
// is still important as we are merging proto views independent of
|
||||
// the presence of ng-content elements!
|
||||
it('should still allow to implement a recursive trees',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp,
|
||||
new ViewMetadata({template: '<tree></tree>', directives: [Tree]}))
|
||||
.createAsync(MainComp)
|
||||
@@ -433,7 +433,7 @@ export function main() {
|
||||
// is still important as we are merging proto views independent of
|
||||
// the presence of ng-content elements!
|
||||
it('should still allow to implement a recursive trees via multiple components',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp,
|
||||
new ViewMetadata({template: '<tree></tree>', directives: [Tree]}))
|
||||
.overrideView(Tree, new ViewMetadata({
|
||||
@@ -468,7 +468,7 @@ export function main() {
|
||||
|
||||
if (getDOM().supportsNativeShadowDOM()) {
|
||||
it('should support native content projection and isolate styles per component',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<simple-native1><div>A</div></simple-native1>' +
|
||||
'<simple-native2><div>B</div></simple-native2>',
|
||||
@@ -487,7 +487,7 @@ export function main() {
|
||||
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it('should support non emulated styles',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<div class="redStyle"></div>',
|
||||
styles: ['.redStyle { color: red}'],
|
||||
@@ -508,7 +508,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support emulated style encapsulation',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<div></div>',
|
||||
styles: ['div { color: red}'],
|
||||
@@ -528,7 +528,7 @@ export function main() {
|
||||
}
|
||||
|
||||
it('should support nested conditionals that contain ng-contents',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: `<conditional-text>a</conditional-text>`,
|
||||
directives: [ConditionalTextComponent]
|
||||
@@ -552,7 +552,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should allow to switch the order of nested components via ng-content',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: `<cmp-a><cmp-b></cmp-b></cmp-a>`,
|
||||
directives: [CmpA, CmpB],
|
||||
@@ -568,7 +568,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should create nested components in the right order',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`,
|
||||
directives: [CmpA1, CmpA2],
|
||||
@@ -584,7 +584,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should project filled view containers into a view container',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: '<conditional-content>' +
|
||||
'<div class="left">A</div>' +
|
||||
|
||||
@@ -39,7 +39,7 @@ export function main() {
|
||||
describe('Query API', () => {
|
||||
describe("querying by directive type", () => {
|
||||
it('should contain all direct child directives in the light dom (constructor)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<div text="1"></div>' +
|
||||
'<needs-query text="2"><div text="3">' +
|
||||
'<div text="too-deep"></div>' +
|
||||
@@ -58,7 +58,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain all direct child directives in the content dom',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-content-children #q><div text="foo"></div></needs-content-children>';
|
||||
|
||||
@@ -79,7 +79,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain the first content child',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-content-child #q><div *ngIf="shouldShow" text="foo"></div></needs-content-child>';
|
||||
|
||||
@@ -109,7 +109,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain the first view child',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-child #q></needs-view-child>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -136,7 +136,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should set static view and content children already after the constructor call',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-static-content-view-child #q><div text="contentFoo"></div></needs-static-content-view-child>';
|
||||
|
||||
@@ -158,7 +158,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain the first view child accross embedded views',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-child #q></needs-view-child>';
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.overrideTemplate(
|
||||
@@ -190,7 +190,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain all directives in the light dom when descendants flag is used',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<div text="1"></div>' +
|
||||
'<needs-query-desc text="2"><div text="3">' +
|
||||
'<div text="4"></div>' +
|
||||
@@ -208,7 +208,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain all directives in the light dom',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<div text="1"></div>' +
|
||||
'<needs-query text="2"><div text="3"></div></needs-query>' +
|
||||
'<div text="4"></div>';
|
||||
@@ -224,7 +224,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should reflect dynamically inserted directives',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<div text="1"></div>' +
|
||||
'<needs-query text="2"><div *ngIf="shouldShow" [text]="\'3\'"></div></needs-query>' +
|
||||
@@ -246,7 +246,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should be cleanly destroyed when a query crosses view boundaries',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<div text="1"></div>' +
|
||||
'<needs-query text="2"><div *ngIf="shouldShow" [text]="\'3\'"></div></needs-query>' +
|
||||
@@ -264,7 +264,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should reflect moved directives',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<div text="1"></div>' +
|
||||
'<needs-query text="2"><div *ngFor="let i of list" [text]="i"></div></needs-query>' +
|
||||
@@ -286,7 +286,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should throw with descriptive error when query selectors are not present',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideTemplate(MyCompBroken0, '<has-null-query-condition></has-null-query-condition>')
|
||||
.createAsync(MyCompBroken0)
|
||||
.catch((e) => {
|
||||
@@ -299,7 +299,7 @@ export function main() {
|
||||
|
||||
describe('query for TemplateRef', () => {
|
||||
it('should find TemplateRefs in the light and shadow dom',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-tpl><template><div>light</div></template></needs-tpl>';
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
.createAsync(MyComp0)
|
||||
@@ -317,7 +317,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should find named TemplateRefs',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-named-tpl><template #tpl><div>light</div></template></needs-named-tpl>';
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -337,7 +337,7 @@ export function main() {
|
||||
|
||||
describe('read a different token', () => {
|
||||
it('should contain all content children',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-content-children-read #q text="ca"><div #q text="cb"></div></needs-content-children-read>';
|
||||
|
||||
@@ -356,7 +356,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain the first content child',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-content-child-read><div #q text="ca"></div></needs-content-child-read>';
|
||||
|
||||
@@ -374,7 +374,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain the first view child',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-child-read></needs-view-child-read>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -391,7 +391,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain all child directives in the view',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-children-read></needs-view-children-read>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -409,7 +409,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support reading a ViewContainer',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-viewcontainer-read><template>hello</template></needs-viewcontainer-read>';
|
||||
|
||||
@@ -430,7 +430,7 @@ export function main() {
|
||||
|
||||
describe("changes", () => {
|
||||
it('should notify query on change',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-query #q>' +
|
||||
'<div text="1"></div>' +
|
||||
'<div *ngIf="shouldShow" text="2"></div>' +
|
||||
@@ -454,7 +454,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should notify child's query before notifying parent's query",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-query-desc #q1>' +
|
||||
'<needs-query-desc #q2>' +
|
||||
'<div text="1"></div>' +
|
||||
@@ -480,7 +480,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should correctly clean-up when destroyed together with the directives it is querying',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-query #q *ngIf="shouldShow"><div text="foo"></div></needs-query>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -510,7 +510,7 @@ export function main() {
|
||||
|
||||
describe("querying by var binding", () => {
|
||||
it('should contain all the child directives in the light dom with the given var binding',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-query-by-ref-binding #q>' +
|
||||
'<div *ngFor="let item of list" [text]="item" #textLabel="textDir"></div>' +
|
||||
@@ -533,7 +533,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support querying by multiple var bindings',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-query-by-ref-bindings #q>' +
|
||||
'<div text="one" #textLabel1="textDir"></div>' +
|
||||
'<div text="two" #textLabel2="textDir"></div>' +
|
||||
@@ -553,7 +553,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support dynamically inserted directives',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<needs-query-by-ref-binding #q>' +
|
||||
'<div *ngFor="let item of list" [text]="item" #textLabel="textDir"></div>' +
|
||||
@@ -579,7 +579,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain all the elements in the light dom with the given var binding',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-query-by-ref-binding #q>' +
|
||||
'<div template="ngFor: let item of list">' +
|
||||
'<div #textLabel>{{item}}</div>' +
|
||||
@@ -603,7 +603,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain all the elements in the light dom even if they get projected',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-query-and-project #q>' +
|
||||
'<div text="hello"></div><div text="world"></div>' +
|
||||
'</needs-query-and-project>';
|
||||
@@ -620,7 +620,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support querying the view by using a view query',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query-by-ref-binding #q></needs-view-query-by-ref-binding>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -636,7 +636,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should contain all child directives in the view dom',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-children #q></needs-view-children>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -659,7 +659,7 @@ export function main() {
|
||||
|
||||
describe("querying in the view", () => {
|
||||
it('should contain all the elements in the view with that have the given directive',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query #q><div text="ignoreme"></div></needs-view-query>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -676,7 +676,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should not include directive present on the host element',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query #q text="self"></needs-view-query>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -693,7 +693,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should reflect changes in the component',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query-if #q></needs-view-query-if>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -716,7 +716,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should not be affected by other changes in the component',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query-nested-if #q></needs-view-query-nested-if>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -741,7 +741,7 @@ export function main() {
|
||||
|
||||
|
||||
it('should maintain directives in pre-order depth-first DOM order after dynamic insertion',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query-order #q></needs-view-query-order>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -764,7 +764,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should maintain directives in pre-order depth-first DOM order after dynamic insertion',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query-order-with-p #q></needs-view-query-order-with-p>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -788,7 +788,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should handle long ngFor cycles',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-view-query-order #q></needs-view-query-order>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
@@ -810,7 +810,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support more than three queries',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<needs-four-queries #q><div text="1"></div></needs-four-queries>';
|
||||
|
||||
tcb.overrideTemplate(MyComp0, template)
|
||||
|
||||
@@ -27,13 +27,13 @@ export function main() {
|
||||
|
||||
beforeEachProviders(() => [{provide: ComponentResolver, useClass: ReflectorComponentResolver}]);
|
||||
|
||||
beforeEach(inject([ComponentResolver], (_compiler: any /** TODO #9100 */) => {
|
||||
beforeEach(inject([ComponentResolver], (_compiler: ComponentResolver) => {
|
||||
someCompFactory = new ComponentFactory(null, null, null);
|
||||
reflector.registerType(SomeComponent, new ReflectionInfo([someCompFactory]));
|
||||
}));
|
||||
|
||||
it('should read the template from an annotation',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, compiler: ComponentResolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, compiler: ComponentResolver) => {
|
||||
compiler.resolveComponent(SomeComponent)
|
||||
.then((compFactory: ComponentFactory<any>) => {
|
||||
expect(compFactory).toBe(someCompFactory);
|
||||
@@ -43,7 +43,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should throw when given a string',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, compiler: ComponentResolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, compiler: ComponentResolver) => {
|
||||
compiler.resolveComponent("someString")
|
||||
.catch((e) => {
|
||||
expect(e.message).toContain("Cannot resolve component using 'someString'.")
|
||||
|
||||
@@ -54,7 +54,7 @@ function declareTests(isJit: boolean) {
|
||||
beforeEachProviders(() => [{provide: PLATFORM_PIPES, useValue: [PlatformPipe], multi: true}]);
|
||||
|
||||
it('should overwrite them by custom pipes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp1, new ViewMetadata({template: '{{true | somePipe}}', pipes: [CustomPipe]}))
|
||||
.createAsync(MyComp1)
|
||||
@@ -69,7 +69,7 @@ function declareTests(isJit: boolean) {
|
||||
describe('expressions', () => {
|
||||
|
||||
it('should evaluate conditional and boolean operators with right precedence - #8244',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp1,
|
||||
new ViewMetadata({template: `{{'red' + (true ? ' border' : '')}}`}))
|
||||
.createAsync(MyComp1)
|
||||
@@ -83,7 +83,7 @@ function declareTests(isJit: boolean) {
|
||||
if (!IS_DART) {
|
||||
it('should evaluate conditional and unary operators with right precedence - #8235',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(MyComp1, new ViewMetadata({template: `{{!null?.length}}`}))
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => {
|
||||
@@ -103,7 +103,7 @@ function declareTests(isJit: boolean) {
|
||||
}
|
||||
|
||||
it('should support providers with an OpaqueToken that contains a `.` in the name',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var token = new OpaqueToken('a.b');
|
||||
var tokenValue = 1;
|
||||
createInjector(tcb, [{provide: token, useValue: tokenValue}])
|
||||
@@ -114,7 +114,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support providers with string token with a `.` in it',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var token = 'a.b';
|
||||
var tokenValue = 1;
|
||||
createInjector(tcb, [{provide: token, useValue: tokenValue}])
|
||||
@@ -125,7 +125,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support providers with an anonymous function',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var token = () => true;
|
||||
var tokenValue = 1;
|
||||
createInjector(tcb, [{provide: token, useValue: tokenValue}])
|
||||
@@ -136,7 +136,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support providers with an OpaqueToken that has a StringMap as value',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var token1 = new OpaqueToken('someToken');
|
||||
var token2 = new OpaqueToken('someToken');
|
||||
var tokenValue1 = {'a': 1};
|
||||
@@ -153,7 +153,7 @@ function declareTests(isJit: boolean) {
|
||||
});
|
||||
|
||||
it('should allow logging a previous elements class binding via interpolation',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideTemplate(MyComp1, `<div [class.a]="true" #el>Class: {{el.className}}</div>`)
|
||||
.createAsync(MyComp1)
|
||||
.then((fixture) => {
|
||||
@@ -164,7 +164,7 @@ function declareTests(isJit: boolean) {
|
||||
}));
|
||||
|
||||
it('should support ngClass before a component and content projection inside of an ngIf',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp1, new ViewMetadata({
|
||||
template: `A<cmp-content *ngIf="true" [ngClass]="'red'">B</cmp-content>C`,
|
||||
|
||||
@@ -289,7 +289,7 @@ export function main() {
|
||||
|
||||
beforeEachProviders(() => [{provide: "appService", useValue: 'appService'}]);
|
||||
|
||||
beforeEach(inject([TestComponentBuilder], (_tcb: any /** TODO #9100 */) => { tcb = _tcb; }));
|
||||
beforeEach(inject([TestComponentBuilder], (_tcb: TestComponentBuilder) => { tcb = _tcb; }));
|
||||
|
||||
describe("injection", () => {
|
||||
it("should instantiate directives that have no dependencies", fakeAsync(() => {
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
export function main() {
|
||||
describe('ViewChild', () => {
|
||||
it('should support type selector',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(ViewChildTypeSelectorComponent,
|
||||
new ViewMetadata(
|
||||
{template: `<simple [marker]="'1'"></simple><simple [marker]="'2'"></simple>`, directives: [Simple]}))
|
||||
@@ -38,7 +38,7 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
it('should support string selector',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
ViewChildStringSelectorComponent,
|
||||
new ViewMetadata({template: `<simple #child></simple>`, directives: [Simple]}))
|
||||
@@ -52,7 +52,7 @@ export function main() {
|
||||
});
|
||||
describe('ViewChildren', () => {
|
||||
it('should support type selector',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(ViewChildrenTypeSelectorComponent,
|
||||
new ViewMetadata({template: `<simple></simple><simple></simple>`, directives: [Simple]}))
|
||||
.createAsync(ViewChildrenTypeSelectorComponent)
|
||||
@@ -64,7 +64,7 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
it('should support string selector',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
ViewChildrenStringSelectorComponent,
|
||||
new ViewMetadata({template: `<simple #child1></simple><simple #child2></simple>`, directives: [Simple]}))
|
||||
|
||||
@@ -63,7 +63,7 @@ export function main() {
|
||||
() => { expect(testability.getPendingRequestCount()).toEqual(0); });
|
||||
|
||||
it('should fire whenstable callbacks if pending count is 0',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
testability.whenStable(execute);
|
||||
microTask(() => {
|
||||
expect(execute).toHaveBeenCalled();
|
||||
@@ -77,7 +77,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should not call whenstable callbacks when there are pending counts',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
testability.increasePendingRequestCount();
|
||||
testability.increasePendingRequestCount();
|
||||
testability.whenStable(execute);
|
||||
@@ -94,7 +94,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should fire whenstable callbacks when pending drops to 0',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
testability.increasePendingRequestCount();
|
||||
testability.whenStable(execute);
|
||||
|
||||
@@ -118,7 +118,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should fire whenstable callbacks with didWork if pending count is 0',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
testability.whenStable(execute);
|
||||
microTask(() => {
|
||||
expect(execute).toHaveBeenCalledWith(false);
|
||||
@@ -127,7 +127,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should fire whenstable callbacks with didWork when pending drops to 0',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
testability.increasePendingRequestCount();
|
||||
testability.whenStable(execute);
|
||||
|
||||
@@ -149,7 +149,7 @@ export function main() {
|
||||
|
||||
describe('NgZone callback logic', () => {
|
||||
it('should fire whenstable callback if event is already finished',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
ngZone.unstable();
|
||||
ngZone.stable();
|
||||
testability.whenStable(execute);
|
||||
@@ -169,7 +169,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should fire whenstable callback when event finishes',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
ngZone.unstable();
|
||||
testability.whenStable(execute);
|
||||
|
||||
@@ -193,7 +193,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should not fire whenstable callback when event did not finish',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
ngZone.unstable();
|
||||
testability.increasePendingRequestCount();
|
||||
testability.whenStable(execute);
|
||||
@@ -215,7 +215,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should not fire whenstable callback when there are pending counts',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
ngZone.unstable();
|
||||
testability.increasePendingRequestCount();
|
||||
testability.increasePendingRequestCount();
|
||||
@@ -243,7 +243,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should fire whenstable callback with didWork if event is already finished',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
ngZone.unstable();
|
||||
ngZone.stable();
|
||||
testability.whenStable(execute);
|
||||
@@ -260,7 +260,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should fire whenstable callback with didwork when event finishes',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
ngZone.unstable();
|
||||
testability.whenStable(execute);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ function runNgZoneNoLog(fn: () => any) {
|
||||
export function main() {
|
||||
describe("NgZone", () => {
|
||||
|
||||
function createZone(enableLongStackTrace: any /** TODO #9100 */) {
|
||||
function createZone(enableLongStackTrace: boolean) {
|
||||
return new NgZone({enableLongStackTrace: enableLongStackTrace});
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export function main() {
|
||||
|
||||
commonTests();
|
||||
|
||||
it('should produce long stack traces', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it('should produce long stack traces', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
macroTask(() => {
|
||||
var c: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
|
||||
@@ -112,7 +112,7 @@ export function main() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should produce long stack traces (when using microtasks)',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
macroTask(() => {
|
||||
var c: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
|
||||
@@ -145,7 +145,7 @@ export function main() {
|
||||
|
||||
commonTests();
|
||||
|
||||
it('should disable long stack traces', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it('should disable long stack traces', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
macroTask(() => {
|
||||
var c: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
|
||||
@@ -213,13 +213,13 @@ function commonTests() {
|
||||
});
|
||||
|
||||
describe('run', () => {
|
||||
it('should return the body return value from run', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it('should return the body return value from run', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
macroTask(() => { expect(_zone.run(() => { return 6; })).toEqual(6); });
|
||||
|
||||
macroTask(() => { async.done(); });
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it('should call onUnstable and onMicrotaskEmpty', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
macroTask(() => {
|
||||
expect(_log.result()).toEqual('onUnstable; run; onMicrotaskEmpty; onStable');
|
||||
@@ -227,7 +227,7 @@ function commonTests() {
|
||||
});
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onStable once at the end of event', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it('should call onStable once at the end of event', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
// The test is set up in a way that causes the zone loop to run onMicrotaskEmpty twice
|
||||
// then verified that onStable is only called once at the end
|
||||
|
||||
@@ -251,7 +251,7 @@ function commonTests() {
|
||||
}, resultTimer);
|
||||
}), testTimeout);
|
||||
|
||||
it('should call standalone onStable', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it('should call standalone onStable', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
macroTask(() => {
|
||||
@@ -261,7 +261,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
xit('should run subscriber listeners in the subscription zone (outside)',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
// Each subscriber fires a microtask outside the Angular zone. The test
|
||||
// then verifies that those microtasks do not cause additional digests.
|
||||
|
||||
@@ -298,7 +298,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should run subscriber listeners in the subscription zone (inside)',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
// the only practical use-case to run a callback inside the zone is
|
||||
@@ -320,7 +320,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should run async tasks scheduled inside onStable outside Angular zone',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
ObservableWrapper.subscribe(_zone.onStable, (_) => {
|
||||
@@ -336,7 +336,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable once before a turn and onMicrotaskEmpty once after the turn',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('run start');
|
||||
@@ -354,7 +354,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should not run onUnstable and onMicrotaskEmpty for nested Zone.run',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('start run');
|
||||
@@ -375,7 +375,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should not run onUnstable and onMicrotaskEmpty for nested Zone.run invoked from onMicrotaskEmpty',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('start run')));
|
||||
|
||||
ObservableWrapper.subscribe(_zone.onMicrotaskEmpty, (_) => {
|
||||
@@ -393,7 +393,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after each top-level run',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run1')));
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run2')));
|
||||
|
||||
@@ -406,7 +406,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after each turn',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var a: PromiseCompleter<string>;
|
||||
var b: PromiseCompleter<string>;
|
||||
|
||||
@@ -437,7 +437,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should run a function outside of the angular zone',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
macroTask(() => { _zone.runOutsideAngular(_log.fn('run')); });
|
||||
|
||||
macroTask(() => {
|
||||
@@ -447,7 +447,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty when an inner microtask is scheduled from outside angular',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var completer: PromiseCompleter<any>;
|
||||
|
||||
macroTask(() => {
|
||||
@@ -484,7 +484,7 @@ function commonTests() {
|
||||
|
||||
it('should call onUnstable only before executing a microtask scheduled in onMicrotaskEmpty ' +
|
||||
'and not onMicrotaskEmpty after executing the task',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
var ran = false;
|
||||
@@ -516,7 +516,7 @@ function commonTests() {
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty for a scheduleMicroTask in onMicrotaskEmpty triggered by ' +
|
||||
'a scheduleMicroTask in run',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('scheduleMicroTask');
|
||||
@@ -551,7 +551,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should execute promises scheduled in onUnstable before promises scheduled in run',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('run start');
|
||||
@@ -607,7 +607,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after each turn, respectively',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var completerA: PromiseCompleter<any>;
|
||||
var completerB: PromiseCompleter<any>;
|
||||
|
||||
@@ -639,7 +639,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after (respectively) all turns in a chain',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('run start');
|
||||
@@ -660,7 +660,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty for promises created outside of run body',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var promise: Promise<any>;
|
||||
|
||||
runNgZoneNoLog(() => {
|
||||
@@ -685,7 +685,7 @@ function commonTests() {
|
||||
|
||||
describe('exceptions', () => {
|
||||
it('should call the on error callback when it is invoked via zone.runGuarded',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
macroTask(() => {
|
||||
var exception = new BaseException('sync');
|
||||
|
||||
@@ -698,7 +698,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should not call the on error callback but rethrow when it is invoked via zone.run',
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
macroTask(() => {
|
||||
var exception = new BaseException('sync');
|
||||
expect(() => _zone.run(() => { throw exception; })).toThrowError('sync');
|
||||
@@ -708,7 +708,7 @@ function commonTests() {
|
||||
});
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onError for errors from microtasks', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it('should call onError for errors from microtasks', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var exception = new BaseException('async');
|
||||
|
||||
macroTask(() => { _zone.run(() => { scheduleMicroTask(() => { throw exception; }); }); });
|
||||
|
||||
Reference in New Issue
Block a user