refactor: add types (#9116)

This commit is contained in:
Victor Berchet
2016-06-09 11:04:15 -07:00
committed by Miško Hevery
parent b60eecfc47
commit 7ce0fc7d47
64 changed files with 711 additions and 718 deletions

View File

@ -25,7 +25,7 @@ export function main() {
describe('binding to CSS class list', () => { describe('binding to CSS class list', () => {
it('should clean up when the directive is destroyed', it('should clean up when the directive is destroyed',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div *ngFor="let item of items" [ngClass]="item"></div>'; var template = '<div *ngFor="let item of items" [ngClass]="item"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent) .createAsync(TestComponent)
@ -44,7 +44,7 @@ export function main() {
describe('expressions evaluating to objects', () => { describe('expressions evaluating to objects', () => {
it('should add classes specified in an object literal', it('should add classes specified in an object literal',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="{foo: true, bar: false}"></div>'; var template = '<div [ngClass]="{foo: true, bar: false}"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -57,7 +57,7 @@ export function main() {
it('should add classes specified in an object literal without change in class names', it('should add classes specified in an object literal without change in class names',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngClass]="{'foo-bar': true, 'fooBar': true}"></div>`; var template = `<div [ngClass]="{'foo-bar': true, 'fooBar': true}"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -69,7 +69,7 @@ export function main() {
})); }));
it('should add and remove classes based on changes in object literal values', it('should add and remove classes based on changes in object literal values',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="{foo: condition, bar: !condition}"></div>'; var template = '<div [ngClass]="{foo: condition, bar: !condition}"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -85,7 +85,7 @@ export function main() {
})); }));
it('should add and remove classes based on changes to the expression object', it('should add and remove classes based on changes to the expression object',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="objExpr"></div>'; var template = '<div [ngClass]="objExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -107,7 +107,7 @@ export function main() {
})); }));
it('should add and remove classes based on reference changes to the expression object', it('should add and remove classes based on reference changes to the expression object',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="objExpr"></div>'; var template = '<div [ngClass]="objExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -126,7 +126,7 @@ export function main() {
})); }));
it('should remove active classes when expression evaluates to null', it('should remove active classes when expression evaluates to null',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="objExpr"></div>'; var template = '<div [ngClass]="objExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -146,7 +146,7 @@ export function main() {
it('should allow multiple classes per expression', it('should allow multiple classes per expression',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="objExpr"></div>'; var template = '<div [ngClass]="objExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -171,7 +171,7 @@ export function main() {
})); }));
it('should split by one or more spaces between classes', it('should split by one or more spaces between classes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="objExpr"></div>'; var template = '<div [ngClass]="objExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -190,7 +190,7 @@ export function main() {
describe('expressions evaluating to lists', () => { describe('expressions evaluating to lists', () => {
it('should add classes specified in a list literal', it('should add classes specified in a list literal',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngClass]="['foo', 'bar', 'foo-bar', 'fooBar']"></div>`; var template = `<div [ngClass]="['foo', 'bar', 'foo-bar', 'fooBar']"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -202,7 +202,7 @@ export function main() {
})); }));
it('should add and remove classes based on changes to the expression', it('should add and remove classes based on changes to the expression',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="arrExpr"></div>'; var template = '<div [ngClass]="arrExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -225,7 +225,7 @@ export function main() {
})); }));
it('should add and remove classes when a reference changes', it('should add and remove classes when a reference changes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="arrExpr"></div>'; var template = '<div [ngClass]="arrExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -241,7 +241,7 @@ export function main() {
})); }));
it('should take initial classes into account when a reference changes', it('should take initial classes into account when a reference changes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div class="foo" [ngClass]="arrExpr"></div>'; var template = '<div class="foo" [ngClass]="arrExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -257,7 +257,7 @@ export function main() {
})); }));
it('should ignore empty or blank class names', it('should ignore empty or blank class names',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div class="foo" [ngClass]="arrExpr"></div>'; var template = '<div class="foo" [ngClass]="arrExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -272,7 +272,7 @@ export function main() {
})); }));
it('should trim blanks from class names', it('should trim blanks from class names',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div class="foo" [ngClass]="arrExpr"></div>'; var template = '<div class="foo" [ngClass]="arrExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -288,7 +288,7 @@ export function main() {
it('should allow multiple classes per item in arrays', it('should allow multiple classes per item in arrays',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="arrExpr"></div>'; var template = '<div [ngClass]="arrExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -310,7 +310,7 @@ export function main() {
describe('expressions evaluating to sets', () => { describe('expressions evaluating to sets', () => {
it('should add and remove classes if the set instance changed', it('should add and remove classes if the set instance changed',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="setExpr"></div>'; var template = '<div [ngClass]="setExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -333,7 +333,7 @@ export function main() {
describe('expressions evaluating to string', () => { describe('expressions evaluating to string', () => {
it('should add classes specified in a string literal', it('should add classes specified in a string literal',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngClass]="'foo bar foo-bar fooBar'"></div>`; var template = `<div [ngClass]="'foo bar foo-bar fooBar'"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -345,7 +345,7 @@ export function main() {
})); }));
it('should add and remove classes based on changes to the expression', it('should add and remove classes based on changes to the expression',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="strExpr"></div>'; var template = '<div [ngClass]="strExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -365,7 +365,7 @@ export function main() {
})); }));
it('should remove active classes when switching from string to null', it('should remove active classes when switching from string to null',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngClass]="strExpr"></div>`; var template = `<div [ngClass]="strExpr"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -381,7 +381,7 @@ export function main() {
})); }));
it('should take initial classes into account when switching from string to null', it('should take initial classes into account when switching from string to null',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div class="foo" [ngClass]="strExpr"></div>`; var template = `<div class="foo" [ngClass]="strExpr"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -397,7 +397,7 @@ export function main() {
})); }));
it('should ignore empty and blank strings', it('should ignore empty and blank strings',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div class="foo" [ngClass]="strExpr"></div>`; var template = `<div class="foo" [ngClass]="strExpr"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -415,7 +415,7 @@ export function main() {
describe('cooperation with other class-changing constructs', () => { describe('cooperation with other class-changing constructs', () => {
it('should co-operate with the class attribute', it('should co-operate with the class attribute',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div [ngClass]="objExpr" class="init foo"></div>'; var template = '<div [ngClass]="objExpr" class="init foo"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -435,7 +435,7 @@ export function main() {
})); }));
it('should co-operate with the interpolated class attribute', it('should co-operate with the interpolated class attribute',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngClass]="objExpr" class="{{'init foo'}}"></div>`; var template = `<div [ngClass]="objExpr" class="{{'init foo'}}"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -455,7 +455,7 @@ export function main() {
})); }));
it('should co-operate with the class attribute and binding to it', it('should co-operate with the class attribute and binding to it',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngClass]="objExpr" class="init" [class]="'foo'"></div>`; var template = `<div [ngClass]="objExpr" class="init" [class]="'foo'"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -475,7 +475,7 @@ export function main() {
})); }));
it('should co-operate with the class attribute and class.name binding', it('should co-operate with the class attribute and class.name binding',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div class="init foo" [ngClass]="objExpr" [class.baz]="condition"></div>'; '<div class="init foo" [ngClass]="objExpr" [class.baz]="condition"></div>';
@ -498,7 +498,7 @@ export function main() {
})); }));
it('should co-operate with initial class and class attribute binding when binding changes', it('should co-operate with initial class and class attribute binding when binding changes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div class="init" [ngClass]="objExpr" [class]="strExpr"></div>'; var template = '<div class="init" [ngClass]="objExpr" [class]="strExpr"></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)

View File

@ -25,7 +25,7 @@ export function main() {
'<div><copy-me template="ngFor let item of items">{{item.toString()}};</copy-me></div>'; '<div><copy-me template="ngFor let item of items">{{item.toString()}};</copy-me></div>';
it('should reflect initial elements', it('should reflect initial elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -36,7 +36,7 @@ export function main() {
})); }));
it('should reflect added elements', it('should reflect added elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -51,7 +51,7 @@ export function main() {
})); }));
it('should reflect removed elements', it('should reflect removed elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -66,7 +66,7 @@ export function main() {
})); }));
it('should reflect moved elements', it('should reflect moved elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -82,7 +82,7 @@ export function main() {
})); }));
it('should reflect a mix of all changes (additions/removals/moves)', it('should reflect a mix of all changes (additions/removals/moves)',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -98,7 +98,7 @@ export function main() {
})); }));
it('should iterate over an array of objects', it('should iterate over an array of objects',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<ul><li template="ngFor let item of items">{{item["name"]}};</li></ul>'; var template = '<ul><li template="ngFor let item of items">{{item["name"]}};</li></ul>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -128,7 +128,7 @@ export function main() {
})); }));
it('should gracefully handle nulls', it('should gracefully handle nulls',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<ul><li template="ngFor let item of null">{{item}};</li></ul>'; var template = '<ul><li template="ngFor let item of null">{{item}};</li></ul>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent) .createAsync(TestComponent)
@ -140,7 +140,7 @@ export function main() {
})); }));
it('should gracefully handle ref changing to null and back', it('should gracefully handle ref changing to null and back',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -160,7 +160,7 @@ export function main() {
if (!IS_DART) { if (!IS_DART) {
it('should throw on non-iterable ref and suggest using an array', it('should throw on non-iterable ref and suggest using an array',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -177,7 +177,7 @@ export function main() {
} }
it('should throw on ref changing to string', it('should throw on ref changing to string',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -191,7 +191,7 @@ export function main() {
})); }));
it('should works with duplicates', it('should works with duplicates',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, TEMPLATE) tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent) .createAsync(TestComponent)
.then((fixture) => { .then((fixture) => {
@ -204,7 +204,7 @@ export function main() {
})); }));
it('should repeat over nested arrays', it('should repeat over nested arrays',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div>' + var template = '<div>' +
'<div template="ngFor let item of items">' + '<div template="ngFor let item of items">' +
'<div template="ngFor let subitem of item">' + '<div template="ngFor let subitem of item">' +
@ -231,7 +231,7 @@ export function main() {
})); }));
it('should repeat over nested arrays with no intermediate element', it('should repeat over nested arrays with no intermediate element',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div><template ngFor let-item [ngForOf]="items">' + var template = '<div><template ngFor let-item [ngForOf]="items">' +
'<div template="ngFor let subitem of item">' + '<div template="ngFor let subitem of item">' +
'{{subitem}}-{{item.length}};' + '{{subitem}}-{{item.length}};' +
@ -252,7 +252,7 @@ export function main() {
})); }));
it('should repeat over nested ngIf that are the last node in the ngFor temlate', it('should repeat over nested ngIf that are the last node in the ngFor temlate',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
`<div><template ngFor let-item [ngForOf]="items" let-i="index"><div>{{i}}|</div>` + `<div><template ngFor let-item [ngForOf]="items" let-i="index"><div>{{i}}|</div>` +
`<div *ngIf="i % 2 == 0">even|</div></template></div>`; `<div *ngIf="i % 2 == 0">even|</div></template></div>`;
@ -279,7 +279,7 @@ export function main() {
})); }));
it('should display indices correctly', it('should display indices correctly',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div><copy-me template="ngFor: let item of items; let i=index">{{i.toString()}}</copy-me></div>'; '<div><copy-me template="ngFor: let item of items; let i=index">{{i.toString()}}</copy-me></div>';
@ -298,7 +298,7 @@ export function main() {
})); }));
it('should display first item correctly', it('should display first item correctly',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div><copy-me template="ngFor: let item of items; let isFirst=first">{{isFirst.toString()}}</copy-me></div>'; '<div><copy-me template="ngFor: let item of items; let isFirst=first">{{isFirst.toString()}}</copy-me></div>';
@ -317,7 +317,7 @@ export function main() {
})); }));
it('should display last item correctly', it('should display last item correctly',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div><copy-me template="ngFor: let item of items; let isLast=last">{{isLast.toString()}}</copy-me></div>'; '<div><copy-me template="ngFor: let item of items; let isLast=last">{{isLast.toString()}}</copy-me></div>';
@ -336,7 +336,7 @@ export function main() {
})); }));
it('should display even items correctly', it('should display even items correctly',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div><copy-me template="ngFor: let item of items; let isEven=even">{{isEven.toString()}}</copy-me></div>'; '<div><copy-me template="ngFor: let item of items; let isEven=even">{{isEven.toString()}}</copy-me></div>';
@ -355,7 +355,7 @@ export function main() {
})); }));
it('should display odd items correctly', it('should display odd items correctly',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div><copy-me template="ngFor: let item of items; let isOdd=odd">{{isOdd.toString()}}</copy-me></div>'; '<div><copy-me template="ngFor: let item of items; let isOdd=odd">{{isOdd.toString()}}</copy-me></div>';
@ -374,7 +374,7 @@ export function main() {
})); }));
it('should allow to use a custom template', it('should allow to use a custom template',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate( tcb.overrideTemplate(
TestComponent, TestComponent,
'<ul><template ngFor [ngForOf]="items" [ngForTemplate]="contentTpl"></template></ul>') '<ul><template ngFor [ngForOf]="items" [ngForTemplate]="contentTpl"></template></ul>')
@ -393,7 +393,7 @@ export function main() {
})); }));
it('should use a default template if a custom one is null', it('should use a default template if a custom one is null',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items" tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items"
[ngForTemplate]="contentTpl" let-i="index">{{i}}: {{item}};</template></ul>`) [ngForTemplate]="contentTpl" let-i="index">{{i}}: {{item}};</template></ul>`)
.overrideTemplate(ComponentUsingTestComponent, '<test-cmp></test-cmp>') .overrideTemplate(ComponentUsingTestComponent, '<test-cmp></test-cmp>')
@ -409,7 +409,7 @@ export function main() {
})); }));
it('should use a custom template when both default and a custom one are present', it('should use a custom template when both default and a custom one are present',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items" tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items"
[ngForTemplate]="contentTpl" let-i="index">{{i}}=> {{item}};</template></ul>`) [ngForTemplate]="contentTpl" let-i="index">{{i}}=> {{item}};</template></ul>`)
.overrideTemplate( .overrideTemplate(
@ -428,7 +428,7 @@ export function main() {
describe('track by', function() { describe('track by', function() {
it('should not replace tracked items', it('should not replace tracked items',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
`<template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById" let-i="index"> `<template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById" let-i="index">
<p>{{items[i]}}</p> <p>{{items[i]}}</p>
@ -450,7 +450,7 @@ export function main() {
}); });
})); }));
it('should update implicit local variable on view', it('should update implicit local variable on view',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`; `<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -466,7 +466,7 @@ export function main() {
}); });
})); }));
it('should move items around and keep them updated ', it('should move items around and keep them updated ',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`; `<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -485,7 +485,7 @@ export function main() {
})); }));
it('should handle added and removed items properly when tracking by index', it('should handle added and removed items properly when tracking by index',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackByIndex">{{item}}</template></div>`; `<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackByIndex">{{item}}</template></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)

View File

@ -21,7 +21,7 @@ import {IS_DART} from '../../src/facade/lang';
export function main() { export function main() {
describe('ngIf directive', () => { describe('ngIf directive', () => {
it('should work in a template attribute', it('should work in a template attribute',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>'; var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>';
tcb.overrideTemplate(TestComponent, html) tcb.overrideTemplate(TestComponent, html)
@ -37,7 +37,7 @@ export function main() {
})); }));
it('should work in a template element', it('should work in a template element',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = var html =
'<div><template [ngIf]="booleanCondition"><copy-me>hello2</copy-me></template></div>'; '<div><template [ngIf]="booleanCondition"><copy-me>hello2</copy-me></template></div>';
@ -54,7 +54,7 @@ export function main() {
})); }));
it('should toggle node when condition changes', it('should toggle node when condition changes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>'; var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>';
tcb.overrideTemplate(TestComponent, html) tcb.overrideTemplate(TestComponent, html)
@ -86,7 +86,7 @@ export function main() {
})); }));
it('should handle nested if correctly', it('should handle nested if correctly',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = var html =
'<div><template [ngIf]="booleanCondition"><copy-me *ngIf="nestedBooleanCondition">hello</copy-me></template></div>'; '<div><template [ngIf]="booleanCondition"><copy-me *ngIf="nestedBooleanCondition">hello</copy-me></template></div>';
@ -133,7 +133,7 @@ export function main() {
})); }));
it('should update several nodes with if', it('should update several nodes with if',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = var html =
'<div>' + '<div>' +
'<copy-me template="ngIf numberCondition + 1 >= 2">helloNumber</copy-me>' + '<copy-me template="ngIf numberCondition + 1 >= 2">helloNumber</copy-me>' +
@ -172,7 +172,7 @@ export function main() {
if (!IS_DART) { if (!IS_DART) {
it('should not add the element twice if the condition goes from true to true (JS)', it('should not add the element twice if the condition goes from true to true (JS)',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>'; var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
tcb.overrideTemplate(TestComponent, html) tcb.overrideTemplate(TestComponent, html)
@ -198,7 +198,7 @@ export function main() {
})); }));
it('should not recreate the element if the condition goes from true to true (JS)', it('should not recreate the element if the condition goes from true to true (JS)',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>'; var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
tcb.overrideTemplate(TestComponent, html) tcb.overrideTemplate(TestComponent, html)
@ -222,7 +222,7 @@ export function main() {
if (IS_DART) { if (IS_DART) {
it('should not create the element if the condition is not a boolean (DART)', it('should not create the element if the condition is not a boolean (DART)',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>'; var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
tcb.overrideTemplate(TestComponent, html) tcb.overrideTemplate(TestComponent, html)

View File

@ -20,7 +20,7 @@ export function main() {
beforeEachProviders(() => [{provide: NgLocalization, useClass: TestLocalizationMap}]); beforeEachProviders(() => [{provide: NgLocalization, useClass: TestLocalizationMap}]);
it('should display the template according to the exact value', it('should display the template according to the exact value',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div>' + var template = '<div>' +
'<ul [ngPlural]="switchValue">' + '<ul [ngPlural]="switchValue">' +
'<template ngPluralCase="=0"><li>you have no messages.</li></template>' + '<template ngPluralCase="=0"><li>you have no messages.</li></template>' +
@ -43,7 +43,7 @@ export function main() {
})); }));
it('should display the template according to the category', it('should display the template according to the category',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div>' + '<div>' +
'<ul [ngPlural]="switchValue">' + '<ul [ngPlural]="switchValue">' +
@ -67,7 +67,7 @@ export function main() {
})); }));
it('should default to other when no matches are found', it('should default to other when no matches are found',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div>' + '<div>' +
'<ul [ngPlural]="switchValue">' + '<ul [ngPlural]="switchValue">' +
@ -87,7 +87,7 @@ export function main() {
})); }));
it('should prioritize value matches over category matches', it('should prioritize value matches over category matches',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div>' + '<div>' +
'<ul [ngPlural]="switchValue">' + '<ul [ngPlural]="switchValue">' +

View File

@ -24,7 +24,7 @@ export function main() {
describe('binding to CSS styles', () => { describe('binding to CSS styles', () => {
it('should add styles specified in an object literal', it('should add styles specified in an object literal',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngStyle]="{'max-width': '40px'}"></div>`; var template = `<div [ngStyle]="{'max-width': '40px'}"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -40,7 +40,7 @@ export function main() {
})); }));
it('should add and change styles specified in an object expression', it('should add and change styles specified in an object expression',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngStyle]="expr"></div>`; var template = `<div [ngStyle]="expr"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -66,7 +66,7 @@ export function main() {
})); }));
it('should remove styles when deleting a key in an object expression', it('should remove styles when deleting a key in an object expression',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [ngStyle]="expr"></div>`; var template = `<div [ngStyle]="expr"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -89,7 +89,7 @@ export function main() {
})); }));
it('should co-operate with the style attribute', it('should co-operate with the style attribute',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div style="font-size: 12px" [ngStyle]="expr"></div>`; var template = `<div style="font-size: 12px" [ngStyle]="expr"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -118,7 +118,7 @@ export function main() {
})); }));
it('should co-operate with the style.[styleName]="expr" special-case in the compiler', it('should co-operate with the style.[styleName]="expr" special-case in the compiler',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<div [style.font-size.px]="12" [ngStyle]="expr"></div>`; var template = `<div [style.font-size.px]="12" [ngStyle]="expr"></div>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)

View File

@ -18,7 +18,7 @@ export function main() {
describe('switch', () => { describe('switch', () => {
describe('switch value changes', () => { describe('switch value changes', () => {
it('should switch amongst when values', it('should switch amongst when values',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div>' + var template = '<div>' +
'<ul [ngSwitch]="switchValue">' + '<ul [ngSwitch]="switchValue">' +
'<template ngSwitchWhen="a"><li>when a</li></template>' + '<template ngSwitchWhen="a"><li>when a</li></template>' +
@ -44,7 +44,7 @@ export function main() {
})); }));
it('should switch amongst when values with fallback to default', it('should switch amongst when values with fallback to default',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div>' + var template = '<div>' +
'<ul [ngSwitch]="switchValue">' + '<ul [ngSwitch]="switchValue">' +
'<li template="ngSwitchWhen \'a\'">when a</li>' + '<li template="ngSwitchWhen \'a\'">when a</li>' +
@ -70,7 +70,7 @@ export function main() {
})); }));
it('should support multiple whens with the same value', it('should support multiple whens with the same value',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div>' + var template = '<div>' +
'<ul [ngSwitch]="switchValue">' + '<ul [ngSwitch]="switchValue">' +
'<template ngSwitchWhen="a"><li>when a1;</li></template>' + '<template ngSwitchWhen="a"><li>when a1;</li></template>' +
@ -103,7 +103,7 @@ export function main() {
describe('when values changes', () => { describe('when values changes', () => {
it('should switch amongst when values', it('should switch amongst when values',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div>' + var template = '<div>' +
'<ul [ngSwitch]="switchValue">' + '<ul [ngSwitch]="switchValue">' +
'<template [ngSwitchWhen]="when1"><li>when 1;</li></template>' + '<template [ngSwitchWhen]="when1"><li>when 1;</li></template>' +

View File

@ -16,7 +16,7 @@ import {NgTemplateOutlet} from '@angular/common';
export function main() { export function main() {
describe('insert', () => { describe('insert', () => {
it('should do nothing if templateRef is null', it('should do nothing if templateRef is null',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<template [ngTemplateOutlet]="null"></template>`; var template = `<template [ngTemplateOutlet]="null"></template>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent) .createAsync(TestComponent)
@ -30,7 +30,7 @@ export function main() {
})); }));
it('should insert content specified by TemplateRef', it('should insert content specified by TemplateRef',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`; `<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -51,7 +51,7 @@ export function main() {
})); }));
it('should clear content if TemplateRef becomes null', it('should clear content if TemplateRef becomes null',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`; `<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
@ -74,7 +74,7 @@ export function main() {
})); }));
it('should swap content if TemplateRef changes', it('should swap content if TemplateRef changes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<tpl-refs #refs="tplRefs"><template>foo</template><template>bar</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`; var template = `<tpl-refs #refs="tplRefs"><template>foo</template><template>bar</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent) .createAsync(TestComponent)

View File

@ -17,7 +17,7 @@ import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
export function main() { export function main() {
describe('non-bindable', () => { describe('non-bindable', () => {
it('should not interpolate children', it('should not interpolate children',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div>{{text}}<span ngNonBindable>{{text}}</span></div>'; var template = '<div>{{text}}<span ngNonBindable>{{text}}</span></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent) .createAsync(TestComponent)
@ -29,7 +29,7 @@ export function main() {
})); }));
it('should ignore directives on child nodes', it('should ignore directives on child nodes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div ngNonBindable><span id=child test-dec>{{text}}</span></div>'; var template = '<div ngNonBindable><span id=child test-dec>{{text}}</span></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent) .createAsync(TestComponent)
@ -45,7 +45,7 @@ export function main() {
})); }));
it('should trigger directives on the same node', it('should trigger directives on the same node',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = '<div><span id=child ngNonBindable test-dec>{{text}}</span></div>'; var template = '<div><span id=child ngNonBindable test-dec>{{text}}</span></div>';
tcb.overrideTemplate(TestComponent, template) tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent) .createAsync(TestComponent)

View File

@ -41,7 +41,7 @@ export function main() {
describe("integration tests", () => { describe("integration tests", () => {
it("should initialize DOM elements with the given form object", it("should initialize DOM elements with the given form object",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="login"> <input type="text" ngControl="login">
</div>`; </div>`;
@ -60,7 +60,7 @@ export function main() {
})); }));
it("should throw if a form isn't passed into ngFormModel", it("should throw if a form isn't passed into ngFormModel",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="login"> <input type="text" ngControl="login">
</div>`; </div>`;
@ -75,7 +75,7 @@ export function main() {
})); }));
it("should update the control group values on DOM change", it("should update the control group values on DOM change",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"login": new Control("oldValue")}); var form = new ControlGroup({"login": new Control("oldValue")});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
@ -98,7 +98,7 @@ export function main() {
})); }));
it("should ignore the change event for <input type=text>", it("should ignore the change event for <input type=text>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"login": new Control("oldValue")}); var form = new ControlGroup({"login": new Control("oldValue")});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
@ -194,7 +194,7 @@ export function main() {
}))); })));
it("should work with single controls", it("should work with single controls",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var control = new Control("loginValue"); var control = new Control("loginValue");
var t = `<div><input type="text" [ngFormControl]="form"></div>`; var t = `<div><input type="text" [ngFormControl]="form"></div>`;
@ -217,7 +217,7 @@ export function main() {
})); }));
it("should update DOM elements when rebinding the control group", it("should update DOM elements when rebinding the control group",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="login"> <input type="text" ngControl="login">
</div>`; </div>`;
@ -240,7 +240,7 @@ export function main() {
})); }));
it("should update DOM elements when updating the value of a control", it("should update DOM elements when updating the value of a control",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var login = new Control("oldValue"); var login = new Control("oldValue");
var form = new ControlGroup({"login": login}); var form = new ControlGroup({"login": login});
@ -265,7 +265,7 @@ export function main() {
})); }));
it("should mark controls as touched after interacting with the DOM control", it("should mark controls as touched after interacting with the DOM control",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var login = new Control("oldValue"); var login = new Control("oldValue");
var form = new ControlGroup({"login": login}); var form = new ControlGroup({"login": login});
@ -292,7 +292,7 @@ export function main() {
describe("different control types", () => { describe("different control types", () => {
it("should support <input type=text>", it("should support <input type=text>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="text"> <input type="text" ngControl="text">
</div>`; </div>`;
@ -316,7 +316,7 @@ export function main() {
})); }));
it("should support <input> without type", it("should support <input> without type",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input ngControl="text"> <input ngControl="text">
</div>`; </div>`;
@ -339,7 +339,7 @@ export function main() {
})); }));
it("should support <textarea>", it("should support <textarea>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<textarea ngControl="text"></textarea> <textarea ngControl="text"></textarea>
</div>`; </div>`;
@ -363,7 +363,7 @@ export function main() {
})); }));
it("should support <type=checkbox>", it("should support <type=checkbox>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="checkbox" ngControl="checkbox"> <input type="checkbox" ngControl="checkbox">
</div>`; </div>`;
@ -388,7 +388,7 @@ export function main() {
})); }));
it("should support <type=number>", it("should support <type=number>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="number" ngControl="num"> <input type="number" ngControl="num">
</div>`; </div>`;
@ -412,7 +412,7 @@ export function main() {
})); }));
it("should support <type=number> when value is cleared in the UI", it("should support <type=number> when value is cleared in the UI",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="number" ngControl="num" required> <input type="number" ngControl="num" required>
</div>`; </div>`;
@ -442,7 +442,7 @@ export function main() {
it("should support <type=number> when value is cleared programmatically", it("should support <type=number> when value is cleared programmatically",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"num": new Control(10)}); var form = new ControlGroup({"num": new Control(10)});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="number" ngControl="num" [(ngModel)]="data"> <input type="number" ngControl="num" [(ngModel)]="data">
@ -463,7 +463,7 @@ export function main() {
})); }));
it("should support <type=radio>", it("should support <type=radio>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<form [ngFormModel]="form"> var t = `<form [ngFormModel]="form">
<input type="radio" ngControl="foodChicken" name="food"> <input type="radio" ngControl="foodChicken" name="food">
<input type="radio" ngControl="foodFish" name="food"> <input type="radio" ngControl="foodFish" name="food">
@ -494,7 +494,7 @@ export function main() {
describe("should support <select>", () => { describe("should support <select>", () => {
it("with basic selection", it("with basic selection",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<select> var t = `<select>
<option value="SF"></option> <option value="SF"></option>
<option value="NYC"></option> <option value="NYC"></option>
@ -516,7 +516,7 @@ export function main() {
it("with basic selection and value bindings", it("with basic selection and value bindings",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<select> var t = `<select>
<option *ngFor="let city of list" [value]="city['id']"> <option *ngFor="let city of list" [value]="city['id']">
{{ city['name'] }} {{ city['name'] }}
@ -542,7 +542,7 @@ export function main() {
it("with ngControl", it("with ngControl",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<select ngControl="city"> <select ngControl="city">
<option value="SF"></option> <option value="SF"></option>
@ -601,7 +601,7 @@ export function main() {
it("with option values that are objects", it("with option values that are objects",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -635,7 +635,7 @@ export function main() {
it("when new options are added (selection through the model)", it("when new options are added (selection through the model)",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -665,7 +665,7 @@ export function main() {
it("when new options are added (selection through the UI)", it("when new options are added (selection through the UI)",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -698,7 +698,7 @@ export function main() {
it("when options are removed", it("when options are removed",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
@ -726,7 +726,7 @@ export function main() {
it("when option values change identity while tracking by index", it("when option values change identity while tracking by index",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option> <option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option>
@ -758,7 +758,7 @@ export function main() {
it("with duplicate option values", it("with duplicate option values",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
@ -789,7 +789,7 @@ export function main() {
it("when option values have same content, but different identities", it("when option values have same content, but different identities",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -819,7 +819,7 @@ export function main() {
}); });
it("should support custom value accessors", it("should support custom value accessors",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="name" wrapped-value> <input type="text" ngControl="name" wrapped-value>
</div>`; </div>`;
@ -842,7 +842,7 @@ export function main() {
})); }));
it("should support custom value accessors on non builtin input elements that fire a change event without a 'target' property", it("should support custom value accessors on non builtin input elements that fire a change event without a 'target' property",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<my-input ngControl="name"></my-input> <my-input ngControl="name"></my-input>
</div>`; </div>`;
@ -870,7 +870,7 @@ export function main() {
describe("validations", () => { describe("validations", () => {
it("should use sync validators defined in html", it("should use sync validators defined in html",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup( var form = new ControlGroup(
{"login": new Control(""), "min": new Control(""), "max": new Control("")}); {"login": new Control(""), "min": new Control(""), "max": new Control("")});
@ -946,7 +946,7 @@ export function main() {
}))); })));
it("should use sync validators defined in the model", it("should use sync validators defined in the model",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"login": new Control("aa", Validators.required)}); var form = new ControlGroup({"login": new Control("aa", Validators.required)});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
@ -1007,7 +1007,7 @@ export function main() {
describe("nested forms", () => { describe("nested forms", () => {
it("should init DOM with the given form object", it("should init DOM with the given form object",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = var form =
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})}); new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
@ -1030,7 +1030,7 @@ export function main() {
})); }));
it("should update the control group values on DOM change", it("should update the control group values on DOM change",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = var form =
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})}); new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
@ -1141,7 +1141,7 @@ export function main() {
}))); })));
it("should not create a template-driven form when ngNoForm is used", it("should not create a template-driven form when ngNoForm is used",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<form ngNoForm> var t = `<form ngNoForm>
</form>`; </form>`;
@ -1322,7 +1322,7 @@ export function main() {
describe("setting status classes", () => { describe("setting status classes", () => {
it("should work with single fields", it("should work with single fields",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new Control("", Validators.required); var form = new Control("", Validators.required);
var t = `<div><input type="text" [ngFormControl]="form"></div>`; var t = `<div><input type="text" [ngFormControl]="form"></div>`;
@ -1353,7 +1353,7 @@ export function main() {
})); }));
it("should work with complex model-driven forms", it("should work with complex model-driven forms",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"name": new Control("", Validators.required)}); var form = new ControlGroup({"name": new Control("", Validators.required)});
var t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`; var t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`;
@ -1384,7 +1384,7 @@ export function main() {
})); }));
it("should work with ngModel", it("should work with ngModel",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div><input [(ngModel)]="name" required></div>`; var t = `<div><input [(ngModel)]="name" required></div>`;
tcb.overrideTemplate(MyComp8, t) tcb.overrideTemplate(MyComp8, t)

View File

@ -202,7 +202,7 @@ export function main() {
beforeEach(() => { c = new Control("old", Validators.required); }); beforeEach(() => { c = new Control("old", Validators.required); });
it("should fire an event after the value has been updated", it("should fire an event after the value has been updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(c.valueChanges, (value) => { ObservableWrapper.subscribe(c.valueChanges, (value) => {
expect(c.value).toEqual('new'); expect(c.value).toEqual('new');
expect(value).toEqual('new'); expect(value).toEqual('new');
@ -253,7 +253,7 @@ export function main() {
// TODO: remove the if statement after making observable delivery sync // TODO: remove the if statement after making observable delivery sync
if (!IS_DART) { if (!IS_DART) {
it("should update set errors and status before emitting an event", it("should update set errors and status before emitting an event",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
c.valueChanges.subscribe((value: any /** TODO #9100 */) => { c.valueChanges.subscribe((value: any /** TODO #9100 */) => {
expect(c.valid).toEqual(false); expect(c.valid).toEqual(false);
expect(c.errors).toEqual({"required": true}); expect(c.errors).toEqual({"required": true});
@ -263,7 +263,7 @@ export function main() {
})); }));
} }
it("should return a cold observable", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should return a cold observable", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
c.updateValue("will be ignored"); c.updateValue("will be ignored");
ObservableWrapper.subscribe(c.valueChanges, (value) => { ObservableWrapper.subscribe(c.valueChanges, (value) => {
expect(value).toEqual('new'); expect(value).toEqual('new');
@ -482,7 +482,7 @@ export function main() {
}); });
it("should fire an event after the value has been updated", it("should fire an event after the value has been updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
expect(g.value).toEqual({'one': 'new1', 'two': 'old2'}); expect(g.value).toEqual({'one': 'new1', 'two': 'old2'});
expect(value).toEqual({'one': 'new1', 'two': 'old2'}); expect(value).toEqual({'one': 'new1', 'two': 'old2'});
@ -492,7 +492,7 @@ export function main() {
})); }));
it("should fire an event after the control's observable fired an event", it("should fire an event after the control's observable fired an event",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var controlCallbackIsCalled = false; var controlCallbackIsCalled = false;
ObservableWrapper.subscribe(c1.valueChanges, ObservableWrapper.subscribe(c1.valueChanges,
@ -507,7 +507,7 @@ export function main() {
})); }));
it("should fire an event when a control is excluded", it("should fire an event when a control is excluded",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
expect(value).toEqual({'one': 'old1'}); expect(value).toEqual({'one': 'old1'});
async.done(); async.done();
@ -517,7 +517,7 @@ export function main() {
})); }));
it("should fire an event when a control is included", it("should fire an event when a control is included",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
g.exclude("two"); g.exclude("two");
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
@ -529,7 +529,7 @@ export function main() {
})); }));
it("should fire an event every time a control is updated", it("should fire an event every time a control is updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var loggedValues: any[] /** TODO #9100 */ = []; var loggedValues: any[] /** TODO #9100 */ = [];
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
@ -547,7 +547,7 @@ export function main() {
})); }));
xit("should not fire an event when an excluded control is updated", xit("should not fire an event when an excluded control is updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
// hard to test without hacking zones // hard to test without hacking zones
})); }));
}); });
@ -734,7 +734,7 @@ export function main() {
}); });
it("should fire an event after the value has been updated", it("should fire an event after the value has been updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(a.valueChanges, (value) => { ObservableWrapper.subscribe(a.valueChanges, (value) => {
expect(a.value).toEqual(['new1', 'old2']); expect(a.value).toEqual(['new1', 'old2']);
expect(value).toEqual(['new1', 'old2']); expect(value).toEqual(['new1', 'old2']);
@ -744,7 +744,7 @@ export function main() {
})); }));
it("should fire an event after the control's observable fired an event", it("should fire an event after the control's observable fired an event",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var controlCallbackIsCalled = false; var controlCallbackIsCalled = false;
ObservableWrapper.subscribe(c1.valueChanges, ObservableWrapper.subscribe(c1.valueChanges,
@ -759,7 +759,7 @@ export function main() {
})); }));
it("should fire an event when a control is removed", it("should fire an event when a control is removed",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(a.valueChanges, (value) => { ObservableWrapper.subscribe(a.valueChanges, (value) => {
expect(value).toEqual(['old1']); expect(value).toEqual(['old1']);
async.done(); async.done();
@ -768,7 +768,7 @@ export function main() {
a.removeAt(1); a.removeAt(1);
})); }));
it("should fire an event when a control is added", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should fire an event when a control is added", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
a.removeAt(1); a.removeAt(1);
ObservableWrapper.subscribe(a.valueChanges, (value) => { ObservableWrapper.subscribe(a.valueChanges, (value) => {

View File

@ -41,7 +41,7 @@ export function main() {
describe("integration tests", () => { describe("integration tests", () => {
it("should initialize DOM elements with the given form object", it("should initialize DOM elements with the given form object",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="login"> <input type="text" ngControl="login">
</div>`; </div>`;
@ -60,7 +60,7 @@ export function main() {
})); }));
it("should throw if a form isn't passed into ngFormModel", it("should throw if a form isn't passed into ngFormModel",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="login"> <input type="text" ngControl="login">
</div>`; </div>`;
@ -75,7 +75,7 @@ export function main() {
})); }));
it("should update the control group values on DOM change", it("should update the control group values on DOM change",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"login": new Control("oldValue")}); var form = new ControlGroup({"login": new Control("oldValue")});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
@ -98,7 +98,7 @@ export function main() {
})); }));
it("should ignore the change event for <input type=text>", it("should ignore the change event for <input type=text>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"login": new Control("oldValue")}); var form = new ControlGroup({"login": new Control("oldValue")});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
@ -194,7 +194,7 @@ export function main() {
}))); })));
it("should work with single controls", it("should work with single controls",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var control = new Control("loginValue"); var control = new Control("loginValue");
var t = `<div><input type="text" [ngFormControl]="form"></div>`; var t = `<div><input type="text" [ngFormControl]="form"></div>`;
@ -217,7 +217,7 @@ export function main() {
})); }));
it("should update DOM elements when rebinding the control group", it("should update DOM elements when rebinding the control group",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="login"> <input type="text" ngControl="login">
</div>`; </div>`;
@ -240,7 +240,7 @@ export function main() {
})); }));
it("should update DOM elements when updating the value of a control", it("should update DOM elements when updating the value of a control",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var login = new Control("oldValue"); var login = new Control("oldValue");
var form = new ControlGroup({"login": login}); var form = new ControlGroup({"login": login});
@ -265,7 +265,7 @@ export function main() {
})); }));
it("should mark controls as touched after interacting with the DOM control", it("should mark controls as touched after interacting with the DOM control",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var login = new Control("oldValue"); var login = new Control("oldValue");
var form = new ControlGroup({"login": login}); var form = new ControlGroup({"login": login});
@ -292,7 +292,7 @@ export function main() {
describe("different control types", () => { describe("different control types", () => {
it("should support <input type=text>", it("should support <input type=text>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="text"> <input type="text" ngControl="text">
</div>`; </div>`;
@ -316,7 +316,7 @@ export function main() {
})); }));
it("should support <input> without type", it("should support <input> without type",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input ngControl="text"> <input ngControl="text">
</div>`; </div>`;
@ -339,7 +339,7 @@ export function main() {
})); }));
it("should support <textarea>", it("should support <textarea>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<textarea ngControl="text"></textarea> <textarea ngControl="text"></textarea>
</div>`; </div>`;
@ -363,7 +363,7 @@ export function main() {
})); }));
it("should support <type=checkbox>", it("should support <type=checkbox>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="checkbox" ngControl="checkbox"> <input type="checkbox" ngControl="checkbox">
</div>`; </div>`;
@ -388,7 +388,7 @@ export function main() {
})); }));
it("should support <type=number>", it("should support <type=number>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="number" ngControl="num"> <input type="number" ngControl="num">
</div>`; </div>`;
@ -412,7 +412,7 @@ export function main() {
})); }));
it("should support <type=number> when value is cleared in the UI", it("should support <type=number> when value is cleared in the UI",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="number" ngControl="num" required> <input type="number" ngControl="num" required>
</div>`; </div>`;
@ -442,7 +442,7 @@ export function main() {
it("should support <type=number> when value is cleared programmatically", it("should support <type=number> when value is cleared programmatically",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"num": new Control(10)}); var form = new ControlGroup({"num": new Control(10)});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="number" ngControl="num" [(ngModel)]="data"> <input type="number" ngControl="num" [(ngModel)]="data">
@ -463,7 +463,7 @@ export function main() {
})); }));
it("should support <type=radio>", it("should support <type=radio>",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<form [ngFormModel]="form"> var t = `<form [ngFormModel]="form">
<input type="radio" ngControl="foodChicken" name="food"> <input type="radio" ngControl="foodChicken" name="food">
<input type="radio" ngControl="foodFish" name="food"> <input type="radio" ngControl="foodFish" name="food">
@ -494,7 +494,7 @@ export function main() {
describe("should support <select>", () => { describe("should support <select>", () => {
it("with basic selection", it("with basic selection",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<select> var t = `<select>
<option value="SF"></option> <option value="SF"></option>
<option value="NYC"></option> <option value="NYC"></option>
@ -516,7 +516,7 @@ export function main() {
it("with basic selection and value bindings", it("with basic selection and value bindings",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<select> var t = `<select>
<option *ngFor="let city of list" [value]="city['id']"> <option *ngFor="let city of list" [value]="city['id']">
{{ city['name'] }} {{ city['name'] }}
@ -542,7 +542,7 @@ export function main() {
it("with ngControl", it("with ngControl",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<select ngControl="city"> <select ngControl="city">
<option value="SF"></option> <option value="SF"></option>
@ -601,7 +601,7 @@ export function main() {
it("with option values that are objects", it("with option values that are objects",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -635,7 +635,7 @@ export function main() {
it("when new options are added (selection through the model)", it("when new options are added (selection through the model)",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -665,7 +665,7 @@ export function main() {
it("when new options are added (selection through the UI)", it("when new options are added (selection through the UI)",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -698,7 +698,7 @@ export function main() {
it("when options are removed", it("when options are removed",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
@ -726,7 +726,7 @@ export function main() {
it("when option values change identity while tracking by index", it("when option values change identity while tracking by index",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option> <option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option>
@ -758,7 +758,7 @@ export function main() {
it("with duplicate option values", it("with duplicate option values",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
@ -789,7 +789,7 @@ export function main() {
it("when option values have same content, but different identities", it("when option values have same content, but different identities",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div> var t = `<div>
<select [(ngModel)]="selectedCity"> <select [(ngModel)]="selectedCity">
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option> <option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
@ -819,7 +819,7 @@ export function main() {
}); });
it("should support custom value accessors", it("should support custom value accessors",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<input type="text" ngControl="name" wrapped-value> <input type="text" ngControl="name" wrapped-value>
</div>`; </div>`;
@ -842,7 +842,7 @@ export function main() {
})); }));
it("should support custom value accessors on non builtin input elements that fire a change event without a 'target' property", it("should support custom value accessors on non builtin input elements that fire a change event without a 'target' property",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
<my-input ngControl="name"></my-input> <my-input ngControl="name"></my-input>
</div>`; </div>`;
@ -870,7 +870,7 @@ export function main() {
describe("validations", () => { describe("validations", () => {
it("should use sync validators defined in html", it("should use sync validators defined in html",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup( var form = new ControlGroup(
{"login": new Control(""), "min": new Control(""), "max": new Control("")}); {"login": new Control(""), "min": new Control(""), "max": new Control("")});
@ -946,7 +946,7 @@ export function main() {
}))); })));
it("should use sync validators defined in the model", it("should use sync validators defined in the model",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"login": new Control("aa", Validators.required)}); var form = new ControlGroup({"login": new Control("aa", Validators.required)});
var t = `<div [ngFormModel]="form"> var t = `<div [ngFormModel]="form">
@ -1007,7 +1007,7 @@ export function main() {
describe("nested forms", () => { describe("nested forms", () => {
it("should init DOM with the given form object", it("should init DOM with the given form object",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = var form =
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})}); new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
@ -1030,7 +1030,7 @@ export function main() {
})); }));
it("should update the control group values on DOM change", it("should update the control group values on DOM change",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = var form =
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})}); new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
@ -1141,7 +1141,7 @@ export function main() {
}))); })));
it("should not create a template-driven form when ngNoForm is used", it("should not create a template-driven form when ngNoForm is used",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<form ngNoForm> var t = `<form ngNoForm>
</form>`; </form>`;
@ -1322,7 +1322,7 @@ export function main() {
describe("setting status classes", () => { describe("setting status classes", () => {
it("should work with single fields", it("should work with single fields",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new Control("", Validators.required); var form = new Control("", Validators.required);
var t = `<div><input type="text" [ngFormControl]="form"></div>`; var t = `<div><input type="text" [ngFormControl]="form"></div>`;
@ -1353,7 +1353,7 @@ export function main() {
})); }));
it("should work with complex model-driven forms", it("should work with complex model-driven forms",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var form = new ControlGroup({"name": new Control("", Validators.required)}); var form = new ControlGroup({"name": new Control("", Validators.required)});
var t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`; var t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`;
@ -1384,7 +1384,7 @@ export function main() {
})); }));
it("should work with ngModel", it("should work with ngModel",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var t = `<div><input [(ngModel)]="name" required></div>`; var t = `<div><input [(ngModel)]="name" required></div>`;
tcb.overrideTemplate(MyComp8, t) tcb.overrideTemplate(MyComp8, t)

View File

@ -202,7 +202,7 @@ export function main() {
beforeEach(() => { c = new Control("old", Validators.required); }); beforeEach(() => { c = new Control("old", Validators.required); });
it("should fire an event after the value has been updated", it("should fire an event after the value has been updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(c.valueChanges, (value) => { ObservableWrapper.subscribe(c.valueChanges, (value) => {
expect(c.value).toEqual('new'); expect(c.value).toEqual('new');
expect(value).toEqual('new'); expect(value).toEqual('new');
@ -253,7 +253,7 @@ export function main() {
// TODO: remove the if statement after making observable delivery sync // TODO: remove the if statement after making observable delivery sync
if (!IS_DART) { if (!IS_DART) {
it("should update set errors and status before emitting an event", it("should update set errors and status before emitting an event",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
c.valueChanges.subscribe((value: any /** TODO #9100 */) => { c.valueChanges.subscribe((value: any /** TODO #9100 */) => {
expect(c.valid).toEqual(false); expect(c.valid).toEqual(false);
expect(c.errors).toEqual({"required": true}); expect(c.errors).toEqual({"required": true});
@ -263,7 +263,7 @@ export function main() {
})); }));
} }
it("should return a cold observable", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should return a cold observable", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
c.updateValue("will be ignored"); c.updateValue("will be ignored");
ObservableWrapper.subscribe(c.valueChanges, (value) => { ObservableWrapper.subscribe(c.valueChanges, (value) => {
expect(value).toEqual('new'); expect(value).toEqual('new');
@ -482,7 +482,7 @@ export function main() {
}); });
it("should fire an event after the value has been updated", it("should fire an event after the value has been updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
expect(g.value).toEqual({'one': 'new1', 'two': 'old2'}); expect(g.value).toEqual({'one': 'new1', 'two': 'old2'});
expect(value).toEqual({'one': 'new1', 'two': 'old2'}); expect(value).toEqual({'one': 'new1', 'two': 'old2'});
@ -492,7 +492,7 @@ export function main() {
})); }));
it("should fire an event after the control's observable fired an event", it("should fire an event after the control's observable fired an event",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var controlCallbackIsCalled = false; var controlCallbackIsCalled = false;
ObservableWrapper.subscribe(c1.valueChanges, ObservableWrapper.subscribe(c1.valueChanges,
@ -507,7 +507,7 @@ export function main() {
})); }));
it("should fire an event when a control is excluded", it("should fire an event when a control is excluded",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
expect(value).toEqual({'one': 'old1'}); expect(value).toEqual({'one': 'old1'});
async.done(); async.done();
@ -517,7 +517,7 @@ export function main() {
})); }));
it("should fire an event when a control is included", it("should fire an event when a control is included",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
g.exclude("two"); g.exclude("two");
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
@ -529,7 +529,7 @@ export function main() {
})); }));
it("should fire an event every time a control is updated", it("should fire an event every time a control is updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var loggedValues: any[] /** TODO #9100 */ = []; var loggedValues: any[] /** TODO #9100 */ = [];
ObservableWrapper.subscribe(g.valueChanges, (value) => { ObservableWrapper.subscribe(g.valueChanges, (value) => {
@ -547,7 +547,7 @@ export function main() {
})); }));
xit("should not fire an event when an excluded control is updated", xit("should not fire an event when an excluded control is updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
// hard to test without hacking zones // hard to test without hacking zones
})); }));
}); });
@ -734,7 +734,7 @@ export function main() {
}); });
it("should fire an event after the value has been updated", it("should fire an event after the value has been updated",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(a.valueChanges, (value) => { ObservableWrapper.subscribe(a.valueChanges, (value) => {
expect(a.value).toEqual(['new1', 'old2']); expect(a.value).toEqual(['new1', 'old2']);
expect(value).toEqual(['new1', 'old2']); expect(value).toEqual(['new1', 'old2']);
@ -744,7 +744,7 @@ export function main() {
})); }));
it("should fire an event after the control's observable fired an event", it("should fire an event after the control's observable fired an event",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var controlCallbackIsCalled = false; var controlCallbackIsCalled = false;
ObservableWrapper.subscribe(c1.valueChanges, ObservableWrapper.subscribe(c1.valueChanges,
@ -759,7 +759,7 @@ export function main() {
})); }));
it("should fire an event when a control is removed", it("should fire an event when a control is removed",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(a.valueChanges, (value) => { ObservableWrapper.subscribe(a.valueChanges, (value) => {
expect(value).toEqual(['old1']); expect(value).toEqual(['old1']);
async.done(); async.done();
@ -768,7 +768,7 @@ export function main() {
a.removeAt(1); a.removeAt(1);
})); }));
it("should fire an event when a control is added", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should fire an event when a control is added", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
a.removeAt(1); a.removeAt(1);
ObservableWrapper.subscribe(a.valueChanges, (value) => { ObservableWrapper.subscribe(a.valueChanges, (value) => {

View File

@ -44,7 +44,7 @@ export function main() {
() => { expect(pipe.transform(emitter)).toBe(null); }); () => { expect(pipe.transform(emitter)).toBe(null); });
it("should return the latest available value wrapped", it("should return the latest available value wrapped",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(emitter); pipe.transform(emitter);
ObservableWrapper.callEmit(emitter, message); ObservableWrapper.callEmit(emitter, message);
@ -57,7 +57,7 @@ export function main() {
it("should return same value when nothing has changed since the last call", it("should return same value when nothing has changed since the last call",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(emitter); pipe.transform(emitter);
ObservableWrapper.callEmit(emitter, message); ObservableWrapper.callEmit(emitter, message);
@ -69,7 +69,7 @@ export function main() {
})); }));
it("should dispose of the existing subscription when subscribing to a new observable", it("should dispose of the existing subscription when subscribing to a new observable",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(emitter); pipe.transform(emitter);
var newEmitter = new EventEmitter(); var newEmitter = new EventEmitter();
@ -85,7 +85,7 @@ export function main() {
})); }));
it("should request a change detection check upon receiving a new value", it("should request a change detection check upon receiving a new value",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(emitter); pipe.transform(emitter);
ObservableWrapper.callEmit(emitter, message); ObservableWrapper.callEmit(emitter, message);
@ -100,7 +100,7 @@ export function main() {
it("should do nothing when no subscription", it("should do nothing when no subscription",
() => { expect(() => pipe.ngOnDestroy()).not.toThrow(); }); () => { expect(() => pipe.ngOnDestroy()).not.toThrow(); });
it("should dispose of the existing subscription", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should dispose of the existing subscription", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(emitter); pipe.transform(emitter);
pipe.ngOnDestroy(); pipe.ngOnDestroy();
@ -132,7 +132,7 @@ export function main() {
it("should return null when subscribing to a promise", it("should return null when subscribing to a promise",
() => { expect(pipe.transform(completer.promise)).toBe(null); }); () => { expect(pipe.transform(completer.promise)).toBe(null); });
it("should return the latest available value", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should return the latest available value", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(completer.promise); pipe.transform(completer.promise);
completer.resolve(message); completer.resolve(message);
@ -144,7 +144,7 @@ export function main() {
})); }));
it("should return unwrapped value when nothing has changed since the last call", it("should return unwrapped value when nothing has changed since the last call",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(completer.promise); pipe.transform(completer.promise);
completer.resolve(message); completer.resolve(message);
@ -156,7 +156,7 @@ export function main() {
})); }));
it("should dispose of the existing subscription when subscribing to a new promise", it("should dispose of the existing subscription when subscribing to a new promise",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(completer.promise); pipe.transform(completer.promise);
var newCompleter = PromiseWrapper.completer(); var newCompleter = PromiseWrapper.completer();
@ -172,7 +172,7 @@ export function main() {
})); }));
it("should request a change detection check upon receiving a new value", it("should request a change detection check upon receiving a new value",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var markForCheck = ref.spy('markForCheck'); var markForCheck = ref.spy('markForCheck');
pipe.transform(completer.promise); pipe.transform(completer.promise);
completer.resolve(message); completer.resolve(message);
@ -187,7 +187,7 @@ export function main() {
it("should do nothing when no source", it("should do nothing when no source",
() => { expect(() => pipe.ngOnDestroy()).not.toThrow(); }); () => { expect(() => pipe.ngOnDestroy()).not.toThrow(); });
it("should dispose of the existing source", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should dispose of the existing source", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
pipe.transform(completer.promise); pipe.transform(completer.promise);
expect(pipe.transform(completer.promise)).toBe(null); expect(pipe.transform(completer.promise)).toBe(null);
completer.resolve(message) completer.resolve(message)

View File

@ -53,7 +53,7 @@ export function main() {
describe('integration', () => { describe('integration', () => {
it('should work with mutable objects', it('should work with mutable objects',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(TestComp).then((fixture) => { tcb.createAsync(TestComp).then((fixture) => {
let mutable: number[] = [1]; let mutable: number[] = [1];
fixture.debugElement.componentInstance.data = mutable; fixture.debugElement.componentInstance.data = mutable;

View File

@ -95,7 +95,7 @@ export function main() {
describe('integration', () => { describe('integration', () => {
it('should work with mutable arrays', it('should work with mutable arrays',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(TestComp).then((fixture) => { tcb.createAsync(TestComp).then((fixture) => {
let mutable: number[] = [1, 2]; let mutable: number[] = [1, 2];
fixture.debugElement.componentInstance.data = mutable; fixture.debugElement.componentInstance.data = mutable;

View File

@ -36,7 +36,7 @@ export function main() {
describe('inline template', () => { describe('inline template', () => {
it('should store the template', it('should store the template',
inject([AsyncTestCompleter, DirectiveNormalizer], inject([AsyncTestCompleter, DirectiveNormalizer],
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => { (async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null, encapsulation: null,
template: 'a', template: 'a',
@ -53,7 +53,7 @@ export function main() {
it('should resolve styles on the annotation against the moduleUrl', it('should resolve styles on the annotation against the moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer], inject([AsyncTestCompleter, DirectiveNormalizer],
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => { (async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null, encapsulation: null,
template: '', template: '',
@ -69,7 +69,7 @@ export function main() {
it('should resolve styles in the template against the moduleUrl', it('should resolve styles in the template against the moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer], inject([AsyncTestCompleter, DirectiveNormalizer],
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => { (async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null, encapsulation: null,
template: '<style>@import test.css</style>', template: '<style>@import test.css</style>',
@ -85,7 +85,7 @@ export function main() {
it('should use ViewEncapsulation.Emulated by default', it('should use ViewEncapsulation.Emulated by default',
inject([AsyncTestCompleter, DirectiveNormalizer], inject([AsyncTestCompleter, DirectiveNormalizer],
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => { (async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null, encapsulation: null,
template: '', template: '',
@ -101,7 +101,7 @@ export function main() {
it('should use default encapsulation provided by CompilerConfig', it('should use default encapsulation provided by CompilerConfig',
inject([AsyncTestCompleter, CompilerConfig , DirectiveNormalizer], inject([AsyncTestCompleter, CompilerConfig , DirectiveNormalizer],
(async: any /** TODO #9100 */, config: CompilerConfig, normalizer: DirectiveNormalizer) => { (async: AsyncTestCompleter, config: CompilerConfig, normalizer: DirectiveNormalizer) => {
config.defaultEncapsulation = ViewEncapsulation.None; config.defaultEncapsulation = ViewEncapsulation.None;
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null, encapsulation: null,
@ -121,7 +121,7 @@ export function main() {
it('should load a template from a url that is resolved against moduleUrl', it('should load a template from a url that is resolved against moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer, XHR], inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => { (async: AsyncTestCompleter, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
xhr.expect('package:some/module/sometplurl.html', 'a'); xhr.expect('package:some/module/sometplurl.html', 'a');
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null, encapsulation: null,
@ -141,7 +141,7 @@ export function main() {
it('should resolve styles on the annotation against the moduleUrl', it('should resolve styles on the annotation against the moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer, XHR], inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => { (async: AsyncTestCompleter, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
xhr.expect('package:some/module/tpl/sometplurl.html', ''); xhr.expect('package:some/module/tpl/sometplurl.html', '');
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null, encapsulation: null,
@ -159,7 +159,7 @@ export function main() {
it('should resolve styles in the template against the templateUrl', it('should resolve styles in the template against the templateUrl',
inject([AsyncTestCompleter, DirectiveNormalizer, XHR], inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => { (async: AsyncTestCompleter, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
xhr.expect('package:some/module/tpl/sometplurl.html', xhr.expect('package:some/module/tpl/sometplurl.html',
'<style>@import test.css</style>'); '<style>@import test.css</style>');
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({ normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({

View File

@ -43,7 +43,7 @@ export function main() {
var injector: Injector; var injector: Injector;
var sharedStylesHost: SharedStylesHost; var sharedStylesHost: SharedStylesHost;
beforeEach(inject([Injector, SharedStylesHost], (_injector: any /** TODO #9100 */, _sharedStylesHost: any /** TODO #9100 */) => { beforeEach(inject([Injector, SharedStylesHost], (_injector: Injector, _sharedStylesHost: SharedStylesHost) => {
injector = _injector; injector = _injector;
sharedStylesHost = _sharedStylesHost; sharedStylesHost = _sharedStylesHost;
})); }));

View File

@ -82,7 +82,7 @@ export function main() {
console = new ArrayConsole(); console = new ArrayConsole();
return [{provide: Console, useValue: console}]; return [{provide: Console, useValue: console}];
}); });
beforeEach(inject([TemplateParser], (parser: any /** TODO #9100 */) => { beforeEach(inject([TemplateParser], (parser: TemplateParser) => {
var component = CompileDirectiveMetadata.create({ var component = CompileDirectiveMetadata.create({
selector: 'root', selector: 'root',
type: new CompileTypeMetadata({moduleUrl: someModuleUrl, name: 'Root'}), type: new CompileTypeMetadata({moduleUrl: someModuleUrl, name: 'Root'}),

View File

@ -192,7 +192,7 @@ class DirectiveListComp {
export function main() { export function main() {
describe('test component builder', function() { describe('test component builder', function() {
it('should instantiate a component with valid DOM', it('should instantiate a component with valid DOM',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(ChildComp).then((componentFixture) => { tcb.createAsync(ChildComp).then((componentFixture) => {
componentFixture.detectChanges(); componentFixture.detectChanges();
@ -203,7 +203,7 @@ export function main() {
})); }));
it('should allow changing members of the component', it('should allow changing members of the component',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(MyIfComp).then((componentFixture) => { tcb.createAsync(MyIfComp).then((componentFixture) => {
componentFixture.detectChanges(); componentFixture.detectChanges();
@ -218,7 +218,7 @@ export function main() {
})); }));
it('should override a template', it('should override a template',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideTemplate(MockChildComp, '<span>Mock</span>') tcb.overrideTemplate(MockChildComp, '<span>Mock</span>')
.createAsync(MockChildComp) .createAsync(MockChildComp)
@ -231,7 +231,7 @@ export function main() {
})); }));
it('should override a view', it('should override a view',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(ChildComp, tcb.overrideView(ChildComp,
new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'})) new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
@ -245,7 +245,7 @@ export function main() {
})); }));
it('should override component dependencies', it('should override component dependencies',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideDirective(ParentComp, ChildComp, MockChildComp) tcb.overrideDirective(ParentComp, ChildComp, MockChildComp)
.createAsync(ParentComp) .createAsync(ParentComp)
@ -258,7 +258,7 @@ export function main() {
})); }));
it('should override items from a list', it('should override items from a list',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideDirective(DirectiveListComp, ListDir1, ListDir1Alt) tcb.overrideDirective(DirectiveListComp, ListDir1, ListDir1Alt)
.createAsync(DirectiveListComp) .createAsync(DirectiveListComp)
@ -271,7 +271,7 @@ export function main() {
})); }));
it("should override child component's dependencies", it("should override child component's dependencies",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp) tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
.overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp) .overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp)
@ -286,7 +286,7 @@ export function main() {
})); }));
it('should override a provider', it('should override a provider',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideProviders(TestBindingsComp, tcb.overrideProviders(TestBindingsComp,
[{provide: FancyService, useClass: MockFancyService}]) [{provide: FancyService, useClass: MockFancyService}])
@ -301,7 +301,7 @@ export function main() {
it('should override a viewBinding', it('should override a viewBinding',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideViewProviders(TestViewBindingsComp, tcb.overrideViewProviders(TestViewBindingsComp,
[{provide: FancyService, useClass: MockFancyService}]) [{provide: FancyService, useClass: MockFancyService}])
@ -318,7 +318,7 @@ export function main() {
describe('ComponentFixture', () => { describe('ComponentFixture', () => {
it('should auto detect changes if autoDetectChanges is called', it('should auto detect changes if autoDetectChanges is called',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AutoDetectComp) tcb.createAsync(AutoDetectComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -338,7 +338,7 @@ export function main() {
it('should auto detect changes if ComponentFixtureAutoDetect is provided as true', it('should auto detect changes if ComponentFixtureAutoDetect is provided as true',
withProviders(() => [{provide: ComponentFixtureAutoDetect, useValue: true}]) withProviders(() => [{provide: ComponentFixtureAutoDetect, useValue: true}])
.inject([TestComponentBuilder, AsyncTestCompleter], .inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AutoDetectComp) tcb.createAsync(AutoDetectComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -354,7 +354,7 @@ export function main() {
it('should signal through whenStable when the fixture is stable (autoDetectChanges)', it('should signal through whenStable when the fixture is stable (autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AsyncComp).then((componentFixture) => { tcb.createAsync(AsyncComp).then((componentFixture) => {
componentFixture.autoDetectChanges(); componentFixture.autoDetectChanges();
@ -377,7 +377,7 @@ export function main() {
it('should signal through isStable when the fixture is stable (no autoDetectChanges)', it('should signal through isStable when the fixture is stable (no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AsyncComp).then((componentFixture) => { tcb.createAsync(AsyncComp).then((componentFixture) => {
componentFixture.detectChanges(); componentFixture.detectChanges();
@ -401,7 +401,7 @@ export function main() {
it('should wait for macroTask(setTimeout) while checking for whenStable ' + it('should wait for macroTask(setTimeout) while checking for whenStable ' +
'(autoDetectChanges)', '(autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AsyncTimeoutComp) tcb.createAsync(AsyncTimeoutComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -426,7 +426,7 @@ export function main() {
it('should wait for macroTask(setTimeout) while checking for whenStable ' + it('should wait for macroTask(setTimeout) while checking for whenStable ' +
'(no autoDetectChanges)', '(no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AsyncTimeoutComp) tcb.createAsync(AsyncTimeoutComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -452,7 +452,7 @@ export function main() {
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' + it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
'(autoDetectChanges)', '(autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(NestedAsyncTimeoutComp) tcb.createAsync(NestedAsyncTimeoutComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -477,7 +477,7 @@ export function main() {
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' + it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
'(no autoDetectChanges)', '(no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(NestedAsyncTimeoutComp) tcb.createAsync(NestedAsyncTimeoutComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -502,7 +502,7 @@ export function main() {
it('should stabilize after async task in change detection (autoDetectChanges)', it('should stabilize after async task in change detection (autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AsyncChangeComp) tcb.createAsync(AsyncChangeComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -523,7 +523,7 @@ export function main() {
it('should stabilize after async task in change detection(no autoDetectChanges)', it('should stabilize after async task in change detection(no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(AsyncChangeComp) tcb.createAsync(AsyncChangeComp)
.then((componentFixture) => { .then((componentFixture) => {
@ -554,7 +554,7 @@ export function main() {
it('calling autoDetectChanges raises an error', () => { it('calling autoDetectChanges raises an error', () => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.createAsync(ChildComp).then((componentFixture) => { tcb.createAsync(ChildComp).then((componentFixture) => {
expect(() => { expect(() => {
componentFixture.autoDetectChanges(); componentFixture.autoDetectChanges();
@ -566,7 +566,7 @@ export function main() {
it('should instantiate a component with valid DOM', it('should instantiate a component with valid DOM',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(ChildComp).then((componentFixture) => { tcb.createAsync(ChildComp).then((componentFixture) => {
expect(componentFixture.ngZone).toBeNull(); expect(componentFixture.ngZone).toBeNull();
@ -578,7 +578,7 @@ export function main() {
it('should allow changing members of the component', it('should allow changing members of the component',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(MyIfComp).then((componentFixture) => { tcb.createAsync(MyIfComp).then((componentFixture) => {
componentFixture.detectChanges(); componentFixture.detectChanges();
@ -596,7 +596,7 @@ export function main() {
describe('createSync', () => { describe('createSync', () => {
it('should create components', it('should create components',
inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter], inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter],
(cr: ComponentResolver, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (cr: ComponentResolver, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
cr.resolveComponent(MyIfComp).then((cmpFactory) => { cr.resolveComponent(MyIfComp).then((cmpFactory) => {
let componentFixture = tcb.createSync(cmpFactory); let componentFixture = tcb.createSync(cmpFactory);

View File

@ -42,7 +42,7 @@ export function main() {
PromiseWrapper.then(request, onResponse, onError); PromiseWrapper.then(request, onResponse, onError);
} }
it('should return a response from the definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should return a response from the definitions', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var url = '/foo'; var url = '/foo';
var response = 'bar'; var response = 'bar';
xhr.when(url, response); xhr.when(url, response);
@ -50,7 +50,7 @@ export function main() {
xhr.flush(); xhr.flush();
})); }));
it('should return an error from the definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should return an error from the definitions', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var url = '/foo'; var url = '/foo';
var response: any /** TODO #9100 */ = null; var response: any /** TODO #9100 */ = null;
xhr.when(url, response); xhr.when(url, response);
@ -58,7 +58,7 @@ export function main() {
xhr.flush(); xhr.flush();
})); }));
it('should return a response from the expectations', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should return a response from the expectations', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var url = '/foo'; var url = '/foo';
var response = 'bar'; var response = 'bar';
xhr.expect(url, response); xhr.expect(url, response);
@ -66,7 +66,7 @@ export function main() {
xhr.flush(); xhr.flush();
})); }));
it('should return an error from the expectations', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should return an error from the expectations', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var url = '/foo'; var url = '/foo';
var response: any /** TODO #9100 */ = null; var response: any /** TODO #9100 */ = null;
xhr.expect(url, response); xhr.expect(url, response);
@ -83,7 +83,7 @@ export function main() {
expect(() => { xhr.flush(); }).toThrowError('Unexpected request /foo'); expect(() => { xhr.flush(); }).toThrowError('Unexpected request /foo');
}); });
it('should return expectations before definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should return expectations before definitions', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var url = '/foo'; var url = '/foo';
xhr.when(url, 'when'); xhr.when(url, 'when');
xhr.expect(url, 'expect'); xhr.expect(url, 'expect');

View File

@ -93,11 +93,9 @@ export class MockXHR extends XHR {
} }
class _PendingRequest { class _PendingRequest {
url: string;
completer: PromiseCompleter<string>; completer: PromiseCompleter<string>;
constructor(url: any /** TODO #9100 */) { constructor(public url: string) {
this.url = url;
this.completer = PromiseWrapper.completer(); this.completer = PromiseWrapper.completer();
} }

View File

@ -89,7 +89,7 @@ export function main() {
}); });
it('should return a promise with rejected errors even if the exceptionHandler is not rethrowing', 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 ref = createApplication([]);
var promise = ref.run(() => PromiseWrapper.reject('Test', null)); var promise = ref.run(() => PromiseWrapper.reject('Test', null));
PromiseWrapper.catchError(promise, (e) => { PromiseWrapper.catchError(promise, (e) => {
@ -102,7 +102,7 @@ export function main() {
describe("coreLoadAndBootstrap", () => { describe("coreLoadAndBootstrap", () => {
it("should wait for asynchronous app initializers", 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(); let completer: PromiseCompleter<any> = PromiseWrapper.completer();
var initializerDone = false; var initializerDone = false;
TimerWrapper.setTimeout(() => { TimerWrapper.setTimeout(() => {
@ -121,7 +121,7 @@ export function main() {
describe("coreBootstrap", () => { describe("coreBootstrap", () => {
it("should throw if an APP_INITIIALIZER is not yet resolved", it("should throw if an APP_INITIIALIZER is not yet resolved",
inject([Injector], (injector: any /** TODO #9100 */) => { inject([Injector], (injector: Injector) => {
var app = createApplication([ var app = createApplication([
{provide: APP_INITIALIZER, useValue: () => PromiseWrapper.completer().promise, multi: true} {provide: APP_INITIALIZER, useValue: () => PromiseWrapper.completer().promise, multi: true}
]); ]);

View File

@ -39,7 +39,7 @@ class MessageDir {
constructor(logger: Logger) { this.logger = logger; } 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({ @Component({
@ -193,7 +193,7 @@ class TestApp {
export function main() { export function main() {
describe('debug element', function() { describe('debug element', function() {
it('should list all child nodes', 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) tcb.createAsync(ParentComp)
.then((fixture) => { .then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
@ -205,7 +205,7 @@ export function main() {
})); }));
it('should list all component child elements', 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) tcb.createAsync(ParentComp)
.then((fixture) => { .then((fixture) => {
@ -239,7 +239,7 @@ export function main() {
})); }));
it('should list conditional component child elements', 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) tcb.createAsync(ConditionalParentComp)
.then((fixture) => { .then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
@ -265,7 +265,7 @@ export function main() {
})); }));
it('should list child elements within viewports', 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) => { tcb.createAsync(UsingFor).then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
@ -282,7 +282,7 @@ export function main() {
})); }));
it('should list element attributes', 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) => { tcb.createAsync(TestApp).then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
var bankElem = fixture.debugElement.children[0]; var bankElem = fixture.debugElement.children[0];
@ -294,7 +294,7 @@ export function main() {
})); }));
it('should list element classes', 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) => { tcb.createAsync(TestApp).then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
var bankElem = fixture.debugElement.children[0]; var bankElem = fixture.debugElement.children[0];
@ -306,7 +306,7 @@ export function main() {
})); }));
it('should list element styles', 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) => { tcb.createAsync(TestApp).then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
var bankElem = fixture.debugElement.children[0]; var bankElem = fixture.debugElement.children[0];
@ -318,7 +318,7 @@ export function main() {
})); }));
it('should query child elements by css', 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) tcb.createAsync(ParentComp)
.then((fixture) => { .then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
@ -334,7 +334,7 @@ export function main() {
})); }));
it('should query child elements by directive', 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) tcb.createAsync(ParentComp)
.then((fixture) => { .then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
@ -352,7 +352,7 @@ export function main() {
})); }));
it('should list providerTokens', it('should list providerTokens',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(ParentComp) tcb.createAsync(ParentComp)
.then((fixture) => { .then((fixture) => {
@ -365,7 +365,7 @@ export function main() {
})); }));
it('should list locals', it('should list locals',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(LocalsComp) tcb.createAsync(LocalsComp)
.then((fixture) => { .then((fixture) => {
fixture.detectChanges(); fixture.detectChanges();
@ -377,7 +377,7 @@ export function main() {
})); }));
it('should allow injecting from the element injector', 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) tcb.createAsync(ParentComp)
.then((fixture) => { .then((fixture) => {
@ -391,7 +391,7 @@ export function main() {
})); }));
it('should list event listeners', it('should list event listeners',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(EventsComp) tcb.createAsync(EventsComp)
.then((fixture) => { .then((fixture) => {
@ -406,7 +406,7 @@ export function main() {
it('should trigger event handlers', it('should trigger event handlers',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(EventsComp) tcb.createAsync(EventsComp)
.then((fixture) => { .then((fixture) => {

View File

@ -290,7 +290,7 @@ export function main() {
it('should support overriding factory dependencies', () => { it('should support overriding factory dependencies', () => {
var injector = createInjector( 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); var car = injector.get(Car);
expect(car).toBeAnInstanceOf(SportsCar); expect(car).toBeAnInstanceOf(SportsCar);
@ -483,7 +483,7 @@ export function main() {
it("should return a dependency from self", () => { it("should return a dependency from self", () => {
var inj = ReflectiveInjector.resolveAndCreate([ var inj = ReflectiveInjector.resolveAndCreate([
Engine, 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); expect(inj.get(Car)).toBeAnInstanceOf(Car);
@ -492,7 +492,7 @@ export function main() {
it("should throw when not requested provider on self", () => { it("should throw when not requested provider on self", () => {
var parent = ReflectiveInjector.resolveAndCreate([Engine]); var parent = ReflectiveInjector.resolveAndCreate([Engine]);
var child = parent.resolveAndCreateChild([ 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)) expect(() => child.get(Car))
@ -505,7 +505,7 @@ export function main() {
var parent = ReflectiveInjector.resolveAndCreate([Engine]); var parent = ReflectiveInjector.resolveAndCreate([Engine]);
var child = parent.resolveAndCreateChild([ var child = parent.resolveAndCreateChild([
{provide: Engine, useClass: TurboEngine}, {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); expect(child.get(Car).engine).toBeAnInstanceOf(TurboEngine);

View File

@ -29,7 +29,7 @@ export function main() {
it('should invoke lifecycle methods ngOnChanges > ngOnInit > ngDoCheck > ngAfterContentChecked', it('should invoke lifecycle methods ngOnChanges > ngOnInit > ngDoCheck > ngAfterContentChecked',
inject([TestComponentBuilder, Log, AsyncTestCompleter], (tcb: TestComponentBuilder, log: Log, inject([TestComponentBuilder, Log, AsyncTestCompleter], (tcb: TestComponentBuilder, log: Log,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp5, MyComp5,
new ViewMetadata( new ViewMetadata(

View File

@ -16,7 +16,7 @@ export function main() {
describe("Observable", () => { describe("Observable", () => {
describe("#core", () => { 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); }); 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 */) => { let o = new Observable((sink: any /** TODO #9100 */) => {
sink.next(1); 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!'); }); let o = new Observable((sink: any /** TODO #9100 */) => { sink.error('oh noes!'); });

View File

@ -28,7 +28,7 @@ import {asNativeElements} from '@angular/core';
export function main() { export function main() {
describe("forwardRef integration", function() { describe("forwardRef integration", function() {
it('should instantiate components which are declared using forwardRef', 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) => { tcb.createAsync(App).then((tc) => {
tc.detectChanges(); tc.detectChanges();
expect(asNativeElements(tc.debugElement.children)).toHaveText('frame(lock)'); expect(asNativeElements(tc.debugElement.children)).toHaveText('frame(lock)');

View File

@ -19,16 +19,11 @@ import {
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
import { import {
isPresent,
isBlank, isBlank,
isNumber,
isJsObject,
FunctionWrapper,
NumberWrapper, NumberWrapper,
normalizeBool
} from '../../src/facade/lang'; } from '../../src/facade/lang';
import {BaseException, WrappedException} from '../../src/facade/exceptions'; import {BaseException} from '../../src/facade/exceptions';
import {MapWrapper, StringMapWrapper} from '../../src/facade/collection'; import {StringMapWrapper} from '../../src/facade/collection';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import { import {
@ -130,7 +125,7 @@ export function main() {
]); ]);
beforeEach(inject([TestComponentBuilder, ElementSchemaRegistry, RenderLog, DirectiveLog], 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; tcb = _tcb;
elSchema = _elSchema; elSchema = _elSchema;
renderLog = _renderLog; renderLog = _renderLog;

View File

@ -28,7 +28,7 @@ export function main() {
describe("loading next to a location", () => { describe("loading next to a location", () => {
it('should work', it('should work',
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(MyComp3).then((tc) => { tcb.createAsync(MyComp3).then((tc) => {
tc.detectChanges(); tc.detectChanges();
loader.loadNextToLocation(DynamicallyLoaded, loader.loadNextToLocation(DynamicallyLoaded,
@ -44,7 +44,7 @@ export function main() {
it('should return a disposable component ref', it('should return a disposable component ref',
inject( inject(
[DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], [DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(MyComp3).then((tc) => { tcb.createAsync(MyComp3).then((tc) => {
tc.detectChanges(); tc.detectChanges();
loader.loadNextToLocation(DynamicallyLoaded, tc.componentInstance.viewContainerRef) loader.loadNextToLocation(DynamicallyLoaded, tc.componentInstance.viewContainerRef)
@ -67,7 +67,7 @@ export function main() {
it('should update host properties', it('should update host properties',
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(MyComp3).then((tc) => { tcb.createAsync(MyComp3).then((tc) => {
tc.detectChanges(); tc.detectChanges();
@ -90,7 +90,7 @@ export function main() {
it('should leave the view tree in a consistent state if hydration fails', it('should leave the view tree in a consistent state if hydration fails',
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], 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>) => { tcb.createAsync(MyComp3).then((tc: ComponentFixture<any>) => {
tc.detectChanges(); tc.detectChanges();
PromiseWrapper.catchError( PromiseWrapper.catchError(
@ -107,7 +107,7 @@ export function main() {
it('should allow to pass projectable nodes', it('should allow to pass projectable nodes',
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(MyComp3).then((tc) => { tcb.createAsync(MyComp3).then((tc) => {
tc.detectChanges(); tc.detectChanges();
loader.loadNextToLocation(DynamicallyLoadedWithNgContent, loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
@ -124,7 +124,7 @@ export function main() {
it('should not throw if not enough projectable nodes are passed in', it('should not throw if not enough projectable nodes are passed in',
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.createAsync(MyComp3).then((tc) => { tcb.createAsync(MyComp3).then((tc) => {
tc.detectChanges(); tc.detectChanges();
loader.loadNextToLocation(DynamicallyLoadedWithNgContent, loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
@ -138,7 +138,7 @@ export function main() {
describe('loadAsRoot', () => { describe('loadAsRoot', () => {
it('should allow to create, update and destroy components', it('should allow to create, update and destroy components',
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector], 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'); var rootEl = createRootElement(doc, 'child-cmp');
getDOM().appendChild(doc.body, rootEl); getDOM().appendChild(doc.body, rootEl);
loader.loadAsRoot(ChildComp, null, injector) loader.loadAsRoot(ChildComp, null, injector)
@ -167,7 +167,7 @@ export function main() {
it('should allow to pass projectable nodes', it('should allow to pass projectable nodes',
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector], 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'); var rootEl = createRootElement(doc, 'dummy');
getDOM().appendChild(doc.body, rootEl); getDOM().appendChild(doc.body, rootEl);
loader.loadAsRoot(DynamicallyLoadedWithNgContent, null, injector, null, loader.loadAsRoot(DynamicallyLoadedWithNgContent, null, injector, null,

View File

@ -103,7 +103,7 @@ function declareTests(isJit: boolean) {
describe('react to record changes', function() { describe('react to record changes', function() {
it('should consume text node changes', 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>'})) tcb.overrideView(MyComp, new ViewMetadata({template: '<div>{{ctxProp}}</div>'}))
.createAsync(MyComp) .createAsync(MyComp)
.then((fixture) => { .then((fixture) => {
@ -116,7 +116,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should update text node with a blank string when interpolation evaluates to null', 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>'})) tcb.overrideView(MyComp, new ViewMetadata({template: '<div>{{null}}{{ctxProp}}</div>'}))
.createAsync(MyComp) .createAsync(MyComp)
.then((fixture) => { .then((fixture) => {
@ -129,7 +129,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should consume element binding changes', 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>'})) tcb.overrideView(MyComp, new ViewMetadata({template: '<div [id]="ctxProp"></div>'}))
.createAsync(MyComp) .createAsync(MyComp)
.then((fixture) => { .then((fixture) => {
@ -143,7 +143,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should consume binding to aria-* attributes', 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, tcb.overrideView(MyComp,
new ViewMetadata({template: '<div [attr.aria-label]="ctxProp"></div>'})) 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', 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, tcb.overrideView(MyComp,
new ViewMetadata({template: '<div [attr.foo]="ctxProp"></div>'})) 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', 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, tcb.overrideView(MyComp,
new ViewMetadata({template: '<div [style.height.px]="ctxProp"></div>'})) 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', 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, tcb.overrideView(MyComp,
new ViewMetadata({template: '<div [tabindex]="ctxNumProp"></div>'})) new ViewMetadata({template: '<div [tabindex]="ctxNumProp"></div>'}))
@ -231,7 +231,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should consume binding to camel-cased properties', 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, tcb.overrideView(MyComp,
new ViewMetadata({template: '<input [readOnly]="ctxBoolProp">'})) new ViewMetadata({template: '<input [readOnly]="ctxBoolProp">'}))
@ -250,7 +250,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should consume binding to innerHtml', 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, tcb.overrideView(MyComp,
new ViewMetadata({template: '<div innerHtml="{{ctxProp}}"></div>'})) new ViewMetadata({template: '<div innerHtml="{{ctxProp}}"></div>'}))
@ -272,7 +272,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should consume binding to className using class alias', 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( tcb.overrideView(
MyComp, MyComp,
new ViewMetadata({template: '<div class="initial" [class]="ctxProp"></div>'})) new ViewMetadata({template: '<div class="initial" [class]="ctxProp"></div>'}))
@ -292,7 +292,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should consume directive watch expression change.', 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>' + var tpl = '<span>' +
'<div my-dir [elprop]="ctxProp"></div>' + '<div my-dir [elprop]="ctxProp"></div>' +
'<div my-dir elprop="Hi there!"></div>' + '<div my-dir elprop="Hi there!"></div>' +
@ -320,7 +320,7 @@ function declareTests(isJit: boolean) {
describe('pipes', () => { describe('pipes', () => {
it("should support pipes in bindings", it("should support pipes in bindings",
inject( inject(
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: '<div my-dir #dir="mydir" [elprop]="ctxProp | double"></div>', template: '<div my-dir #dir="mydir" [elprop]="ctxProp | double"></div>',
@ -341,7 +341,7 @@ function declareTests(isJit: boolean) {
}); });
it('should support nested components.', it('should support nested components.',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, MyComp,
new ViewMetadata({template: '<child-cmp></child-cmp>', directives: [ChildComp]})) 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 // GH issue 328 - https://github.com/angular/angular/issues/328
it('should support different directive types on a single node', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<child-cmp my-dir [elprop]="ctxProp"></child-cmp>', template: '<child-cmp my-dir [elprop]="ctxProp"></child-cmp>',
directives: [MyDir, ChildComp] directives: [MyDir, ChildComp]
@ -380,7 +380,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support directives where a binding attribute is not given', 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({ tcb.overrideView(MyComp, new ViewMetadata({
// No attribute "el-prop" specified. // No attribute "el-prop" specified.
template: '<p my-dir></p>', 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', 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: '<p no-duplicate></p>', template: '<p no-duplicate></p>',
@ -406,7 +406,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support directives where a selector matches property binding', 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( tcb.overrideView(MyComp, new ViewMetadata(
{template: '<p [id]="ctxProp"></p>', directives: [IdDir]})) {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', 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( tcb.overrideView(
MyComp, MyComp,
new ViewMetadata( new ViewMetadata(
@ -443,7 +443,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should read directives metadata from their binding token', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div public-api><div needs-public-api></div></div>', template: '<div public-api><div needs-public-api></div></div>',
directives: [PrivateImpl, NeedsPublicApi] directives: [PrivateImpl, NeedsPublicApi]
@ -454,7 +454,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support template directives via `<template>` elements.', 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -477,7 +477,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should not detach views in ViewContainers when the parent view is destroyed.', 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -506,7 +506,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should use a comment while stamping out `<template>` elements.', 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>'})) tcb.overrideView(MyComp, new ViewMetadata({template: '<template></template>'}))
.createAsync(MyComp) .createAsync(MyComp)
@ -519,7 +519,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support template directives via `template` attribute.', 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -541,7 +541,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should allow to transplant TemplateRefs into other ViewContainers', 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -564,7 +564,7 @@ function declareTests(isJit: boolean) {
describe("reference bindings", () => { describe("reference bindings", () => {
it('should assign a component to a ref-', it('should assign a component to a ref-',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<p><child-cmp ref-alice></child-cmp></p>', template: '<p><child-cmp ref-alice></child-cmp></p>',
directives: [ChildComp] directives: [ChildComp]
@ -580,7 +580,7 @@ function declareTests(isJit: boolean) {
it('should assign a directive to a ref-', it('should assign a directive to a ref-',
inject( inject(
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div><div export-dir #localdir="dir"></div></div>', template: '<div><div export-dir #localdir="dir"></div></div>',
directives: [ExportDir] 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', it('should make the assigned component accessible in property bindings, even if they were declared before the component',
inject( inject(
[TestComponentBuilder, AsyncTestCompleter], [TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -617,7 +617,7 @@ function declareTests(isJit: boolean) {
it('should assign two component instances each with a ref-', it('should assign two component instances each with a ref-',
inject( inject(
[TestComponentBuilder, AsyncTestCompleter], [TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -641,7 +641,7 @@ function declareTests(isJit: boolean) {
it('should assign the component instance to a ref- with shorthand syntax', it('should assign the component instance to a ref- with shorthand syntax',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => {tcb.overrideView(MyComp, new ViewMetadata({ async: AsyncTestCompleter) => {tcb.overrideView(MyComp, new ViewMetadata({
template: '<child-cmp #alice></child-cmp>', template: '<child-cmp #alice></child-cmp>',
directives: [ChildComp] directives: [ChildComp]
})) }))
@ -657,7 +657,7 @@ function declareTests(isJit: boolean) {
it('should assign the element instance to a user-defined variable', it('should assign the element instance to a user-defined variable',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div><div ref-alice><i>Hello</i></div></div>' 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', it('should assign the TemplateRef to a user-defined variable',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata( tcb.overrideView(MyComp, new ViewMetadata(
{template: '<template ref-alice></template>'})) {template: '<template ref-alice></template>'}))
@ -690,7 +690,7 @@ function declareTests(isJit: boolean) {
it('should preserve case', it('should preserve case',
inject( inject(
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<p><child-cmp ref-superAlice></child-cmp></p>', template: '<p><child-cmp ref-superAlice></child-cmp></p>',
directives: [ChildComp] directives: [ChildComp]
@ -709,7 +709,7 @@ function declareTests(isJit: boolean) {
describe('variables', () => { describe('variables', () => {
it('should allow to use variables in a for loop', it('should allow to use variables in a for loop',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -733,7 +733,7 @@ function declareTests(isJit: boolean) {
it("should use ChangeDetectorRef to manually request a check", it("should use ChangeDetectorRef to manually request a check",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<push-cmp-with-ref #cmp></push-cmp-with-ref>', 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", it("should be checked when its bindings got updated",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<push-cmp [prop]="ctxProp" #cmp></push-cmp>', 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", it("should be checked when an event is fired",
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<push-cmp [prop]="ctxProp" #cmp></push-cmp>', 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', it('should not affect updating properties on the component',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -903,7 +903,7 @@ function declareTests(isJit: boolean) {
it('should create a component that injects an @Host', it('should create a component that injects an @Host',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => {tcb.overrideView(MyComp, new ViewMetadata({ async: AsyncTestCompleter) => {tcb.overrideView(MyComp, new ViewMetadata({
template: ` template: `
<some-directive> <some-directive>
<p> <p>
@ -926,7 +926,7 @@ function declareTests(isJit: boolean) {
})})); })}));
it('should create a component that injects an @Host through viewcontainer directive', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: ` template: `
<some-directive> <some-directive>
@ -951,7 +951,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support events via EventEmitter on regular elements', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div emitter listener></div>', template: '<div emitter listener></div>',
directives: [DirectiveEmittingEvent, DirectiveListeningEvent] directives: [DirectiveEmittingEvent, DirectiveListeningEvent]
@ -985,7 +985,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support events via EventEmitter on template elements', 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: '<template emitter listener (event)="ctxProp=$event"></template>', template: '<template emitter listener (event)="ctxProp=$event"></template>',
@ -1015,7 +1015,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support [()] syntax', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div [(control)]="ctxProp" two-way></div>', template: '<div [(control)]="ctxProp" two-way></div>',
directives: [DirectiveWithTwoWayBinding] directives: [DirectiveWithTwoWayBinding]
@ -1041,7 +1041,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support render events', it('should support render events',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, MyComp,
new ViewMetadata( new ViewMetadata(
@ -1069,7 +1069,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support render global events', it('should support render global events',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, MyComp,
new ViewMetadata( new ViewMetadata(
@ -1096,7 +1096,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support updating host element via hostAttributes', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div update-host-attributes></div>', template: '<div update-host-attributes></div>',
directives: [DirectiveUpdatingHostAttributes] directives: [DirectiveUpdatingHostAttributes]
@ -1115,7 +1115,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support updating host element via hostProperties', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div update-host-properties></div>', template: '<div update-host-properties></div>',
directives: [DirectiveUpdatingHostProperties] directives: [DirectiveUpdatingHostProperties]
@ -1140,7 +1140,7 @@ function declareTests(isJit: boolean) {
if (getDOM().supportsDOMEvents()) { if (getDOM().supportsDOMEvents()) {
it('should support preventing default on render events', it('should support preventing default on render events',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: template:
@ -1171,7 +1171,7 @@ function declareTests(isJit: boolean) {
} }
it('should support render global events from multiple directives', 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: '<div *ngIf="ctxBoolProp" listener listenerother></div>', template: '<div *ngIf="ctxBoolProp" listener listenerother></div>',
@ -1215,7 +1215,7 @@ function declareTests(isJit: boolean) {
describe('dynamic ViewContainers', () => { describe('dynamic ViewContainers', () => {
it('should allow to create a ViewContainerRef at any bound location', it('should allow to create a ViewContainerRef at any bound location',
inject([TestComponentBuilder, AsyncTestCompleter, ComponentResolver], 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div><dynamic-vp #dynamic></dynamic-vp></div>', template: '<div><dynamic-vp #dynamic></dynamic-vp></div>',
directives: [DynamicViewport] directives: [DynamicViewport]
@ -1237,7 +1237,7 @@ function declareTests(isJit: boolean) {
}); });
it('should support static attributes', it('should support static attributes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, MyComp,
new ViewMetadata( new ViewMetadata(
@ -1257,7 +1257,7 @@ function declareTests(isJit: boolean) {
describe("dependency injection", () => { describe("dependency injection", () => {
it("should support bindings", it("should support bindings",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: ` template: `
@ -1278,7 +1278,7 @@ function declareTests(isJit: boolean) {
})); }));
it("should support viewProviders", 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({ tcb.overrideView(DirectiveProvidingInjectableInView, new ViewMetadata({
template: ` template: `
<directive-consuming-injectable #consuming> <directive-consuming-injectable #consuming>
@ -1296,7 +1296,7 @@ function declareTests(isJit: boolean) {
})); }));
it("should support unbounded lookup", 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: ` template: `
<directive-providing-injectable> <directive-providing-injectable>
@ -1326,7 +1326,7 @@ function declareTests(isJit: boolean) {
})); }));
it("should support the event-bus scenario", 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: ` template: `
<grand-parent-providing-event-bus> <grand-parent-providing-event-bus>
@ -1362,7 +1362,7 @@ function declareTests(isJit: boolean) {
})); }));
it("should instantiate bindings lazily", it("should instantiate bindings lazily",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: ` template: `
@ -1391,7 +1391,7 @@ function declareTests(isJit: boolean) {
describe("corner cases", () => { describe("corner cases", () => {
it('should remove script tags from templates', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: ` template: `
<script>alert("Ooops");</script> <script>alert("Ooops");</script>
@ -1409,7 +1409,7 @@ function declareTests(isJit: boolean) {
describe("error handling", () => { describe("error handling", () => {
it('should report a meaningful error when a directive is missing annotation', 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( tcb = tcb.overrideView(
MyComp, MyComp,
new ViewMetadata({template: '', directives: [SomeDirectiveMissingAnnotation]})); new ViewMetadata({template: '', directives: [SomeDirectiveMissingAnnotation]}));
@ -1433,7 +1433,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should report a meaningful error when a directive is null', 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: ''})); 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', 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 =
tcb.overrideView(MyComp, new ViewMetadata({ 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', 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( tcb = tcb.overrideView(
MyComp, new ViewMetadata({template: `<input [value]="one.two.three" #local>`})); 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)', 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, tcb = tcb.overrideView(MyComp,
new ViewMetadata({template: `<div>{{one.two.three}}</div>`})); new ViewMetadata({template: `<div>{{one.two.three}}</div>`}));
@ -1540,7 +1540,7 @@ function declareTests(isJit: boolean) {
if (!IS_DART) { if (!IS_DART) {
it('should report a meaningful error when a directive is undefined', it('should report a meaningful error when a directive is undefined',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
var undefinedValue: any /** TODO #9100 */; 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)', it('should specify a location of an error that happened during change detection (text)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({template: '<div>{{a.b}}</div>'})) 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)', it('should specify a location of an error that happened during change detection (element property)',
inject( inject(
[TestComponentBuilder, AsyncTestCompleter], [TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({template: '<div [title]="a.b"></div>'})) 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)', it('should specify a location of an error that happened during change detection (directive property)',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<child-cmp [title]="a.b"></child-cmp>', template: '<child-cmp [title]="a.b"></child-cmp>',
@ -1600,7 +1600,7 @@ function declareTests(isJit: boolean) {
}); });
it('should support imperative views', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<simple-imp-cmp></simple-imp-cmp>', template: '<simple-imp-cmp></simple-imp-cmp>',
directives: [SimpleImperativeViewComponent] directives: [SimpleImperativeViewComponent]
@ -1614,7 +1614,7 @@ function declareTests(isJit: boolean) {
it('should support moving embedded views around', it('should support moving embedded views around',
inject([TestComponentBuilder, AsyncTestCompleter, ANCHOR_ELEMENT], 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<div><div *someImpvp="ctxBoolProp">hello</div></div>', template: '<div><div *someImpvp="ctxBoolProp">hello</div></div>',
directives: [SomeImperativeViewport] directives: [SomeImperativeViewport]
@ -1641,7 +1641,7 @@ function declareTests(isJit: boolean) {
if (!IS_DART) { if (!IS_DART) {
it('should throw on bindings to unknown properties', it('should throw on bindings to unknown properties',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb = tcb =
tcb.overrideView(MyComp, tcb.overrideView(MyComp,
new ViewMetadata({template: '<div unknown="{{ctxProp}}"></div>'})) 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', it('should not throw for property binding to a non-existing property when there is a matching directive property',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
MyComp, MyComp,
new ViewMetadata( new ViewMetadata(
@ -1667,7 +1667,7 @@ function declareTests(isJit: boolean) {
} }
it('should not be created when there is a directive with the same property', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<span [title]="ctxProp"></span>', template: '<span [title]="ctxProp"></span>',
directives: [DirectiveWithTitle] directives: [DirectiveWithTitle]
@ -1686,7 +1686,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should work when a directive uses hostProperty to update the DOM element', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<span [title]="ctxProp"></span>', template: '<span [title]="ctxProp"></span>',
directives: [DirectiveWithTitleAndHostProperty] directives: [DirectiveWithTitleAndHostProperty]
@ -1710,7 +1710,7 @@ function declareTests(isJit: boolean) {
() => [{provide: CompilerConfig, useValue: new CompilerConfig(true, true, isJit)}]); () => [{provide: CompilerConfig, useValue: new CompilerConfig(true, true, isJit)}]);
it('should reflect property values as attributes', 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>' + var tpl = '<div>' +
'<div my-dir [elprop]="ctxProp"></div>' + '<div my-dir [elprop]="ctxProp"></div>' +
'</div>'; '</div>';
@ -1728,7 +1728,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should reflect property values on template comments', 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>'; var tpl = '<template [ngIf]="ctxBoolProp"></template>';
tcb.overrideView(MyComp, new ViewMetadata({template: tpl, directives: [NgIf]})) tcb.overrideView(MyComp, new ViewMetadata({template: tpl, directives: [NgIf]}))
@ -1746,7 +1746,7 @@ function declareTests(isJit: boolean) {
describe('property decorators', () => { describe('property decorators', () => {
it('should support 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( tcb.overrideView(
MyComp, new ViewMetadata({ MyComp, new ViewMetadata({
template: '<with-prop-decorators elProp="aaa"></with-prop-decorators>', template: '<with-prop-decorators elProp="aaa"></with-prop-decorators>',
@ -1762,7 +1762,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support host binding decorators', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<with-prop-decorators></with-prop-decorators>', template: '<with-prop-decorators></with-prop-decorators>',
directives: [DirectiveWithPropDecorators] directives: [DirectiveWithPropDecorators]
@ -1803,7 +1803,7 @@ function declareTests(isJit: boolean) {
it('should support host listener decorators', it('should support host listener decorators',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<with-prop-decorators></with-prop-decorators>', template: '<with-prop-decorators></with-prop-decorators>',
directives: [DirectiveWithPropDecorators] directives: [DirectiveWithPropDecorators]
@ -1822,7 +1822,7 @@ function declareTests(isJit: boolean) {
} }
it('should support defining views in the component decorator', 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({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<component-with-template></component-with-template>', template: '<component-with-template></component-with-template>',
directives: [ComponentWithTemplate] directives: [ComponentWithTemplate]
@ -1842,7 +1842,7 @@ function declareTests(isJit: boolean) {
describe('svg', () => { describe('svg', () => {
it('should support svg elements', it('should support svg elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView(MyComp, tcb.overrideView(MyComp,
new ViewMetadata({template: '<svg><use xlink:href="Port" /></svg>'})) new ViewMetadata({template: '<svg><use xlink:href="Port" /></svg>'}))
.createAsync(MyComp) .createAsync(MyComp)
@ -1874,7 +1874,7 @@ function declareTests(isJit: boolean) {
it('should support attributes with namespace', it('should support attributes with namespace',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView(SomeCmp, new ViewMetadata({template: '<svg:use xlink:href="#id" />'})) tcb.overrideView(SomeCmp, new ViewMetadata({template: '<svg:use xlink:href="#id" />'}))
.createAsync(SomeCmp) .createAsync(SomeCmp)
.then((fixture) => { .then((fixture) => {
@ -1887,7 +1887,7 @@ function declareTests(isJit: boolean) {
it('should support binding to attributes with namespace', it('should support binding to attributes with namespace',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async: any /** TODO #9100 */) => { async: AsyncTestCompleter) => {
tcb.overrideView(SomeCmp, tcb.overrideView(SomeCmp,
new ViewMetadata({template: '<svg:use [attr.xlink:href]="value" />'})) new ViewMetadata({template: '<svg:use [attr.xlink:href]="value" />'}))
.createAsync(SomeCmp) .createAsync(SomeCmp)

View File

@ -35,7 +35,7 @@ import {getAllDebugNodes} from '@angular/core/src/debug/debug_node';
export function main() { export function main() {
describe('projection', () => { describe('projection', () => {
it('should support simple components', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<simple>' + template: '<simple>' +
'<div>A</div>' + '<div>A</div>' +
@ -50,7 +50,7 @@ export function main() {
})); }));
it('should support simple components with text interpolation as direct children', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '{{\'START(\'}}<simple>' + template: '{{\'START(\'}}<simple>' +
'{{text}}' + '{{text}}' +
@ -68,7 +68,7 @@ export function main() {
})); }));
it('should support projecting text interpolation to a non bound element', 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( tcb.overrideView(
Simple, Simple,
new ViewMetadata( 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', 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( tcb.overrideView(
Simple, new ViewMetadata({ Simple, new ViewMetadata({
template: template:
@ -109,7 +109,7 @@ export function main() {
})); }));
it('should project content components', it('should project content components',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
Simple, Simple,
new ViewMetadata( new ViewMetadata(
@ -129,7 +129,7 @@ export function main() {
})); }));
it('should not show the light dom even if there is no content tag', 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, tcb.overrideView(MainComp,
new ViewMetadata({template: '<empty>A</empty>', directives: [Empty]})) new ViewMetadata({template: '<empty>A</empty>', directives: [Empty]}))
.createAsync(MainComp) .createAsync(MainComp)
@ -141,7 +141,7 @@ export function main() {
})); }));
it('should support multiple content tags', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<multiple-content-tags>' + template: '<multiple-content-tags>' +
'<div>B</div>' + '<div>B</div>' +
@ -159,7 +159,7 @@ export function main() {
})); }));
it('should redistribute only direct children', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<multiple-content-tags>' + template: '<multiple-content-tags>' +
'<div>B<div class="left">A</div></div>' + '<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", 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<multiple-content-tags>' + template: '<multiple-content-tags>' +
'<template manual class="left"><div>A1</div></template>' + '<template manual class="left"><div>A1</div></template>' +
@ -204,7 +204,7 @@ export function main() {
})); }));
it("should support nested components", 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<outer-with-indirect-nested>' + template: '<outer-with-indirect-nested>' +
'<div>A</div>' + '<div>A</div>' +
@ -221,7 +221,7 @@ export function main() {
})); }));
it("should support nesting with content being direct child of a nested component", 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<outer>' + template: '<outer>' +
'<template manual class="left"><div>A</div></template>' + '<template manual class="left"><div>A</div></template>' +
@ -246,7 +246,7 @@ export function main() {
})); }));
it('should redistribute when the shadow dom changes', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<conditional-content>' + template: '<conditional-content>' +
'<div class="left">A</div>' + '<div class="left">A</div>' +
@ -278,7 +278,7 @@ export function main() {
// important as we are removing the ng-content element during compilation, // important as we are removing the ng-content element during compilation,
// which could skrew up text node indices. // which could skrew up text node indices.
it('should support text nodes after content tags', 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( tcb.overrideView(
MainComp, MainComp,
@ -299,7 +299,7 @@ export function main() {
// important as we are moving style tags around during compilation, // important as we are moving style tags around during compilation,
// which could skrew up text node indices. // which could skrew up text node indices.
it('should support text nodes after style tags', 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( tcb.overrideView(
MainComp, MainComp,
@ -316,7 +316,7 @@ export function main() {
})); }));
it('should support moving non projected light dom around', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<empty>' + template: '<empty>' +
' <template manual><div>A</div></template>' + ' <template manual><div>A</div></template>' +
@ -349,7 +349,7 @@ export function main() {
})); }));
it('should support moving projected light dom around', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<simple><template manual><div>A</div></template></simple>' + template: '<simple><template manual><div>A</div></template></simple>' +
'START(<div project></div>)END', 'START(<div project></div>)END',
@ -373,7 +373,7 @@ export function main() {
})); }));
it('should support moving ng-content around', 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( tcb.overrideView(
MainComp, new ViewMetadata({ MainComp, new ViewMetadata({
template: '<conditional-content>' + template: '<conditional-content>' +
@ -411,7 +411,7 @@ export function main() {
// is still important as we are merging proto views independent of // is still important as we are merging proto views independent of
// the presence of ng-content elements! // the presence of ng-content elements!
it('should still allow to implement a recursive trees', 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, tcb.overrideView(MainComp,
new ViewMetadata({template: '<tree></tree>', directives: [Tree]})) new ViewMetadata({template: '<tree></tree>', directives: [Tree]}))
.createAsync(MainComp) .createAsync(MainComp)
@ -433,7 +433,7 @@ export function main() {
// is still important as we are merging proto views independent of // is still important as we are merging proto views independent of
// the presence of ng-content elements! // the presence of ng-content elements!
it('should still allow to implement a recursive trees via multiple components', 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, tcb.overrideView(MainComp,
new ViewMetadata({template: '<tree></tree>', directives: [Tree]})) new ViewMetadata({template: '<tree></tree>', directives: [Tree]}))
.overrideView(Tree, new ViewMetadata({ .overrideView(Tree, new ViewMetadata({
@ -468,7 +468,7 @@ export function main() {
if (getDOM().supportsNativeShadowDOM()) { if (getDOM().supportsNativeShadowDOM()) {
it('should support native content projection and isolate styles per component', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<simple-native1><div>A</div></simple-native1>' + template: '<simple-native1><div>A</div></simple-native1>' +
'<simple-native2><div>B</div></simple-native2>', '<simple-native2><div>B</div></simple-native2>',
@ -487,7 +487,7 @@ export function main() {
if (getDOM().supportsDOMEvents()) { if (getDOM().supportsDOMEvents()) {
it('should support non emulated styles', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<div class="redStyle"></div>', template: '<div class="redStyle"></div>',
styles: ['.redStyle { color: red}'], styles: ['.redStyle { color: red}'],
@ -508,7 +508,7 @@ export function main() {
})); }));
it('should support emulated style encapsulation', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<div></div>', template: '<div></div>',
styles: ['div { color: red}'], styles: ['div { color: red}'],
@ -528,7 +528,7 @@ export function main() {
} }
it('should support nested conditionals that contain ng-contents', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: `<conditional-text>a</conditional-text>`, template: `<conditional-text>a</conditional-text>`,
directives: [ConditionalTextComponent] directives: [ConditionalTextComponent]
@ -552,7 +552,7 @@ export function main() {
})); }));
it('should allow to switch the order of nested components via ng-content', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: `<cmp-a><cmp-b></cmp-b></cmp-a>`, template: `<cmp-a><cmp-b></cmp-b></cmp-a>`,
directives: [CmpA, CmpB], directives: [CmpA, CmpB],
@ -568,7 +568,7 @@ export function main() {
})); }));
it('should create nested components in the right order', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`, template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`,
directives: [CmpA1, CmpA2], directives: [CmpA1, CmpA2],
@ -584,7 +584,7 @@ export function main() {
})); }));
it('should project filled view containers into a view container', 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({ tcb.overrideView(MainComp, new ViewMetadata({
template: '<conditional-content>' + template: '<conditional-content>' +
'<div class="left">A</div>' + '<div class="left">A</div>' +

View File

@ -39,7 +39,7 @@ export function main() {
describe('Query API', () => { describe('Query API', () => {
describe("querying by directive type", () => { describe("querying by directive type", () => {
it('should contain all direct child directives in the light dom (constructor)', 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>' + var template = '<div text="1"></div>' +
'<needs-query text="2"><div text="3">' + '<needs-query text="2"><div text="3">' +
'<div text="too-deep"></div>' + '<div text="too-deep"></div>' +
@ -58,7 +58,7 @@ export function main() {
})); }));
it('should contain all direct child directives in the content dom', 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 = var template =
'<needs-content-children #q><div text="foo"></div></needs-content-children>'; '<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', 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 = var template =
'<needs-content-child #q><div *ngIf="shouldShow" text="foo"></div></needs-content-child>'; '<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', 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>'; var template = '<needs-view-child #q></needs-view-child>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -136,7 +136,7 @@ export function main() {
})); }));
it('should set static view and content children already after the constructor call', 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 = var template =
'<needs-static-content-view-child #q><div text="contentFoo"></div></needs-static-content-view-child>'; '<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', 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>'; var template = '<needs-view-child #q></needs-view-child>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
.overrideTemplate( .overrideTemplate(
@ -190,7 +190,7 @@ export function main() {
})); }));
it('should contain all directives in the light dom when descendants flag is used', 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>' + var template = '<div text="1"></div>' +
'<needs-query-desc text="2"><div text="3">' + '<needs-query-desc text="2"><div text="3">' +
'<div text="4"></div>' + '<div text="4"></div>' +
@ -208,7 +208,7 @@ export function main() {
})); }));
it('should contain all directives in the light dom', 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>' + var template = '<div text="1"></div>' +
'<needs-query text="2"><div text="3"></div></needs-query>' + '<needs-query text="2"><div text="3"></div></needs-query>' +
'<div text="4"></div>'; '<div text="4"></div>';
@ -224,7 +224,7 @@ export function main() {
})); }));
it('should reflect dynamically inserted directives', it('should reflect dynamically inserted directives',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div text="1"></div>' + '<div text="1"></div>' +
'<needs-query text="2"><div *ngIf="shouldShow" [text]="\'3\'"></div></needs-query>' + '<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', 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 = var template =
'<div text="1"></div>' + '<div text="1"></div>' +
'<needs-query text="2"><div *ngIf="shouldShow" [text]="\'3\'"></div></needs-query>' + '<needs-query text="2"><div *ngIf="shouldShow" [text]="\'3\'"></div></needs-query>' +
@ -264,7 +264,7 @@ export function main() {
})); }));
it('should reflect moved directives', it('should reflect moved directives',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<div text="1"></div>' + '<div text="1"></div>' +
'<needs-query text="2"><div *ngFor="let i of list" [text]="i"></div></needs-query>' + '<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', 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>') tcb.overrideTemplate(MyCompBroken0, '<has-null-query-condition></has-null-query-condition>')
.createAsync(MyCompBroken0) .createAsync(MyCompBroken0)
.catch((e) => { .catch((e) => {
@ -299,7 +299,7 @@ export function main() {
describe('query for TemplateRef', () => { describe('query for TemplateRef', () => {
it('should find TemplateRefs in the light and shadow dom', 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>'; var template = '<needs-tpl><template><div>light</div></template></needs-tpl>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
.createAsync(MyComp0) .createAsync(MyComp0)
@ -317,7 +317,7 @@ export function main() {
})); }));
it('should find named TemplateRefs', it('should find named TemplateRefs',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<needs-named-tpl><template #tpl><div>light</div></template></needs-named-tpl>'; '<needs-named-tpl><template #tpl><div>light</div></template></needs-named-tpl>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -337,7 +337,7 @@ export function main() {
describe('read a different token', () => { describe('read a different token', () => {
it('should contain all content children', it('should contain all content children',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<needs-content-children-read #q text="ca"><div #q text="cb"></div></needs-content-children-read>'; '<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', 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 = var template =
'<needs-content-child-read><div #q text="ca"></div></needs-content-child-read>'; '<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', 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>'; var template = '<needs-view-child-read></needs-view-child-read>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -391,7 +391,7 @@ export function main() {
})); }));
it('should contain all child directives in the view', 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>'; var template = '<needs-view-children-read></needs-view-children-read>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -409,7 +409,7 @@ export function main() {
})); }));
it('should support reading a ViewContainer', it('should support reading a ViewContainer',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<needs-viewcontainer-read><template>hello</template></needs-viewcontainer-read>'; '<needs-viewcontainer-read><template>hello</template></needs-viewcontainer-read>';
@ -430,7 +430,7 @@ export function main() {
describe("changes", () => { describe("changes", () => {
it('should notify query on change', 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>' + var template = '<needs-query #q>' +
'<div text="1"></div>' + '<div text="1"></div>' +
'<div *ngIf="shouldShow" text="2"></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", 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>' + var template = '<needs-query-desc #q1>' +
'<needs-query-desc #q2>' + '<needs-query-desc #q2>' +
'<div text="1"></div>' + '<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', 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>'; var template = '<needs-query #q *ngIf="shouldShow"><div text="foo"></div></needs-query>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -510,7 +510,7 @@ export function main() {
describe("querying by var binding", () => { describe("querying by var binding", () => {
it('should contain all the child directives in the light dom with the given 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 = var template =
'<needs-query-by-ref-binding #q>' + '<needs-query-by-ref-binding #q>' +
'<div *ngFor="let item of list" [text]="item" #textLabel="textDir"></div>' + '<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', 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>' + var template = '<needs-query-by-ref-bindings #q>' +
'<div text="one" #textLabel1="textDir"></div>' + '<div text="one" #textLabel1="textDir"></div>' +
'<div text="two" #textLabel2="textDir"></div>' + '<div text="two" #textLabel2="textDir"></div>' +
@ -553,7 +553,7 @@ export function main() {
})); }));
it('should support dynamically inserted directives', it('should support dynamically inserted directives',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = var template =
'<needs-query-by-ref-binding #q>' + '<needs-query-by-ref-binding #q>' +
'<div *ngFor="let item of list" [text]="item" #textLabel="textDir"></div>' + '<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', 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>' + var template = '<needs-query-by-ref-binding #q>' +
'<div template="ngFor: let item of list">' + '<div template="ngFor: let item of list">' +
'<div #textLabel>{{item}}</div>' + '<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', 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>' + var template = '<needs-query-and-project #q>' +
'<div text="hello"></div><div text="world"></div>' + '<div text="hello"></div><div text="world"></div>' +
'</needs-query-and-project>'; '</needs-query-and-project>';
@ -620,7 +620,7 @@ export function main() {
})); }));
it('should support querying the view by using a view query', 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>'; var template = '<needs-view-query-by-ref-binding #q></needs-view-query-by-ref-binding>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -636,7 +636,7 @@ export function main() {
})); }));
it('should contain all child directives in the view dom', 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>'; var template = '<needs-view-children #q></needs-view-children>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -659,7 +659,7 @@ export function main() {
describe("querying in the view", () => { describe("querying in the view", () => {
it('should contain all the elements in the view with that have the given directive', 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>'; var template = '<needs-view-query #q><div text="ignoreme"></div></needs-view-query>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -676,7 +676,7 @@ export function main() {
})); }));
it('should not include directive present on the host element', 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>'; var template = '<needs-view-query #q text="self"></needs-view-query>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -693,7 +693,7 @@ export function main() {
})); }));
it('should reflect changes in the component', 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>'; var template = '<needs-view-query-if #q></needs-view-query-if>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -716,7 +716,7 @@ export function main() {
})); }));
it('should not be affected by other changes in the component', 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>'; var template = '<needs-view-query-nested-if #q></needs-view-query-nested-if>';
tcb.overrideTemplate(MyComp0, template) 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', 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>'; var template = '<needs-view-query-order #q></needs-view-query-order>';
tcb.overrideTemplate(MyComp0, template) 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', 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>'; var template = '<needs-view-query-order-with-p #q></needs-view-query-order-with-p>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -788,7 +788,7 @@ export function main() {
})); }));
it('should handle long ngFor cycles', 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>'; var template = '<needs-view-query-order #q></needs-view-query-order>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)
@ -810,7 +810,7 @@ export function main() {
})); }));
it('should support more than three queries', 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>'; var template = '<needs-four-queries #q><div text="1"></div></needs-four-queries>';
tcb.overrideTemplate(MyComp0, template) tcb.overrideTemplate(MyComp0, template)

View File

@ -27,13 +27,13 @@ export function main() {
beforeEachProviders(() => [{provide: ComponentResolver, useClass: ReflectorComponentResolver}]); beforeEachProviders(() => [{provide: ComponentResolver, useClass: ReflectorComponentResolver}]);
beforeEach(inject([ComponentResolver], (_compiler: any /** TODO #9100 */) => { beforeEach(inject([ComponentResolver], (_compiler: ComponentResolver) => {
someCompFactory = new ComponentFactory(null, null, null); someCompFactory = new ComponentFactory(null, null, null);
reflector.registerType(SomeComponent, new ReflectionInfo([someCompFactory])); reflector.registerType(SomeComponent, new ReflectionInfo([someCompFactory]));
})); }));
it('should read the template from an annotation', 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) compiler.resolveComponent(SomeComponent)
.then((compFactory: ComponentFactory<any>) => { .then((compFactory: ComponentFactory<any>) => {
expect(compFactory).toBe(someCompFactory); expect(compFactory).toBe(someCompFactory);
@ -43,7 +43,7 @@ export function main() {
})); }));
it('should throw when given a string', 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") compiler.resolveComponent("someString")
.catch((e) => { .catch((e) => {
expect(e.message).toContain("Cannot resolve component using 'someString'.") expect(e.message).toContain("Cannot resolve component using 'someString'.")

View File

@ -54,7 +54,7 @@ function declareTests(isJit: boolean) {
beforeEachProviders(() => [{provide: PLATFORM_PIPES, useValue: [PlatformPipe], multi: true}]); beforeEachProviders(() => [{provide: PLATFORM_PIPES, useValue: [PlatformPipe], multi: true}]);
it('should overwrite them by custom pipes', 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( tcb.overrideView(
MyComp1, new ViewMetadata({template: '{{true | somePipe}}', pipes: [CustomPipe]})) MyComp1, new ViewMetadata({template: '{{true | somePipe}}', pipes: [CustomPipe]}))
.createAsync(MyComp1) .createAsync(MyComp1)
@ -69,7 +69,7 @@ function declareTests(isJit: boolean) {
describe('expressions', () => { describe('expressions', () => {
it('should evaluate conditional and boolean operators with right precedence - #8244', 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, tcb.overrideView(MyComp1,
new ViewMetadata({template: `{{'red' + (true ? ' border' : '')}}`})) new ViewMetadata({template: `{{'red' + (true ? ' border' : '')}}`}))
.createAsync(MyComp1) .createAsync(MyComp1)
@ -83,7 +83,7 @@ function declareTests(isJit: boolean) {
if (!IS_DART) { if (!IS_DART) {
it('should evaluate conditional and unary operators with right precedence - #8235', it('should evaluate conditional and unary operators with right precedence - #8235',
inject([TestComponentBuilder, AsyncTestCompleter], inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp1, new ViewMetadata({template: `{{!null?.length}}`})) tcb.overrideView(MyComp1, new ViewMetadata({template: `{{!null?.length}}`}))
.createAsync(MyComp1) .createAsync(MyComp1)
.then((fixture) => { .then((fixture) => {
@ -103,7 +103,7 @@ function declareTests(isJit: boolean) {
} }
it('should support providers with an OpaqueToken that contains a `.` in the name', 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 token = new OpaqueToken('a.b');
var tokenValue = 1; var tokenValue = 1;
createInjector(tcb, [{provide: token, useValue: tokenValue}]) 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', 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 token = 'a.b';
var tokenValue = 1; var tokenValue = 1;
createInjector(tcb, [{provide: token, useValue: tokenValue}]) createInjector(tcb, [{provide: token, useValue: tokenValue}])
@ -125,7 +125,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support providers with an anonymous function', 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 token = () => true;
var tokenValue = 1; var tokenValue = 1;
createInjector(tcb, [{provide: token, useValue: tokenValue}]) 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', 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 token1 = new OpaqueToken('someToken');
var token2 = new OpaqueToken('someToken'); var token2 = new OpaqueToken('someToken');
var tokenValue1 = {'a': 1}; var tokenValue1 = {'a': 1};
@ -153,7 +153,7 @@ function declareTests(isJit: boolean) {
}); });
it('should allow logging a previous elements class binding via interpolation', 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>`) tcb.overrideTemplate(MyComp1, `<div [class.a]="true" #el>Class: {{el.className}}</div>`)
.createAsync(MyComp1) .createAsync(MyComp1)
.then((fixture) => { .then((fixture) => {
@ -164,7 +164,7 @@ function declareTests(isJit: boolean) {
})); }));
it('should support ngClass before a component and content projection inside of an ngIf', 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( tcb.overrideView(
MyComp1, new ViewMetadata({ MyComp1, new ViewMetadata({
template: `A<cmp-content *ngIf="true" [ngClass]="'red'">B</cmp-content>C`, template: `A<cmp-content *ngIf="true" [ngClass]="'red'">B</cmp-content>C`,

View File

@ -289,7 +289,7 @@ export function main() {
beforeEachProviders(() => [{provide: "appService", useValue: 'appService'}]); beforeEachProviders(() => [{provide: "appService", useValue: 'appService'}]);
beforeEach(inject([TestComponentBuilder], (_tcb: any /** TODO #9100 */) => { tcb = _tcb; })); beforeEach(inject([TestComponentBuilder], (_tcb: TestComponentBuilder) => { tcb = _tcb; }));
describe("injection", () => { describe("injection", () => {
it("should instantiate directives that have no dependencies", fakeAsync(() => { it("should instantiate directives that have no dependencies", fakeAsync(() => {

View File

@ -25,7 +25,7 @@ import {
export function main() { export function main() {
describe('ViewChild', () => { describe('ViewChild', () => {
it('should support type selector', it('should support type selector',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(ViewChildTypeSelectorComponent, tcb.overrideView(ViewChildTypeSelectorComponent,
new ViewMetadata( new ViewMetadata(
{template: `<simple [marker]="'1'"></simple><simple [marker]="'2'"></simple>`, directives: [Simple]})) {template: `<simple [marker]="'1'"></simple><simple [marker]="'2'"></simple>`, directives: [Simple]}))
@ -38,7 +38,7 @@ export function main() {
}); });
})); }));
it('should support string selector', it('should support string selector',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
ViewChildStringSelectorComponent, ViewChildStringSelectorComponent,
new ViewMetadata({template: `<simple #child></simple>`, directives: [Simple]})) new ViewMetadata({template: `<simple #child></simple>`, directives: [Simple]}))
@ -52,7 +52,7 @@ export function main() {
}); });
describe('ViewChildren', () => { describe('ViewChildren', () => {
it('should support type selector', it('should support type selector',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(ViewChildrenTypeSelectorComponent, tcb.overrideView(ViewChildrenTypeSelectorComponent,
new ViewMetadata({template: `<simple></simple><simple></simple>`, directives: [Simple]})) new ViewMetadata({template: `<simple></simple><simple></simple>`, directives: [Simple]}))
.createAsync(ViewChildrenTypeSelectorComponent) .createAsync(ViewChildrenTypeSelectorComponent)
@ -64,7 +64,7 @@ export function main() {
}); });
})); }));
it('should support string selector', it('should support string selector',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView( tcb.overrideView(
ViewChildrenStringSelectorComponent, ViewChildrenStringSelectorComponent,
new ViewMetadata({template: `<simple #child1></simple><simple #child2></simple>`, directives: [Simple]})) new ViewMetadata({template: `<simple #child1></simple><simple #child2></simple>`, directives: [Simple]}))

View File

@ -63,7 +63,7 @@ export function main() {
() => { expect(testability.getPendingRequestCount()).toEqual(0); }); () => { expect(testability.getPendingRequestCount()).toEqual(0); });
it('should fire whenstable callbacks if pending count is 0', it('should fire whenstable callbacks if pending count is 0',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
testability.whenStable(execute); testability.whenStable(execute);
microTask(() => { microTask(() => {
expect(execute).toHaveBeenCalled(); expect(execute).toHaveBeenCalled();
@ -77,7 +77,7 @@ export function main() {
}); });
it('should not call whenstable callbacks when there are pending counts', 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.increasePendingRequestCount(); testability.increasePendingRequestCount();
testability.whenStable(execute); testability.whenStable(execute);
@ -94,7 +94,7 @@ export function main() {
})); }));
it('should fire whenstable callbacks when pending drops to 0', it('should fire whenstable callbacks when pending drops to 0',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
testability.increasePendingRequestCount(); testability.increasePendingRequestCount();
testability.whenStable(execute); testability.whenStable(execute);
@ -118,7 +118,7 @@ export function main() {
}); });
it('should fire whenstable callbacks with didWork if pending count is 0', 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); testability.whenStable(execute);
microTask(() => { microTask(() => {
expect(execute).toHaveBeenCalledWith(false); expect(execute).toHaveBeenCalledWith(false);
@ -127,7 +127,7 @@ export function main() {
})); }));
it('should fire whenstable callbacks with didWork when pending drops to 0', 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.increasePendingRequestCount();
testability.whenStable(execute); testability.whenStable(execute);
@ -149,7 +149,7 @@ export function main() {
describe('NgZone callback logic', () => { describe('NgZone callback logic', () => {
it('should fire whenstable callback if event is already finished', it('should fire whenstable callback if event is already finished',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ngZone.unstable(); ngZone.unstable();
ngZone.stable(); ngZone.stable();
testability.whenStable(execute); testability.whenStable(execute);
@ -169,7 +169,7 @@ export function main() {
}); });
it('should fire whenstable callback when event finishes', it('should fire whenstable callback when event finishes',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ngZone.unstable(); ngZone.unstable();
testability.whenStable(execute); testability.whenStable(execute);
@ -193,7 +193,7 @@ export function main() {
}); });
it('should not fire whenstable callback when event did not finish', it('should not fire whenstable callback when event did not finish',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ngZone.unstable(); ngZone.unstable();
testability.increasePendingRequestCount(); testability.increasePendingRequestCount();
testability.whenStable(execute); testability.whenStable(execute);
@ -215,7 +215,7 @@ export function main() {
})); }));
it('should not fire whenstable callback when there are pending counts', it('should not fire whenstable callback when there are pending counts',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ngZone.unstable(); ngZone.unstable();
testability.increasePendingRequestCount(); testability.increasePendingRequestCount();
testability.increasePendingRequestCount(); testability.increasePendingRequestCount();
@ -243,7 +243,7 @@ export function main() {
})); }));
it('should fire whenstable callback with didWork if event is already finished', 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.unstable();
ngZone.stable(); ngZone.stable();
testability.whenStable(execute); testability.whenStable(execute);
@ -260,7 +260,7 @@ export function main() {
})); }));
it('should fire whenstable callback with didwork when event finishes', it('should fire whenstable callback with didwork when event finishes',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ngZone.unstable(); ngZone.unstable();
testability.whenStable(execute); testability.whenStable(execute);

View File

@ -69,7 +69,7 @@ function runNgZoneNoLog(fn: () => any) {
export function main() { export function main() {
describe("NgZone", () => { describe("NgZone", () => {
function createZone(enableLongStackTrace: any /** TODO #9100 */) { function createZone(enableLongStackTrace: boolean) {
return new NgZone({enableLongStackTrace: enableLongStackTrace}); return new NgZone({enableLongStackTrace: enableLongStackTrace});
} }
@ -90,7 +90,7 @@ export function main() {
commonTests(); commonTests();
it('should produce long stack traces', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should produce long stack traces', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
macroTask(() => { macroTask(() => {
var c: PromiseCompleter<any> = PromiseWrapper.completer(); var c: PromiseCompleter<any> = PromiseWrapper.completer();
@ -112,7 +112,7 @@ export function main() {
}), testTimeout); }), testTimeout);
it('should produce long stack traces (when using microtasks)', it('should produce long stack traces (when using microtasks)',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
macroTask(() => { macroTask(() => {
var c: PromiseCompleter<any> = PromiseWrapper.completer(); var c: PromiseCompleter<any> = PromiseWrapper.completer();
@ -145,7 +145,7 @@ export function main() {
commonTests(); commonTests();
it('should disable long stack traces', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should disable long stack traces', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
macroTask(() => { macroTask(() => {
var c: PromiseCompleter<any> = PromiseWrapper.completer(); var c: PromiseCompleter<any> = PromiseWrapper.completer();
@ -213,13 +213,13 @@ function commonTests() {
}); });
describe('run', () => { 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(() => { expect(_zone.run(() => { return 6; })).toEqual(6); });
macroTask(() => { async.done(); }); macroTask(() => { async.done(); });
}), testTimeout); }), 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'))); runNgZoneNoLog(() => macroTask(_log.fn('run')));
macroTask(() => { macroTask(() => {
expect(_log.result()).toEqual('onUnstable; run; onMicrotaskEmpty; onStable'); expect(_log.result()).toEqual('onUnstable; run; onMicrotaskEmpty; onStable');
@ -227,7 +227,7 @@ function commonTests() {
}); });
}), testTimeout); }), 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 // 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 // then verified that onStable is only called once at the end
@ -251,7 +251,7 @@ function commonTests() {
}, resultTimer); }, resultTimer);
}), testTimeout); }), 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'))); runNgZoneNoLog(() => macroTask(_log.fn('run')));
macroTask(() => { macroTask(() => {
@ -261,7 +261,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
xit('should run subscriber listeners in the subscription zone (outside)', 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 // Each subscriber fires a microtask outside the Angular zone. The test
// then verifies that those microtasks do not cause additional digests. // then verifies that those microtasks do not cause additional digests.
@ -298,7 +298,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should run subscriber listeners in the subscription zone (inside)', 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'))); runNgZoneNoLog(() => macroTask(_log.fn('run')));
// the only practical use-case to run a callback inside the zone is // the only practical use-case to run a callback inside the zone is
@ -320,7 +320,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should run async tasks scheduled inside onStable outside Angular zone', 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'))); runNgZoneNoLog(() => macroTask(_log.fn('run')));
ObservableWrapper.subscribe(_zone.onStable, (_) => { ObservableWrapper.subscribe(_zone.onStable, (_) => {
@ -336,7 +336,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should call onUnstable once before a turn and onMicrotaskEmpty once after the turn', 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(() => { runNgZoneNoLog(() => {
macroTask(() => { macroTask(() => {
_log.add('run start'); _log.add('run start');
@ -354,7 +354,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should not run onUnstable and onMicrotaskEmpty for nested Zone.run', it('should not run onUnstable and onMicrotaskEmpty for nested Zone.run',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
runNgZoneNoLog(() => { runNgZoneNoLog(() => {
macroTask(() => { macroTask(() => {
_log.add('start run'); _log.add('start run');
@ -375,7 +375,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should not run onUnstable and onMicrotaskEmpty for nested Zone.run invoked from onMicrotaskEmpty', 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'))); runNgZoneNoLog(() => macroTask(_log.fn('start run')));
ObservableWrapper.subscribe(_zone.onMicrotaskEmpty, (_) => { ObservableWrapper.subscribe(_zone.onMicrotaskEmpty, (_) => {
@ -393,7 +393,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should call onUnstable and onMicrotaskEmpty before and after each top-level run', 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('run1')));
runNgZoneNoLog(() => macroTask(_log.fn('run2'))); runNgZoneNoLog(() => macroTask(_log.fn('run2')));
@ -406,7 +406,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should call onUnstable and onMicrotaskEmpty before and after each turn', 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 a: PromiseCompleter<string>;
var b: PromiseCompleter<string>; var b: PromiseCompleter<string>;
@ -437,7 +437,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should run a function outside of the angular zone', 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(() => { _zone.runOutsideAngular(_log.fn('run')); });
macroTask(() => { macroTask(() => {
@ -447,7 +447,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should call onUnstable and onMicrotaskEmpty when an inner microtask is scheduled from outside angular', 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>; var completer: PromiseCompleter<any>;
macroTask(() => { macroTask(() => {
@ -484,7 +484,7 @@ function commonTests() {
it('should call onUnstable only before executing a microtask scheduled in onMicrotaskEmpty ' + it('should call onUnstable only before executing a microtask scheduled in onMicrotaskEmpty ' +
'and not onMicrotaskEmpty after executing the task', 'and not onMicrotaskEmpty after executing the task',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
runNgZoneNoLog(() => macroTask(_log.fn('run'))); runNgZoneNoLog(() => macroTask(_log.fn('run')));
var ran = false; var ran = false;
@ -516,7 +516,7 @@ function commonTests() {
it('should call onUnstable and onMicrotaskEmpty for a scheduleMicroTask in onMicrotaskEmpty triggered by ' + it('should call onUnstable and onMicrotaskEmpty for a scheduleMicroTask in onMicrotaskEmpty triggered by ' +
'a scheduleMicroTask in run', 'a scheduleMicroTask in run',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
runNgZoneNoLog(() => { runNgZoneNoLog(() => {
macroTask(() => { macroTask(() => {
_log.add('scheduleMicroTask'); _log.add('scheduleMicroTask');
@ -551,7 +551,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should execute promises scheduled in onUnstable before promises scheduled in run', it('should execute promises scheduled in onUnstable before promises scheduled in run',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
runNgZoneNoLog(() => { runNgZoneNoLog(() => {
macroTask(() => { macroTask(() => {
_log.add('run start'); _log.add('run start');
@ -607,7 +607,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should call onUnstable and onMicrotaskEmpty before and after each turn, respectively', 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 completerA: PromiseCompleter<any>;
var completerB: PromiseCompleter<any>; var completerB: PromiseCompleter<any>;
@ -639,7 +639,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should call onUnstable and onMicrotaskEmpty before and after (respectively) all turns in a chain', 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(() => { runNgZoneNoLog(() => {
macroTask(() => { macroTask(() => {
_log.add('run start'); _log.add('run start');
@ -660,7 +660,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should call onUnstable and onMicrotaskEmpty for promises created outside of run body', 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>; var promise: Promise<any>;
runNgZoneNoLog(() => { runNgZoneNoLog(() => {
@ -685,7 +685,7 @@ function commonTests() {
describe('exceptions', () => { describe('exceptions', () => {
it('should call the on error callback when it is invoked via zone.runGuarded', 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(() => { macroTask(() => {
var exception = new BaseException('sync'); var exception = new BaseException('sync');
@ -698,7 +698,7 @@ function commonTests() {
}), testTimeout); }), testTimeout);
it('should not call the on error callback but rethrow when it is invoked via zone.run', 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(() => { macroTask(() => {
var exception = new BaseException('sync'); var exception = new BaseException('sync');
expect(() => _zone.run(() => { throw exception; })).toThrowError('sync'); expect(() => _zone.run(() => { throw exception; })).toThrowError('sync');
@ -708,7 +708,7 @@ function commonTests() {
}); });
}), testTimeout); }), 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'); var exception = new BaseException('async');
macroTask(() => { _zone.run(() => { scheduleMicroTask(() => { throw exception; }); }); }); macroTask(() => { _zone.run(() => { scheduleMicroTask(() => { throw exception; }); }); });

View File

@ -18,7 +18,7 @@ export function main() {
beforeEach(() => { emitter = new EventEmitter(); }); beforeEach(() => { emitter = new EventEmitter(); });
it("should call the next callback", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should call the next callback", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(emitter, (value) => { ObservableWrapper.subscribe(emitter, (value) => {
expect(value).toEqual(99); expect(value).toEqual(99);
async.done(); async.done();
@ -27,7 +27,7 @@ export function main() {
ObservableWrapper.callEmit(emitter, 99); ObservableWrapper.callEmit(emitter, 99);
})); }));
it("should call the throw callback", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should call the throw callback", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(emitter, (_) => {}, (error) => { ObservableWrapper.subscribe(emitter, (_) => {}, (error) => {
expect(error).toEqual("Boom"); expect(error).toEqual("Boom");
async.done(); async.done();
@ -35,12 +35,12 @@ export function main() {
ObservableWrapper.callError(emitter, "Boom"); ObservableWrapper.callError(emitter, "Boom");
})); }));
it("should work when no throw callback is provided", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should work when no throw callback is provided", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(emitter, (_) => {}, (_) => { async.done(); }); ObservableWrapper.subscribe(emitter, (_) => {}, (_) => { async.done(); });
ObservableWrapper.callError(emitter, "Boom"); ObservableWrapper.callError(emitter, "Boom");
})); }));
it("should call the return callback", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should call the return callback", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
ObservableWrapper.subscribe(emitter, (_) => {}, (_) => {}, () => { async.done(); }); ObservableWrapper.subscribe(emitter, (_) => {}, (_) => {}, () => { async.done(); });
ObservableWrapper.callComplete(emitter); ObservableWrapper.callComplete(emitter);
@ -57,7 +57,7 @@ export function main() {
// Makes Edge to disconnect when running the full unit test campaign // Makes Edge to disconnect when running the full unit test campaign
// TODO: remove when issue is solved: https://github.com/angular/angular/issues/4756 // TODO: remove when issue is solved: https://github.com/angular/angular/issues/4756
if (!browserDetection.isEdge) { if (!browserDetection.isEdge) {
it("delivers next and error events synchronously", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("delivers next and error events synchronously", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
let log: any[] /** TODO #9100 */ = []; let log: any[] /** TODO #9100 */ = [];
ObservableWrapper.subscribe(emitter, ObservableWrapper.subscribe(emitter,
(x) => { (x) => {
@ -96,7 +96,7 @@ export function main() {
}); });
} }
it('delivers events asynchronously when forced to async mode', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('delivers events asynchronously when forced to async mode', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var e = new EventEmitter(true); var e = new EventEmitter(true);
var log: any[] /** TODO #9100 */ = []; var log: any[] /** TODO #9100 */ = [];
ObservableWrapper.subscribe(e, (x) => { ObservableWrapper.subscribe(e, (x) => {
@ -149,7 +149,7 @@ export function main() {
// See ECMAScript 6 Spec 25.4.4.1 // See ECMAScript 6 Spec 25.4.4.1
describe("PromiseWrapper", () => { describe("PromiseWrapper", () => {
describe("#all", () => { describe("#all", () => {
it("should combine lists of Promises", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should combine lists of Promises", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var one = PromiseWrapper.completer(); var one = PromiseWrapper.completer();
var two = PromiseWrapper.completer(); var two = PromiseWrapper.completer();
@ -173,7 +173,7 @@ export function main() {
[null, true, false, 10, 'thing', {}, []].forEach(abruptCompletion => { [null, true, false, 10, 'thing', {}, []].forEach(abruptCompletion => {
it(`should treat "${abruptCompletion}" as an "abrupt completion"`, it(`should treat "${abruptCompletion}" as an "abrupt completion"`,
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var one = PromiseWrapper.completer(); var one = PromiseWrapper.completer();
var all = PromiseWrapper.all([one.promise, abruptCompletion]); var all = PromiseWrapper.all([one.promise, abruptCompletion]);

View File

@ -385,7 +385,7 @@ export function main() {
existingXHRs[0].dispatchEvent('load'); existingXHRs[0].dispatchEvent('load');
})); }));
it('should set ok to true on 200 return', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should set ok to true on 200 return', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var statusCode = 200; var statusCode = 200;
var connection = new XHRConnection(sampleRequest, new MockBrowserXHR(), var connection = new XHRConnection(sampleRequest, new MockBrowserXHR(),
new ResponseOptions({status: statusCode})); new ResponseOptions({status: statusCode}));
@ -399,7 +399,7 @@ export function main() {
existingXHRs[0].dispatchEvent('load'); existingXHRs[0].dispatchEvent('load');
})); }));
it('should set ok to false on 300 return', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should set ok to false on 300 return', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var statusCode = 300; var statusCode = 300;
var connection = new XHRConnection(sampleRequest, new MockBrowserXHR(), var connection = new XHRConnection(sampleRequest, new MockBrowserXHR(),
new ResponseOptions({status: statusCode})); new ResponseOptions({status: statusCode}));

View File

@ -64,7 +64,7 @@ class HelloRootCmp3 {
class HelloRootCmp4 { class HelloRootCmp4 {
appRef: any /** TODO #9100 */; appRef: any /** TODO #9100 */;
constructor(@Inject(ApplicationRef) appRef: any /** TODO #9100 */) { this.appRef = appRef; } constructor(@Inject(ApplicationRef) appRef: ApplicationRef) { this.appRef = appRef; }
} }
@Component({selector: 'hello-app'}) @Component({selector: 'hello-app'})
@ -78,7 +78,7 @@ class HelloRootDirectiveIsNotCmp {
@Component({selector: 'hello-app', template: ''}) @Component({selector: 'hello-app', template: ''})
class HelloOnDestroyTickCmp implements OnDestroy { class HelloOnDestroyTickCmp implements OnDestroy {
appRef: ApplicationRef; appRef: ApplicationRef;
constructor(@Inject(ApplicationRef) appRef: any /** TODO #9100 */) { this.appRef = appRef; } constructor(@Inject(ApplicationRef) appRef: ApplicationRef) { this.appRef = appRef; }
ngOnDestroy(): void { this.appRef.tick(); } ngOnDestroy(): void { this.appRef.tick(); }
} }
@ -129,7 +129,7 @@ export function main() {
expect(logger.res.join("")).toContain("Could not compile"); expect(logger.res.join("")).toContain("Could not compile");
}); });
it('should throw if no element is found', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should throw if no element is found', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var logger = new _ArrayLogger(); var logger = new _ArrayLogger();
var exceptionHandler = new ExceptionHandler(logger, false); var exceptionHandler = new ExceptionHandler(logger, false);
@ -144,7 +144,7 @@ export function main() {
if (getDOM().supportsDOMEvents()) { if (getDOM().supportsDOMEvents()) {
it('should forward the error to promise when bootstrap fails', it('should forward the error to promise when bootstrap fails',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
// Skip for dart since it causes a confusing error message in console when test passes. // Skip for dart since it causes a confusing error message in console when test passes.
var logger = new _ArrayLogger(); var logger = new _ArrayLogger();
var exceptionHandler = new ExceptionHandler(logger, false); var exceptionHandler = new ExceptionHandler(logger, false);
@ -159,7 +159,7 @@ export function main() {
})); }));
it('should invoke the default exception handler when bootstrap fails', it('should invoke the default exception handler when bootstrap fails',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var logger = new _ArrayLogger(); var logger = new _ArrayLogger();
var exceptionHandler = new ExceptionHandler(logger, false); var exceptionHandler = new ExceptionHandler(logger, false);
@ -179,7 +179,7 @@ export function main() {
expect(refPromise).not.toBe(null); expect(refPromise).not.toBe(null);
}); });
it('should display hello world', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should display hello world', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var refPromise = bootstrap(HelloRootCmp, testProviders); var refPromise = bootstrap(HelloRootCmp, testProviders);
refPromise.then((ref) => { refPromise.then((ref) => {
expect(el).toHaveText('hello world!'); expect(el).toHaveText('hello world!');
@ -187,7 +187,7 @@ export function main() {
}); });
})); }));
it('should support multiple calls to bootstrap', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support multiple calls to bootstrap', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var refPromise1 = bootstrap(HelloRootCmp, testProviders); var refPromise1 = bootstrap(HelloRootCmp, testProviders);
var refPromise2 = bootstrap(HelloRootCmp2, testProviders); var refPromise2 = bootstrap(HelloRootCmp2, testProviders);
PromiseWrapper.all([refPromise1, refPromise2]) PromiseWrapper.all([refPromise1, refPromise2])
@ -199,7 +199,7 @@ export function main() {
})); }));
it('should not crash if change detection is invoked when the root component is disposed', it('should not crash if change detection is invoked when the root component is disposed',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(HelloOnDestroyTickCmp, testProviders) bootstrap(HelloOnDestroyTickCmp, testProviders)
.then((ref) => { .then((ref) => {
expect(() => ref.destroy()).not.toThrow(); expect(() => ref.destroy()).not.toThrow();
@ -208,7 +208,7 @@ export function main() {
})); }));
it('should unregister change detectors when components are disposed', it('should unregister change detectors when components are disposed',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PLATFORM_PROVIDERS)); var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PLATFORM_PROVIDERS));
var app = var app =
ReflectiveInjector.resolveAndCreate([BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, testProviders], ReflectiveInjector.resolveAndCreate([BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS, testProviders],
@ -223,7 +223,7 @@ export function main() {
})); }));
it("should make the provided bindings available to the application component", it("should make the provided bindings available to the application component",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var refPromise = bootstrap( var refPromise = bootstrap(
HelloRootCmp3, [testProviders, {provide: "appBinding", useValue: "BoundValue"}]); HelloRootCmp3, [testProviders, {provide: "appBinding", useValue: "BoundValue"}]);
@ -234,7 +234,7 @@ export function main() {
})); }));
it("should avoid cyclic dependencies when root component requires Lifecycle through DI", it("should avoid cyclic dependencies when root component requires Lifecycle through DI",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var refPromise = bootstrap(HelloRootCmp4, testProviders); var refPromise = bootstrap(HelloRootCmp4, testProviders);
refPromise.then((ref) => { refPromise.then((ref) => {
@ -264,7 +264,7 @@ export function main() {
})); }));
it('should register each application with the testability registry', it('should register each application with the testability registry',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var refPromise1: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp, testProviders); var refPromise1: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp, testProviders);
var refPromise2: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp2, testProviders); var refPromise2: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp2, testProviders);

View File

@ -123,7 +123,7 @@ export function main() {
beforeEachProviders(() => [{provide: FancyService, useValue: new FancyService()}]); beforeEachProviders(() => [{provide: FancyService, useValue: new FancyService()}]);
it('provides a real XHR instance', it('provides a real XHR instance',
inject([XHR], (xhr: any /** TODO #9100 */) => { expect(xhr).toBeAnInstanceOf(XHRImpl); })); inject([XHR], (xhr: XHR) => { expect(xhr).toBeAnInstanceOf(XHRImpl); }));
it('should allow the use of fakeAsync', fakeAsync(inject([FancyService], (service: any /** TODO #9100 */) => { it('should allow the use of fakeAsync', fakeAsync(inject([FancyService], (service: any /** TODO #9100 */) => {
var value: any /** TODO #9100 */; var value: any /** TODO #9100 */;
@ -156,7 +156,7 @@ export function main() {
it('should fail with an error from a promise', it('should fail with an error from a promise',
async(inject([TestComponentBuilder], async(inject([TestComponentBuilder],
(tcb: any /** TODO #9100 */) => { return tcb.createAsync(BadTemplateUrl); }))); (tcb: TestComponentBuilder) => { return tcb.createAsync(BadTemplateUrl); })));
itPromise.then(() => { done.fail('Expected test to fail, but it did not'); }, (err) => { itPromise.then(() => { done.fail('Expected test to fail, but it did not'); }, (err) => {
expect(err).toEqual('Uncaught (in promise): Failed to load non-existant.html'); expect(err).toEqual('Uncaught (in promise): Failed to load non-existant.html');

View File

@ -24,7 +24,7 @@ export function main() {
beforeEach(() => { bus = createConnectedMessageBus(); }); beforeEach(() => { bus = createConnectedMessageBus(); });
it("should pass messages in the same channel from sink to source", it("should pass messages in the same channel from sink to source",
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
const CHANNEL = "CHANNEL 1"; const CHANNEL = "CHANNEL 1";
const MESSAGE = "Test message"; const MESSAGE = "Test message";
bus.initChannel(CHANNEL, false); bus.initChannel(CHANNEL, false);
@ -38,7 +38,7 @@ export function main() {
ObservableWrapper.callEmit(toEmitter, MESSAGE); ObservableWrapper.callEmit(toEmitter, MESSAGE);
})); }));
it("should broadcast", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should broadcast", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
const CHANNEL = "CHANNEL 1"; const CHANNEL = "CHANNEL 1";
const MESSAGE = "TESTING"; const MESSAGE = "TESTING";
const NUM_LISTENERS = 2; const NUM_LISTENERS = 2;
@ -62,7 +62,7 @@ export function main() {
ObservableWrapper.callEmit(toEmitter, MESSAGE); ObservableWrapper.callEmit(toEmitter, MESSAGE);
})); }));
it("should keep channels independent", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should keep channels independent", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
const CHANNEL_ONE = "CHANNEL 1"; const CHANNEL_ONE = "CHANNEL 1";
const CHANNEL_TWO = "CHANNEL 2"; const CHANNEL_TWO = "CHANNEL 2";
const MESSAGE_ONE = "This is a message on CHANNEL 1"; const MESSAGE_ONE = "This is a message on CHANNEL 1";
@ -114,7 +114,7 @@ export function main() {
it("should buffer messages and wait for the zone to exit before sending", it("should buffer messages and wait for the zone to exit before sending",
withProviders(() => [{provide: NgZone, useClass: MockNgZone}]) withProviders(() => [{provide: NgZone, useClass: MockNgZone}])
.inject([AsyncTestCompleter, NgZone], .inject([AsyncTestCompleter, NgZone],
(async: any /** TODO #9100 */, zone: MockNgZone) => { (async: AsyncTestCompleter, zone: MockNgZone) => {
bus = createConnectedMessageBus(); bus = createConnectedMessageBus();
setup(true, zone); setup(true, zone);
@ -137,7 +137,7 @@ export function main() {
500); 500);
it("should send messages immediatly when run outside the zone", it("should send messages immediatly when run outside the zone",
inject([AsyncTestCompleter, NgZone], (async: any /** TODO #9100 */, zone: MockNgZone) => { inject([AsyncTestCompleter, NgZone], (async: AsyncTestCompleter, zone: MockNgZone) => {
bus = createConnectedMessageBus(); bus = createConnectedMessageBus();
setup(false, zone); setup(false, zone);

View File

@ -38,7 +38,7 @@ export function main() {
messageBuses.worker.initChannel(CHANNEL); messageBuses.worker.initChannel(CHANNEL);
}); });
it("should call registered method with correct arguments", it("should call registered method with correct arguments",
inject([Serializer], (serializer: any /** TODO #9100 */) => { inject([Serializer], (serializer: Serializer) => {
var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL); var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL);
broker.registerMethod(TEST_METHOD, [PRIMITIVE, PRIMITIVE], (arg1, arg2) => { broker.registerMethod(TEST_METHOD, [PRIMITIVE, PRIMITIVE], (arg1, arg2) => {
expect(arg1).toEqual(PASSED_ARG_1); expect(arg1).toEqual(PASSED_ARG_1);
@ -51,7 +51,7 @@ export function main() {
// TODO(pkozlowski): this fails only in Edge with // TODO(pkozlowski): this fails only in Edge with
// "No provider for RenderStore! (Serializer -> RenderStore)" // "No provider for RenderStore! (Serializer -> RenderStore)"
if (!browserDetection.isEdge) { if (!browserDetection.isEdge) {
it("should return promises to the worker", inject([Serializer], (serializer: any /** TODO #9100 */) => { it("should return promises to the worker", inject([Serializer], (serializer: Serializer) => {
var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL); var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL);
broker.registerMethod(TEST_METHOD, [PRIMITIVE], (arg1) => { broker.registerMethod(TEST_METHOD, [PRIMITIVE], (arg1) => {
expect(arg1).toEqual(PASSED_ARG_1); expect(arg1).toEqual(PASSED_ARG_1);

View File

@ -81,7 +81,7 @@ export function main() {
expect(() => platformLocation.pathname = "TEST").toThrowError(); expect(() => platformLocation.pathname = "TEST").toThrowError();
}); });
it("should send pathname to render thread", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it("should send pathname to render thread", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
let platformLocation = createWebWorkerPlatformLocation(TEST_LOCATION); let platformLocation = createWebWorkerPlatformLocation(TEST_LOCATION);
platformLocation.init().then((_) => { platformLocation.init().then((_) => {
let PATHNAME = "/test"; let PATHNAME = "/test";

View File

@ -100,7 +100,7 @@ export function main() {
{provide: RenderStore, useValue: workerRenderStore}, {provide: RenderStore, useValue: workerRenderStore},
{ {
provide: RootRenderer, provide: RootRenderer,
useFactory: (workerSerializer: any /** TODO #9100 */) => { useFactory: (workerSerializer: Serializer) => {
return createWorkerRenderer(workerSerializer, uiSerializer, domRootRenderer, return createWorkerRenderer(workerSerializer, uiSerializer, domRootRenderer,
uiRenderStore, workerRenderStore); uiRenderStore, workerRenderStore);
}, },
@ -119,7 +119,7 @@ export function main() {
} }
it('should update text nodes', it('should update text nodes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp2, new ViewMetadata({template: '<div>{{ctxProp}}</div>'})) tcb.overrideView(MyComp2, new ViewMetadata({template: '<div>{{ctxProp}}</div>'}))
.createAsync(MyComp2) .createAsync(MyComp2)
.then((fixture) => { .then((fixture) => {
@ -135,7 +135,7 @@ export function main() {
})); }));
it('should update any element property/attributes/class/style(s) independent of the compilation on the root element and other elements', it('should update any element property/attributes/class/style(s) independent of the compilation on the root element and other elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp2, new ViewMetadata( tcb.overrideView(MyComp2, new ViewMetadata(
{template: '<input [title]="y" style="position:absolute">'})) {template: '<input [title]="y" style="position:absolute">'}))
.createAsync(MyComp2) .createAsync(MyComp2)
@ -170,7 +170,7 @@ export function main() {
})); }));
it('should update any template comment property/attributes', it('should update any template comment property/attributes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var tpl = '<template [ngIf]="ctxBoolProp"></template>'; var tpl = '<template [ngIf]="ctxBoolProp"></template>';
tcb.overrideView(MyComp2, new ViewMetadata({template: tpl, directives: [NgIf]})) tcb.overrideView(MyComp2, new ViewMetadata({template: tpl, directives: [NgIf]}))
@ -185,7 +185,7 @@ export function main() {
})); }));
it('should add and remove fragments', it('should add and remove fragments',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp2, new ViewMetadata({ tcb.overrideView(MyComp2, new ViewMetadata({
template: '<template [ngIf]="ctxBoolProp">hello</template>', template: '<template [ngIf]="ctxBoolProp">hello</template>',
directives: [NgIf] directives: [NgIf]
@ -210,7 +210,7 @@ export function main() {
if (getDOM().supportsDOMEvents()) { if (getDOM().supportsDOMEvents()) {
it('should call actions on the element', it('should call actions on the element',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp2, new ViewMetadata({template: '<input [title]="y">'})) tcb.overrideView(MyComp2, new ViewMetadata({template: '<input [title]="y">'}))
.createAsync(MyComp2) .createAsync(MyComp2)
.then((fixture) => { .then((fixture) => {
@ -225,7 +225,7 @@ export function main() {
})); }));
it('should listen to events', it('should listen to events',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
tcb.overrideView(MyComp2, tcb.overrideView(MyComp2,
new ViewMetadata({template: '<input (change)="ctxNumProp = 1">'})) new ViewMetadata({template: '<input (change)="ctxNumProp = 1">'}))
.createAsync(MyComp2) .createAsync(MyComp2)

View File

@ -43,7 +43,7 @@ export function main() {
}); });
it('should resolve the Promise with the cached file content on success', it('should resolve the Promise with the cached file content on success',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
setTemplateCache({'test.html': '<div>Hello</div>'}); setTemplateCache({'test.html': '<div>Hello</div>'});
xhr = new CachedXHR(); xhr = new CachedXHR();
xhr.get('test.html') xhr.get('test.html')
@ -53,7 +53,7 @@ export function main() {
}); });
})); }));
it('should reject the Promise on failure', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should reject the Promise on failure', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
xhr = new CachedXHR(); xhr = new CachedXHR();
xhr.get('unknown.html') xhr.get('unknown.html')
.then((text) => { throw new BaseException('Not expected to succeed.'); }) .then((text) => { throw new BaseException('Not expected to succeed.'); })

View File

@ -28,14 +28,14 @@ export function main() {
beforeEach(() => { xhr = new XHRImpl(); }); beforeEach(() => { xhr = new XHRImpl(); });
it('should resolve the Promise with the file content on success', it('should resolve the Promise with the file content on success',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
xhr.get(url200).then((text) => { xhr.get(url200).then((text) => {
expect(text.trim()).toEqual('<p>hey</p>'); expect(text.trim()).toEqual('<p>hey</p>');
async.done(); async.done();
}); });
}), 10000); }), 10000);
it('should reject the Promise on failure', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should reject the Promise on failure', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
PromiseWrapper.catchError(xhr.get(url404), (e) => { PromiseWrapper.catchError(xhr.get(url404), (e) => {
expect(e).toEqual(`Failed to load ${url404}`); expect(e).toEqual(`Failed to load ${url404}`);
async.done(); async.done();

View File

@ -43,7 +43,7 @@ export function main() {
beforeEach(inject([TestComponentBuilder], (tcBuilder: any /** TODO #9100 */) => { tcb = tcBuilder; })); beforeEach(inject([TestComponentBuilder], (tcBuilder: any /** TODO #9100 */) => { tcb = tcBuilder; }));
it('should update a[href] attribute', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should update a[href] attribute', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
tcb.createAsync(TestComponent) tcb.createAsync(TestComponent)
.then((testComponent) => { .then((testComponent) => {
@ -57,7 +57,7 @@ export function main() {
it('should call router.navigate when a link is clicked', it('should call router.navigate when a link is clicked',
inject([AsyncTestCompleter, Router], (async: any /** TODO #9100 */, router: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Router], (async: AsyncTestCompleter, router: any /** TODO #9100 */) => {
tcb.createAsync(TestComponent) tcb.createAsync(TestComponent)
.then((testComponent) => { .then((testComponent) => {
@ -71,7 +71,7 @@ export function main() {
})); }));
it('should call router.navigate when a link is clicked if target is _self', it('should call router.navigate when a link is clicked if target is _self',
inject([AsyncTestCompleter, Router], (async: any /** TODO #9100 */, router: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Router], (async: AsyncTestCompleter, router: any /** TODO #9100 */) => {
tcb.createAsync(TestComponent) tcb.createAsync(TestComponent)
.then((testComponent) => { .then((testComponent) => {
@ -84,7 +84,7 @@ export function main() {
})); }));
it('should NOT call router.navigate when a link is clicked if target is set to other than _self', it('should NOT call router.navigate when a link is clicked if target is set to other than _self',
inject([AsyncTestCompleter, Router], (async: any /** TODO #9100 */, router: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Router], (async: AsyncTestCompleter, router: any /** TODO #9100 */) => {
tcb.createAsync(TestComponent) tcb.createAsync(TestComponent)
.then((testComponent) => { .then((testComponent) => {

View File

@ -56,7 +56,7 @@ export function main() {
// do not refactor out the `bootstrap` functionality. We still want to // do not refactor out the `bootstrap` functionality. We still want to
// keep this test around so we can ensure that bootstrap a router works // keep this test around so we can ensure that bootstrap a router works
it('should bootstrap a simple app', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should bootstrap a simple app', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var fakeDoc = getDOM().createHtmlDocument(); var fakeDoc = getDOM().createHtmlDocument();
var el = getDOM().createElement('app-cmp', fakeDoc); var el = getDOM().createElement('app-cmp', fakeDoc);
getDOM().appendChild(fakeDoc.body, el); getDOM().appendChild(fakeDoc.body, el);
@ -83,7 +83,7 @@ export function main() {
beforeEachProviders(() => [{provide: ROUTER_PRIMARY_COMPONENT, useValue: BrokenAppCmp}]); beforeEachProviders(() => [{provide: ROUTER_PRIMARY_COMPONENT, useValue: BrokenAppCmp}]);
it('should rethrow exceptions from component constructors', it('should rethrow exceptions from component constructors',
inject([AsyncTestCompleter, TestComponentBuilder], (async: any /** TODO #9100 */, tcb: TestComponentBuilder) => { inject([AsyncTestCompleter, TestComponentBuilder], (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
tcb.createAsync(AppCmp).then((fixture) => { tcb.createAsync(AppCmp).then((fixture) => {
var router = fixture.debugElement.componentInstance.router; var router = fixture.debugElement.componentInstance.router;
PromiseWrapper.catchError(router.navigateByUrl('/cause-error'), (error) => { PromiseWrapper.catchError(router.navigateByUrl('/cause-error'), (error) => {
@ -98,7 +98,7 @@ export function main() {
beforeEachProviders(() => [{provide: ROUTER_PRIMARY_COMPONENT, useValue: HierarchyAppCmp}]); beforeEachProviders(() => [{provide: ROUTER_PRIMARY_COMPONENT, useValue: HierarchyAppCmp}]);
it('should change the url without pushing a new history state for back navigations', it('should change the url without pushing a new history state for back navigations',
inject([AsyncTestCompleter, TestComponentBuilder], (async: any /** TODO #9100 */, tcb: TestComponentBuilder) => { inject([AsyncTestCompleter, TestComponentBuilder], (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
tcb.createAsync(HierarchyAppCmp) tcb.createAsync(HierarchyAppCmp)
.then((fixture) => { .then((fixture) => {
@ -149,7 +149,7 @@ export function main() {
() => { return [{provide: ROUTER_PRIMARY_COMPONENT, useValue: HierarchyAppCmp}]; }); () => { return [{provide: ROUTER_PRIMARY_COMPONENT, useValue: HierarchyAppCmp}]; });
it('should bootstrap an app with a hierarchy', it('should bootstrap an app with a hierarchy',
inject([AsyncTestCompleter, TestComponentBuilder], (async: any /** TODO #9100 */, tcb: TestComponentBuilder) => { inject([AsyncTestCompleter, TestComponentBuilder], (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
tcb.createAsync(HierarchyAppCmp) tcb.createAsync(HierarchyAppCmp)
.then((fixture) => { .then((fixture) => {
@ -170,7 +170,7 @@ export function main() {
beforeEachProviders(() => { return [{provide: APP_BASE_HREF, useValue: '/my/app'}]; }); beforeEachProviders(() => { return [{provide: APP_BASE_HREF, useValue: '/my/app'}]; });
it('should bootstrap', it('should bootstrap',
inject([AsyncTestCompleter, TestComponentBuilder], inject([AsyncTestCompleter, TestComponentBuilder],
(async: any /** TODO #9100 */, tcb: TestComponentBuilder) => { (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
tcb.createAsync(HierarchyAppCmp) tcb.createAsync(HierarchyAppCmp)
.then((fixture) => { .then((fixture) => {
@ -194,7 +194,7 @@ export function main() {
() => { return [{provide: ROUTER_PRIMARY_COMPONENT, useValue: QueryStringAppCmp}]; }); () => { return [{provide: ROUTER_PRIMARY_COMPONENT, useValue: QueryStringAppCmp}]; });
it('should recognize and return querystring params with the injected RouteParams', it('should recognize and return querystring params with the injected RouteParams',
inject([AsyncTestCompleter, TestComponentBuilder], (async: any /** TODO #9100 */, tcb: TestComponentBuilder) => { inject([AsyncTestCompleter, TestComponentBuilder], (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
tcb.createAsync(QueryStringAppCmp) tcb.createAsync(QueryStringAppCmp)
.then((fixture) => { .then((fixture) => {
var router = fixture.debugElement.componentInstance.router; var router = fixture.debugElement.componentInstance.router;
@ -223,7 +223,7 @@ export function main() {
(testComponentBuilder: any /** TODO #9100 */) => { tcb = testComponentBuilder; })); (testComponentBuilder: any /** TODO #9100 */) => { tcb = testComponentBuilder; }));
it('should get a reference and pass data to components loaded inside of outlets', it('should get a reference and pass data to components loaded inside of outlets',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
tcb.createAsync(AppWithOutletListeners) tcb.createAsync(AppWithOutletListeners)
.then(fixture => { .then(fixture => {
let appInstance = fixture.debugElement.componentInstance; let appInstance = fixture.debugElement.componentInstance;

View File

@ -49,7 +49,7 @@ function asyncRoutesWithoutChildrenWithRouteData() {
rtr = router; rtr = router;
})); }));
it('should inject route data into the component', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should inject route data into the component', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -65,7 +65,7 @@ function asyncRoutesWithoutChildrenWithRouteData() {
})); }));
it('should inject empty object if the route has no data property', it('should inject empty object if the route has no data property',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -91,7 +91,7 @@ function asyncRoutesWithoutChildrenWithoutParams() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -104,7 +104,7 @@ function asyncRoutesWithoutChildrenWithoutParams() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -117,7 +117,7 @@ function asyncRoutesWithoutChildrenWithoutParams() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -130,7 +130,7 @@ function asyncRoutesWithoutChildrenWithoutParams() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -164,7 +164,7 @@ function asyncRoutesWithoutChildrenWithParams() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -177,7 +177,7 @@ function asyncRoutesWithoutChildrenWithParams() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -190,7 +190,7 @@ function asyncRoutesWithoutChildrenWithParams() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -203,7 +203,7 @@ function asyncRoutesWithoutChildrenWithParams() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -224,7 +224,7 @@ function asyncRoutesWithoutChildrenWithParams() {
})); }));
it('should navigate between components with different parameters', it('should navigate between components with different parameters',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -256,7 +256,7 @@ function asyncRoutesWithSyncChildrenWithoutDefaultRoutes() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -269,7 +269,7 @@ function asyncRoutesWithSyncChildrenWithoutDefaultRoutes() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -282,7 +282,7 @@ function asyncRoutesWithSyncChildrenWithoutDefaultRoutes() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['Parent']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -295,7 +295,7 @@ function asyncRoutesWithSyncChildrenWithoutDefaultRoutes() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -330,7 +330,7 @@ function asyncRoutesWithSyncChildrenWithDefaultRoutes() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -344,7 +344,7 @@ function asyncRoutesWithSyncChildrenWithDefaultRoutes() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -358,7 +358,7 @@ function asyncRoutesWithSyncChildrenWithDefaultRoutes() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -372,7 +372,7 @@ function asyncRoutesWithSyncChildrenWithDefaultRoutes() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -408,7 +408,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithoutDefaultRoutes() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -422,7 +422,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithoutDefaultRoutes() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -436,7 +436,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithoutDefaultRoutes() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -450,7 +450,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithoutDefaultRoutes() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -486,7 +486,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithDefaultRoutes() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -501,7 +501,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithDefaultRoutes() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -516,7 +516,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithDefaultRoutes() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['Parent']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -531,7 +531,7 @@ function asyncRoutesWithAsyncChildrenWithoutParamsWithDefaultRoutes() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['Parent']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -568,7 +568,7 @@ function asyncRoutesWithAsyncChildrenWithParamsWithoutDefaultRoutes() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `{ <router-outlet></router-outlet> }`) compile(tcb, `{ <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -583,7 +583,7 @@ function asyncRoutesWithAsyncChildrenWithParamsWithoutDefaultRoutes() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `{ <router-outlet></router-outlet> }`) compile(tcb, `{ <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -598,7 +598,7 @@ function asyncRoutesWithAsyncChildrenWithParamsWithoutDefaultRoutes() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`) `<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`)
@ -614,7 +614,7 @@ function asyncRoutesWithAsyncChildrenWithParamsWithoutDefaultRoutes() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`) `<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`)

View File

@ -34,7 +34,7 @@ function auxRoutes() {
rtr = router; rtr = router;
})); }));
it('should recognize and navigate from the URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize and navigate from the URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -49,7 +49,7 @@ function auxRoutes() {
}); });
})); }));
it('should navigate via the link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate via the link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -64,7 +64,7 @@ function auxRoutes() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/', ['Modal']]">open modal</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) `<a [routerLink]="['/', ['Modal']]">open modal</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)
@ -81,7 +81,7 @@ function auxRoutes() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/', ['Modal']]">open modal</a> | <a [routerLink]="['/Hello']">hello</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) `<a [routerLink]="['/', ['Modal']]">open modal</a> | <a [routerLink]="['/Hello']">hello</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)
@ -137,7 +137,7 @@ function auxRoutesWithAPrimaryRoute() {
rtr = router; rtr = router;
})); }));
it('should recognize and navigate from the URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize and navigate from the URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -152,7 +152,7 @@ function auxRoutesWithAPrimaryRoute() {
}); });
})); }));
it('should navigate via the link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate via the link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) compile(tcb, `main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -167,7 +167,7 @@ function auxRoutesWithAPrimaryRoute() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/Hello', ['Modal']]">open modal</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) `<a [routerLink]="['/Hello', ['Modal']]">open modal</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)
@ -184,7 +184,7 @@ function auxRoutesWithAPrimaryRoute() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/Hello', ['Modal']]">open modal</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`) `<a [routerLink]="['/Hello', ['Modal']]">open modal</a> | main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`)

View File

@ -41,7 +41,7 @@ function syncRoutesWithoutChildrenWithoutParams() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => .then((_) =>
@ -54,7 +54,7 @@ function syncRoutesWithoutChildrenWithoutParams() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => .then((_) =>
@ -67,7 +67,7 @@ function syncRoutesWithoutChildrenWithoutParams() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => .then((_) =>
@ -80,7 +80,7 @@ function syncRoutesWithoutChildrenWithoutParams() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['Hello']">go to hello</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => .then((_) =>
@ -114,7 +114,7 @@ function syncRoutesWithoutChildrenWithParams() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -127,7 +127,7 @@ function syncRoutesWithoutChildrenWithParams() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -140,7 +140,7 @@ function syncRoutesWithoutChildrenWithParams() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -153,7 +153,7 @@ function syncRoutesWithoutChildrenWithParams() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`) compile(tcb, `<a [routerLink]="['User', {name: 'naomi'}]">greet naomi</a> | <router-outlet></router-outlet>`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -174,7 +174,7 @@ function syncRoutesWithoutChildrenWithParams() {
})); }));
it('should navigate between components with different parameters', it('should navigate between components with different parameters',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -206,7 +206,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithoutParams() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -219,7 +219,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithoutParams() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -232,7 +232,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithoutParams() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -245,7 +245,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithoutParams() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['Parent', 'Child']">nav to child</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -280,7 +280,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithParams() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `{ <router-outlet></router-outlet> }`) compile(tcb, `{ <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -294,7 +294,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithParams() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `{ <router-outlet></router-outlet> }`) compile(tcb, `{ <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -308,7 +308,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithParams() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`) `<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`)
@ -323,7 +323,7 @@ function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithParams() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile( compile(
tcb, tcb,
`<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`) `<a [routerLink]="['/Team', {id: 'angular'}, 'User', {name: 'matias'}]">nav to matias</a> { <router-outlet></router-outlet> }`)
@ -360,7 +360,7 @@ function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
rtr = router; rtr = router;
})); }));
it('should navigate by URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then( .then(
@ -374,7 +374,7 @@ function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
}); });
})); }));
it('should navigate by link DSL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `outer { <router-outlet></router-outlet> }`) compile(tcb, `outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then( .then(
@ -388,7 +388,7 @@ function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
}); });
})); }));
it('should generate a link URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then( .then(
@ -402,7 +402,7 @@ function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
})); }));
it('should navigate from a link click', it('should navigate from a link click',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`) compile(tcb, `<a [routerLink]="['/Parent']">link to inner</a> | outer { <router-outlet></router-outlet> }`)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then( .then(
@ -440,7 +440,7 @@ function syncRoutesWithDynamicComponents() {
it('should work', it('should work',
inject([AsyncTestCompleter], inject([AsyncTestCompleter],
(async: any /** TODO #9100 */) => {tcb.createAsync(DynamicLoaderCmp) (async: AsyncTestCompleter) => {tcb.createAsync(DynamicLoaderCmp)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/', component: HelloCmp})])) .then((_) => rtr.config([new Route({path: '/', component: HelloCmp})]))
.then((_) => { .then((_) => {

View File

@ -61,7 +61,7 @@ export function main() {
eventBus = new EventEmitter(); eventBus = new EventEmitter();
})); }));
it('should call the routerOnActivate hook', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should call the routerOnActivate hook', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -75,7 +75,7 @@ export function main() {
})); }));
it('should wait for a parent component\'s routerOnActivate hook to resolve before calling its child\'s', it('should wait for a parent component\'s routerOnActivate hook to resolve before calling its child\'s',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -98,7 +98,7 @@ export function main() {
}); });
})); }));
it('should call the routerOnDeactivate hook', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should call the routerOnDeactivate hook', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -113,7 +113,7 @@ export function main() {
})); }));
it('should wait for a child component\'s routerOnDeactivate hook to resolve before calling its parent\'s', it('should wait for a child component\'s routerOnDeactivate hook to resolve before calling its parent\'s',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -139,7 +139,7 @@ export function main() {
})); }));
it('should reuse a component when the routerCanReuse hook returns true', it('should reuse a component when the routerCanReuse hook returns true',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -162,7 +162,7 @@ export function main() {
it('should not reuse a component when the routerCanReuse hook returns false', it('should not reuse a component when the routerCanReuse hook returns false',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -185,7 +185,7 @@ export function main() {
it('should navigate when routerCanActivate returns true', it('should navigate when routerCanActivate returns true',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -206,7 +206,7 @@ export function main() {
})); }));
it('should not navigate when routerCanActivate returns false', it('should not navigate when routerCanActivate returns false',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -227,7 +227,7 @@ export function main() {
})); }));
it('should navigate away when routerCanDeactivate returns true', it('should navigate away when routerCanDeactivate returns true',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -253,7 +253,7 @@ export function main() {
})); }));
it('should not navigate away when routerCanDeactivate returns false', it('should not navigate away when routerCanDeactivate returns false',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -280,7 +280,7 @@ export function main() {
it('should run activation and deactivation hooks in the correct order', it('should run activation and deactivation hooks in the correct order',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -307,7 +307,7 @@ export function main() {
}); });
})); }));
it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
@ -337,7 +337,7 @@ export function main() {
}); });
})); }));
it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
.then((_) => rtr.navigateByUrl('/reuse-hooks/1')) .then((_) => rtr.navigateByUrl('/reuse-hooks/1'))

View File

@ -47,7 +47,7 @@ export function main() {
cmpInstanceCount = 0; cmpInstanceCount = 0;
})); }));
it('should work in a simple case', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should work in a simple case', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})])) .then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))
@ -61,7 +61,7 @@ export function main() {
it('should navigate between components with different parameters', it('should navigate between components with different parameters',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/user/:name', component: UserCmp})])) .then((_) => rtr.config([new Route({path: '/user/:name', component: UserCmp})]))
@ -78,7 +78,7 @@ export function main() {
}); });
})); }));
it('should navigate to child routes', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate to child routes', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, 'outer { <router-outlet></router-outlet> }') compile(tcb, 'outer { <router-outlet></router-outlet> }')
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})])) .then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
@ -91,7 +91,7 @@ export function main() {
})); }));
it('should navigate to child routes that capture an empty path', it('should navigate to child routes that capture an empty path',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, 'outer { <router-outlet></router-outlet> }') compile(tcb, 'outer { <router-outlet></router-outlet> }')
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
@ -105,7 +105,7 @@ export function main() {
})); }));
it('should navigate to child routes when the root component has an empty path', it('should navigate to child routes when the root component has an empty path',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb, 'outer { <router-outlet></router-outlet> }') compile(tcb, 'outer { <router-outlet></router-outlet> }')
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/...', component: ParentCmp})])) .then((_) => rtr.config([new Route({path: '/...', component: ParentCmp})]))
@ -118,7 +118,7 @@ export function main() {
}); });
})); }));
it('should navigate to child routes of async routes', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate to child routes of async routes', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, 'outer { <router-outlet></router-outlet> }') compile(tcb, 'outer { <router-outlet></router-outlet> }')
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new AsyncRoute({path: '/a/...', loader: parentLoader})])) .then((_) => rtr.config([new AsyncRoute({path: '/a/...', loader: parentLoader})]))
@ -132,7 +132,7 @@ export function main() {
it('should replace state when normalized paths are equal', it('should replace state when normalized paths are equal',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => location.setInitialPath("/test/")) .then((_) => location.setInitialPath("/test/"))
@ -146,7 +146,7 @@ export function main() {
}); });
})); }));
it('should reuse common parent components', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should reuse common parent components', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})])) .then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
@ -167,7 +167,7 @@ export function main() {
})); }));
it('should not reuse children when parent components change', it('should not reuse children when parent components change',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})])) .then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
@ -188,7 +188,7 @@ export function main() {
}); });
})); }));
it('should inject route data into component', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should inject route data into component', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -203,7 +203,7 @@ export function main() {
})); }));
it('should inject route data into component with AsyncRoute', it('should inject route data into component with AsyncRoute',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -219,7 +219,7 @@ export function main() {
})); }));
it('should inject empty object if the route has no data property', it('should inject empty object if the route has no data property',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb) compile(tcb)
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config( .then((_) => rtr.config(
@ -233,7 +233,7 @@ export function main() {
})); }));
it('should fire an event for each activated component', it('should fire an event for each activated component',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile(tcb, '<router-outlet (activate)="activatedCmp = $event"></router-outlet>') compile(tcb, '<router-outlet (activate)="activatedCmp = $event"></router-outlet>')
.then((rtc) => {fixture = rtc}) .then((rtc) => {fixture = rtc})
.then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})])) .then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))

View File

@ -47,7 +47,7 @@ export function main() {
it('should apply when navigating by URL', it('should apply when navigating by URL',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb) compile(tcb)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -65,7 +65,7 @@ export function main() {
it('should recognize and apply absolute redirects', it('should recognize and apply absolute redirects',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb) compile(tcb)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -83,7 +83,7 @@ export function main() {
it('should recognize and apply relative child redirects', it('should recognize and apply relative child redirects',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb) compile(tcb)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -101,7 +101,7 @@ export function main() {
it('should recognize and apply relative parent redirects', it('should recognize and apply relative parent redirects',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb) compile(tcb)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([
@ -119,7 +119,7 @@ export function main() {
it('should not redirect when redirect is less specific than other matching routes', it('should not redirect when redirect is less specific than other matching routes',
inject([AsyncTestCompleter, Location], (async: any /** TODO #9100 */, location: any /** TODO #9100 */) => { inject([AsyncTestCompleter, Location], (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
compile(tcb) compile(tcb)
.then((rtc) => {rootTC = rtc}) .then((rtc) => {rootTC = rtc})
.then((_) => rtr.config([ .then((_) => rtr.config([

View File

@ -67,7 +67,7 @@ export function main() {
} }
it('should generate absolute hrefs that include the base href', it('should generate absolute hrefs that include the base href',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
(<SpyLocation>location).setBaseHref('/my/base'); (<SpyLocation>location).setBaseHref('/my/base');
compile('<a href="hello" [routerLink]="[\'./User\']"></a>') compile('<a href="hello" [routerLink]="[\'./User\']"></a>')
.then((_) => router.config( .then((_) => router.config(
@ -81,7 +81,7 @@ export function main() {
})); }));
it('should generate link hrefs without params', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate link hrefs without params', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile('<a href="hello" [routerLink]="[\'./User\']"></a>') compile('<a href="hello" [routerLink]="[\'./User\']"></a>')
.then((_) => router.config( .then((_) => router.config(
[new Route({path: '/user', component: UserCmp, name: 'User'})])) [new Route({path: '/user', component: UserCmp, name: 'User'})]))
@ -94,7 +94,7 @@ export function main() {
})); }));
it('should generate link hrefs with params', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate link hrefs with params', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile('<a href="hello" [routerLink]="[\'./User\', {name: name}]">{{name}}</a>') compile('<a href="hello" [routerLink]="[\'./User\', {name: name}]">{{name}}</a>')
.then((_) => router.config( .then((_) => router.config(
[new Route({path: '/user/:name', component: UserCmp, name: 'User'})])) [new Route({path: '/user/:name', component: UserCmp, name: 'User'})]))
@ -109,7 +109,7 @@ export function main() {
})); }));
it('should generate link hrefs from a child to its sibling', it('should generate link hrefs from a child to its sibling',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile() compile()
.then( .then(
(_) => router.config( (_) => router.config(
@ -123,7 +123,7 @@ export function main() {
})); }));
it('should generate link hrefs from a child to its sibling with no leading slash', it('should generate link hrefs from a child to its sibling with no leading slash',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile() compile()
.then((_) => router.config([ .then((_) => router.config([
new Route( new Route(
@ -138,7 +138,7 @@ export function main() {
})); }));
it('should generate link hrefs to a child with no leading slash', it('should generate link hrefs to a child with no leading slash',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile() compile()
.then((_) => router.config([ .then((_) => router.config([
new Route({path: '/book/:title/...', component: NoPrefixBookCmp, name: 'Book'}) new Route({path: '/book/:title/...', component: NoPrefixBookCmp, name: 'Book'})
@ -152,7 +152,7 @@ export function main() {
})); }));
it('should throw when links without a leading slash are ambiguous', it('should throw when links without a leading slash are ambiguous',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile() compile()
.then((_) => router.config([ .then((_) => router.config([
new Route({path: '/book/:title/...', component: AmbiguousBookCmp, name: 'Book'}) new Route({path: '/book/:title/...', component: AmbiguousBookCmp, name: 'Book'})
@ -168,7 +168,7 @@ export function main() {
})); }));
it('should generate link hrefs when asynchronously loaded', it('should generate link hrefs when asynchronously loaded',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile() compile()
.then((_) => router.config([ .then((_) => router.config([
new AsyncRoute({ new AsyncRoute({
@ -186,7 +186,7 @@ export function main() {
})); }));
it('should generate relative links preserving the existing parent route', it('should generate relative links preserving the existing parent route',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile() compile()
.then((_) => router.config( .then((_) => router.config(
[new Route({path: '/book/:title/...', component: BookCmp, name: 'Book'})])) [new Route({path: '/book/:title/...', component: BookCmp, name: 'Book'})]))
@ -211,7 +211,7 @@ export function main() {
}); });
})); }));
it('should generate links to auxiliary routes', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should generate links to auxiliary routes', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile() compile()
.then((_) => router.config([new Route({path: '/...', component: AuxLinkCmp})])) .then((_) => router.config([new Route({path: '/...', component: AuxLinkCmp})]))
.then((_) => router.navigateByUrl('/')) .then((_) => router.navigateByUrl('/'))
@ -224,7 +224,7 @@ export function main() {
describe('router-link-active CSS class', () => { describe('router-link-active CSS class', () => {
it('should be added to the associated element', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should be added to the associated element', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
router.config([ router.config([
new Route({path: '/child', component: HelloCmp, name: 'Child'}), new Route({path: '/child', component: HelloCmp, name: 'Child'}),
new Route({path: '/better-child', component: Hello2Cmp, name: 'BetterChild'}) new Route({path: '/better-child', component: Hello2Cmp, name: 'BetterChild'})
@ -255,7 +255,7 @@ export function main() {
}); });
})); }));
it('should be added to links in child routes', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should be added to links in child routes', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
router.config([ router.config([
new Route({path: '/child', component: HelloCmp, name: 'Child'}), new Route({path: '/child', component: HelloCmp, name: 'Child'}),
new Route({ new Route({
@ -297,7 +297,7 @@ export function main() {
})); }));
it('should not be added to links in other child routes', it('should not be added to links in other child routes',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
router.config([ router.config([
new Route({path: '/child', component: HelloCmp, name: 'Child'}), new Route({path: '/child', component: HelloCmp, name: 'Child'}),
new Route({ new Route({
@ -351,7 +351,7 @@ export function main() {
return dispatchedEvent; return dispatchedEvent;
}; };
it('should navigate to link hrefs without params', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate to link hrefs without params', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compile('<a href="hello" [routerLink]="[\'./User\']"></a>') compile('<a href="hello" [routerLink]="[\'./User\']"></a>')
.then((_) => router.config( .then((_) => router.config(
[new Route({path: '/user', component: UserCmp, name: 'User'})])) [new Route({path: '/user', component: UserCmp, name: 'User'})]))
@ -371,7 +371,7 @@ export function main() {
})); }));
it('should navigate to link hrefs in presence of base href', it('should navigate to link hrefs in presence of base href',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
(<SpyLocation>location).setBaseHref('/base'); (<SpyLocation>location).setBaseHref('/base');
compile('<a href="hello" [routerLink]="[\'./User\']"></a>') compile('<a href="hello" [routerLink]="[\'./User\']"></a>')
.then((_) => router.config( .then((_) => router.config(

View File

@ -43,7 +43,7 @@ export function main() {
expect(locationStrategy.path()).toEqual('/my/app/user/btford'); expect(locationStrategy.path()).toEqual('/my/app/user/btford');
}); });
it('should normalize urls on popstate', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should normalize urls on popstate', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
location.subscribe((ev: any /** TODO #9100 */) => { location.subscribe((ev: any /** TODO #9100 */) => {
expect(ev['url']).toEqual('/user/btford'); expect(ev['url']).toEqual('/user/btford');

View File

@ -53,7 +53,7 @@ export function main() {
]; ];
}); });
it('should bootstrap an app with a hierarchy', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should bootstrap an app with a hierarchy', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(HierarchyAppCmp, testBindings) bootstrap(HierarchyAppCmp, testBindings)
.then((applicationRef) => { .then((applicationRef) => {
var router = applicationRef.instance.router; var router = applicationRef.instance.router;
@ -67,7 +67,7 @@ export function main() {
})); }));
it('should work in an app with redirects', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should work in an app with redirects', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(RedirectAppCmp, testBindings) bootstrap(RedirectAppCmp, testBindings)
.then((applicationRef) => { .then((applicationRef) => {
var router = applicationRef.instance.router; var router = applicationRef.instance.router;
@ -81,7 +81,7 @@ export function main() {
})); }));
it('should work in an app with async components', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should work in an app with async components', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(AsyncAppCmp, testBindings) bootstrap(AsyncAppCmp, testBindings)
.then((applicationRef) => { .then((applicationRef) => {
var router = applicationRef.instance.router; var router = applicationRef.instance.router;
@ -95,7 +95,7 @@ export function main() {
})); }));
it('should work in an app with aux routes', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should work in an app with aux routes', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(AuxAppCmp, testBindings) bootstrap(AuxAppCmp, testBindings)
.then((applicationRef) => { .then((applicationRef) => {
var router = applicationRef.instance.router; var router = applicationRef.instance.router;
@ -110,7 +110,7 @@ export function main() {
it('should work in an app with async components defined with "loader"', it('should work in an app with async components defined with "loader"',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(ConciseAsyncAppCmp, testBindings) bootstrap(ConciseAsyncAppCmp, testBindings)
.then((applicationRef) => { .then((applicationRef) => {
var router = applicationRef.instance.router; var router = applicationRef.instance.router;
@ -125,7 +125,7 @@ export function main() {
it('should work in an app with a constructor component', it('should work in an app with a constructor component',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
bootstrap(ExplicitConstructorAppCmp, testBindings) bootstrap(ExplicitConstructorAppCmp, testBindings)
.then((applicationRef) => { .then((applicationRef) => {
var router = applicationRef.instance.router; var router = applicationRef.instance.router;
@ -141,7 +141,7 @@ export function main() {
it('should throw if a config is missing a target', it('should throw if a config is missing a target',
inject( inject(
[AsyncTestCompleter], [AsyncTestCompleter],
(async: any /** TODO #9100 */) => { (async: AsyncTestCompleter) => {
bootstrap(WrongConfigCmp, testBindings) bootstrap(WrongConfigCmp, testBindings)
.catch((e) => { .catch((e) => {
expect(e.originalException) expect(e.originalException)
@ -154,7 +154,7 @@ export function main() {
it('should throw if a config has an invalid component type', it('should throw if a config has an invalid component type',
inject( inject(
[AsyncTestCompleter], [AsyncTestCompleter],
(async: any /** TODO #9100 */) => { (async: AsyncTestCompleter) => {
bootstrap(WrongComponentTypeCmp, testBindings) bootstrap(WrongComponentTypeCmp, testBindings)
.catch((e) => { .catch((e) => {
expect(e.originalException) expect(e.originalException)
@ -167,7 +167,7 @@ export function main() {
it('should throw if a config has an invalid alias name', it('should throw if a config has an invalid alias name',
inject( inject(
[AsyncTestCompleter], [AsyncTestCompleter],
(async: any /** TODO #9100 */) => { (async: AsyncTestCompleter) => {
bootstrap(BadAliasNameCmp, testBindings) bootstrap(BadAliasNameCmp, testBindings)
.catch((e) => { .catch((e) => {
expect(e.originalException) expect(e.originalException)

View File

@ -28,7 +28,7 @@ export function main() {
beforeEach(() => { registry = new RouteRegistry(RootHostCmp); }); beforeEach(() => { registry = new RouteRegistry(RootHostCmp); });
it('should match the full URL', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should match the full URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/', component: DummyCmpA})); registry.config(RootHostCmp, new Route({path: '/', component: DummyCmpA}));
registry.config(RootHostCmp, new Route({path: '/test', component: DummyCmpB})); registry.config(RootHostCmp, new Route({path: '/test', component: DummyCmpB}));
@ -100,7 +100,7 @@ export function main() {
it('should generate URLs of loaded components after they are loaded', it('should generate URLs of loaded components after they are loaded',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config( registry.config(
RootHostCmp, RootHostCmp,
new AsyncRoute({path: '/first/...', loader: asyncParentLoader, name: 'FirstCmp'})); new AsyncRoute({path: '/first/...', loader: asyncParentLoader, name: 'FirstCmp'}));
@ -131,7 +131,7 @@ export function main() {
.toEqual('primary(aux)'); .toEqual('primary(aux)');
}); });
it('should prefer static segments to dynamic', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should prefer static segments to dynamic', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/:site', component: DummyCmpB})); registry.config(RootHostCmp, new Route({path: '/:site', component: DummyCmpB}));
registry.config(RootHostCmp, new Route({path: '/home', component: DummyCmpA})); registry.config(RootHostCmp, new Route({path: '/home', component: DummyCmpA}));
@ -142,7 +142,7 @@ export function main() {
}); });
})); }));
it('should prefer dynamic segments to star', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should prefer dynamic segments to star', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/:site', component: DummyCmpA})); registry.config(RootHostCmp, new Route({path: '/:site', component: DummyCmpA}));
registry.config(RootHostCmp, new Route({path: '/*site', component: DummyCmpB})); registry.config(RootHostCmp, new Route({path: '/*site', component: DummyCmpB}));
@ -153,7 +153,7 @@ export function main() {
}); });
})); }));
it('should prefer routes with more dynamic segments', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should prefer routes with more dynamic segments', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/:first/*rest', component: DummyCmpA})); registry.config(RootHostCmp, new Route({path: '/:first/*rest', component: DummyCmpA}));
registry.config(RootHostCmp, new Route({path: '/*all', component: DummyCmpB})); registry.config(RootHostCmp, new Route({path: '/*all', component: DummyCmpB}));
@ -164,7 +164,7 @@ export function main() {
}); });
})); }));
it('should prefer routes with more static segments', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should prefer routes with more static segments', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/first/:second', component: DummyCmpA})); registry.config(RootHostCmp, new Route({path: '/first/:second', component: DummyCmpA}));
registry.config(RootHostCmp, new Route({path: '/:first/:second', component: DummyCmpB})); registry.config(RootHostCmp, new Route({path: '/:first/:second', component: DummyCmpB}));
@ -176,7 +176,7 @@ export function main() {
})); }));
it('should prefer routes with static segments before dynamic segments', it('should prefer routes with static segments before dynamic segments',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, registry.config(RootHostCmp,
new Route({path: '/first/second/:third', component: DummyCmpB})); new Route({path: '/first/second/:third', component: DummyCmpB}));
registry.config(RootHostCmp, registry.config(RootHostCmp,
@ -190,7 +190,7 @@ export function main() {
})); }));
it('should prefer routes with high specificity over routes with children with lower specificity', it('should prefer routes with high specificity over routes with children with lower specificity',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/first', component: DummyCmpA})); registry.config(RootHostCmp, new Route({path: '/first', component: DummyCmpA}));
// terminates to DummyCmpB // terminates to DummyCmpB
@ -204,7 +204,7 @@ export function main() {
}); });
})); }));
it('should match the full URL using child components', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should match the full URL using child components', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp})); registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp}));
registry.recognize('/first/second', []) registry.recognize('/first/second', [])
@ -216,7 +216,7 @@ export function main() {
})); }));
it('should match the URL using async child components', it('should match the URL using async child components',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyAsyncCmp})); registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyAsyncCmp}));
registry.recognize('/first/second', []) registry.recognize('/first/second', [])
@ -231,7 +231,7 @@ export function main() {
})); }));
it('should match the URL using an async parent component', it('should match the URL using an async parent component',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, registry.config(RootHostCmp,
new AsyncRoute({path: '/first/...', loader: asyncParentLoader})); new AsyncRoute({path: '/first/...', loader: asyncParentLoader}));
@ -282,7 +282,7 @@ export function main() {
}); });
it('should match matrix params on child components and query params on the root component', it('should match matrix params on child components and query params on the root component',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp})); registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp}));
registry.recognize('/first/second;filter=odd?comments=all', []) registry.recognize('/first/second;filter=odd?comments=all', [])
@ -297,7 +297,7 @@ export function main() {
})); }));
it('should match query params on the root component even when the next URL segment is null', it('should match query params on the root component even when the next URL segment is null',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
registry.config(RootHostCmp, registry.config(RootHostCmp,
new Route({path: '/first/...', component: SingleSlashChildCmp})); new Route({path: '/first/...', component: SingleSlashChildCmp}));

View File

@ -41,7 +41,7 @@ export function main() {
})); }));
it('should navigate based on the initial URL state', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate based on the initial URL state', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.config([new Route({path: '/', component: DummyComponent})]) router.config([new Route({path: '/', component: DummyComponent})])
@ -54,7 +54,7 @@ export function main() {
})); }));
it('should activate viewports and update URL on navigate', it('should activate viewports and update URL on navigate',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -68,7 +68,7 @@ export function main() {
})); }));
it('should activate viewports and update URL when navigating via DSL', it('should activate viewports and update URL when navigating via DSL',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -83,7 +83,7 @@ export function main() {
})); }));
it('should not push a history change on when navigate is called with skipUrlChange', it('should not push a history change on when navigate is called with skipUrlChange',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -100,7 +100,7 @@ export function main() {
// This test is disabled because it is flaky. // This test is disabled because it is flaky.
// TODO: bford. make this test not flaky and reenable it. // TODO: bford. make this test not flaky and reenable it.
xit('should replace history when triggered by a hashchange with a redirect', xit('should replace history when triggered by a hashchange with a redirect',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -119,7 +119,7 @@ export function main() {
})); }));
it('should push history when triggered by a hashchange without a redirect', it('should push history when triggered by a hashchange without a redirect',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -136,7 +136,7 @@ export function main() {
it('should pass an object containing the component instruction to the router change subscription after a successful navigation', it('should pass an object containing the component instruction to the router change subscription after a successful navigation',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -152,7 +152,7 @@ export function main() {
})); }));
it('should pass an object containing the bad url to the router change subscription after a failed navigation', it('should pass an object containing the bad url to the router change subscription after a failed navigation',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -167,7 +167,7 @@ export function main() {
}); });
})); }));
it('should navigate after being configured', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should navigate after being configured', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -208,7 +208,7 @@ export function main() {
}); });
it('should generate an instruction with terminal async routes', it('should generate an instruction with terminal async routes',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet); router.registerPrimaryOutlet(outlet);
@ -223,7 +223,7 @@ export function main() {
})); }));
it('should return whether a given instruction is active with isRouteActive', it('should return whether a given instruction is active with isRouteActive',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)
@ -242,7 +242,7 @@ export function main() {
}); });
})); }));
it('should provide the current instruction', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should provide the current instruction', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var outlet = makeDummyOutlet(); var outlet = makeDummyOutlet();
router.registerPrimaryOutlet(outlet) router.registerPrimaryOutlet(outlet)

View File

@ -23,7 +23,7 @@ export function main() {
beforeEach(() => { recognizer = new RuleSet(); }); beforeEach(() => { recognizer = new RuleSet(); });
it('should recognize a static segment', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize a static segment', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config(new Route({path: '/test', component: DummyCmpA})); recognizer.config(new Route({path: '/test', component: DummyCmpA}));
recognize(recognizer, '/test') recognize(recognizer, '/test')
.then((solutions: RouteMatch[]) => { .then((solutions: RouteMatch[]) => {
@ -34,7 +34,7 @@ export function main() {
})); }));
it('should recognize a single slash', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize a single slash', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config(new Route({path: '/', component: DummyCmpA})); recognizer.config(new Route({path: '/', component: DummyCmpA}));
recognize(recognizer, '/') recognize(recognizer, '/')
.then((solutions: RouteMatch[]) => { .then((solutions: RouteMatch[]) => {
@ -45,7 +45,7 @@ export function main() {
})); }));
it('should recognize a dynamic segment', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize a dynamic segment', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config(new Route({path: '/user/:name', component: DummyCmpA})); recognizer.config(new Route({path: '/user/:name', component: DummyCmpA}));
recognize(recognizer, '/user/brian') recognize(recognizer, '/user/brian')
.then((solutions: RouteMatch[]) => { .then((solutions: RouteMatch[]) => {
@ -57,7 +57,7 @@ export function main() {
})); }));
it('should recognize a star segment', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize a star segment', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config(new Route({path: '/first/*rest', component: DummyCmpA})); recognizer.config(new Route({path: '/first/*rest', component: DummyCmpA}));
recognize(recognizer, '/first/second/third') recognize(recognizer, '/first/second/third')
.then((solutions: RouteMatch[]) => { .then((solutions: RouteMatch[]) => {
@ -68,7 +68,7 @@ export function main() {
}); });
})); }));
it('should recognize a regex', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize a regex', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
function emptySerializer(params: any /** TODO #9100 */): GeneratedUrl { return new GeneratedUrl('', {}); } function emptySerializer(params: any /** TODO #9100 */): GeneratedUrl { return new GeneratedUrl('', {}); }
recognizer.config( recognizer.config(
@ -83,7 +83,7 @@ export function main() {
}); });
})); }));
it('should recognize a regex with named_groups', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize a regex with named_groups', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
function emptySerializer(params: any /** TODO #9100 */): GeneratedUrl { return new GeneratedUrl('', {}); } function emptySerializer(params: any /** TODO #9100 */): GeneratedUrl { return new GeneratedUrl('', {}); }
recognizer.config(new Route({ recognizer.config(new Route({
@ -125,7 +125,7 @@ export function main() {
}); });
it('should recognize redirects', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should recognize redirects', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config(new Route({path: '/b', component: DummyCmpA})); recognizer.config(new Route({path: '/b', component: DummyCmpA}));
recognizer.config(new Redirect({path: '/a', redirectTo: ['B']})); recognizer.config(new Redirect({path: '/a', redirectTo: ['B']}));
recognize(recognizer, '/a') recognize(recognizer, '/a')
@ -190,7 +190,7 @@ export function main() {
describe('params', () => { describe('params', () => {
it('should recognize parameters within the URL path', it('should recognize parameters within the URL path',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config( recognizer.config(
new Route({path: 'profile/:name', component: DummyCmpA, name: 'User'})); new Route({path: 'profile/:name', component: DummyCmpA, name: 'User'}));
recognize(recognizer, '/profile/matsko?comments=all') recognize(recognizer, '/profile/matsko?comments=all')
@ -216,7 +216,7 @@ export function main() {
it('should prefer positional params over query params', it('should prefer positional params over query params',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config( recognizer.config(
new Route({path: 'profile/:name', component: DummyCmpA, name: 'User'})); new Route({path: 'profile/:name', component: DummyCmpA, name: 'User'}));
recognize(recognizer, '/profile/yegor?name=igor') recognize(recognizer, '/profile/yegor?name=igor')
@ -229,7 +229,7 @@ export function main() {
it('should ignore matrix params for the top-level component', it('should ignore matrix params for the top-level component',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
recognizer.config( recognizer.config(
new Route({path: '/home/:subject', component: DummyCmpA, name: 'User'})); new Route({path: '/home/:subject', component: DummyCmpA, name: 'User'}));
recognize(recognizer, '/home;sort=asc/zero;one=1?two=2') recognize(recognizer, '/home;sort=asc/zero;one=1?two=2')

View File

@ -24,7 +24,7 @@ export function main() {
let emptyRouteTree = createEmptyRouteTree(ComponentA); let emptyRouteTree = createEmptyRouteTree(ComponentA);
it('should handle position args', it('should handle position args',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("b/paramB/c/paramC/d"), emptyRouteTree) recognize(resolver, ComponentA, tree("b/paramB/c/paramC/d"), emptyRouteTree)
.then(r => { .then(r => {
let a = r.root; let a = r.root;
@ -48,7 +48,7 @@ export function main() {
})); }));
it('should support empty routes', it('should support empty routes',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("f"), emptyRouteTree) recognize(resolver, ComponentA, tree("f"), emptyRouteTree)
.then(r => { .then(r => {
let a = r.root; let a = r.root;
@ -68,7 +68,7 @@ export function main() {
})); }));
it('should handle aux routes', it('should handle aux routes',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("b/paramB(/d//right:d)"), emptyRouteTree) recognize(resolver, ComponentA, tree("b/paramB(/d//right:d)"), emptyRouteTree)
.then(r => { .then(r => {
let c = r.children(r.root); let c = r.children(r.root);
@ -89,7 +89,7 @@ export function main() {
})); }));
it("should error when two segments with the same outlet name", it("should error when two segments with the same outlet name",
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("b/paramB(right:d//right:e)"), emptyRouteTree) recognize(resolver, ComponentA, tree("b/paramB(right:d//right:e)"), emptyRouteTree)
.catch(e => { .catch(e => {
expect(e.message).toEqual( expect(e.message).toEqual(
@ -99,7 +99,7 @@ export function main() {
})); }));
it('should handle nested aux routes', it('should handle nested aux routes',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("b/paramB(/d(right:e))"), emptyRouteTree) recognize(resolver, ComponentA, tree("b/paramB(/d(right:e))"), emptyRouteTree)
.then(r => { .then(r => {
let c = r.children(r.root); let c = r.children(r.root);
@ -120,7 +120,7 @@ export function main() {
})); }));
it('should handle non top-level aux routes', it('should handle non top-level aux routes',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree('b/paramB/d(e)'), emptyRouteTree) recognize(resolver, ComponentA, tree('b/paramB/d(e)'), emptyRouteTree)
.then(r => { .then(r => {
let c = r.children(r.firstChild(r.root)); let c = r.children(r.firstChild(r.root));
@ -137,7 +137,7 @@ export function main() {
})); }));
it('should handle matrix parameters', it('should handle matrix parameters',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("b/paramB;b1=1;b2=2(/d;d1=1;d2=2)"), emptyRouteTree) recognize(resolver, ComponentA, tree("b/paramB;b1=1;b2=2(/d;d1=1;d2=2)"), emptyRouteTree)
.then(r => { .then(r => {
let c = r.children(r.root); let c = r.children(r.root);
@ -149,7 +149,7 @@ export function main() {
})); }));
it('should match a wildcard', it('should match a wildcard',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentG, tree("a;aa=1/b;bb=2"), emptyRouteTree) recognize(resolver, ComponentG, tree("a;aa=1/b;bb=2"), emptyRouteTree)
.then(r => { .then(r => {
let c = r.children(r.root); let c = r.children(r.root);
@ -162,7 +162,7 @@ export function main() {
})); }));
it('should error when no matching routes', it('should error when no matching routes',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("invalid"), emptyRouteTree) recognize(resolver, ComponentA, tree("invalid"), emptyRouteTree)
.catch(e => { .catch(e => {
expect(e.message).toContain("Cannot match any routes"); expect(e.message).toContain("Cannot match any routes");
@ -171,7 +171,7 @@ export function main() {
})); }));
it('should handle no matching routes (too short)', it('should handle no matching routes (too short)',
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("b"), emptyRouteTree) recognize(resolver, ComponentA, tree("b"), emptyRouteTree)
.catch(e => { .catch(e => {
expect(e.message).toContain("Cannot match any routes"); expect(e.message).toContain("Cannot match any routes");
@ -180,7 +180,7 @@ export function main() {
})); }));
it("should error when a component doesn't have @Routes", it("should error when a component doesn't have @Routes",
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("d/invalid"), emptyRouteTree) recognize(resolver, ComponentA, tree("d/invalid"), emptyRouteTree)
.catch(e => { .catch(e => {
expect(e.message) expect(e.message)
@ -190,7 +190,7 @@ export function main() {
})); }));
it("should reuse existing segments", it("should reuse existing segments",
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => { inject([AsyncTestCompleter, ComponentResolver], (async: AsyncTestCompleter, resolver: any /** TODO #9100 */) => {
recognize(resolver, ComponentA, tree("/b/1/d"), emptyRouteTree) recognize(resolver, ComponentA, tree("/b/1/d"), emptyRouteTree)
.then(t1 => { .then(t1 => {
recognize(resolver, ComponentA, tree("/b/1/e"), t1) recognize(resolver, ComponentA, tree("/b/1/e"), t1)

View File

@ -8,7 +8,7 @@ export function main() {
it('should have angular 1 loaded', () => expect(angular.version.major).toBe(1)); it('should have angular 1 loaded', () => expect(angular.version.major).toBe(1));
it('should instantiate ng2 in ng1 template and project content', it('should instantiate ng2 in ng1 template and project content',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
var Ng2 = Component({selector: 'ng2', template: `{{ 'NG2' }}(<ng-content></ng-content>)`}) var Ng2 = Component({selector: 'ng2', template: `{{ 'NG2' }}(<ng-content></ng-content>)`})
.Class({constructor: function() {}}); .Class({constructor: function() {}});
@ -26,7 +26,7 @@ export function main() {
})); }));
it('should instantiate ng1 in ng2 template and project content', it('should instantiate ng1 in ng2 template and project content',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter: UpgradeAdapter = new UpgradeAdapter(); var adapter: UpgradeAdapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -53,7 +53,7 @@ export function main() {
describe('scope/component change-detection', () => { describe('scope/component change-detection', () => {
it('should interleave scope and component expressions', it('should interleave scope and component expressions',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
var log: any[] /** TODO #9100 */ = []; var log: any[] /** TODO #9100 */ = [];
var l = function(value: any /** TODO #9100 */) { var l = function(value: any /** TODO #9100 */) {
@ -92,7 +92,7 @@ export function main() {
}); });
describe('downgrade ng2 component', () => { describe('downgrade ng2 component', () => {
it('should bind properties, events', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should bind properties, events', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter: UpgradeAdapter = new UpgradeAdapter(); var adapter: UpgradeAdapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -202,7 +202,7 @@ export function main() {
})); }));
it('should properly run cleanup when ng1 directive is destroyed', it('should properly run cleanup when ng1 directive is destroyed',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter: UpgradeAdapter = new UpgradeAdapter(); var adapter: UpgradeAdapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
var onDestroyed: EventEmitter<string> = new EventEmitter<string>(); var onDestroyed: EventEmitter<string> = new EventEmitter<string>();
@ -232,7 +232,7 @@ export function main() {
it('should fallback to the root ng2.injector when compiled outside the dom', it('should fallback to the root ng2.injector when compiled outside the dom',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter: UpgradeAdapter = new UpgradeAdapter(); var adapter: UpgradeAdapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -263,7 +263,7 @@ export function main() {
}); });
describe('upgrade ng1 component', () => { describe('upgrade ng1 component', () => {
it('should bind properties, events', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should bind properties, events', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -318,7 +318,7 @@ export function main() {
}); });
})); }));
it('should bind properties, events in controller when bindToController is not used', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should bind properties, events in controller when bindToController is not used', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -362,7 +362,7 @@ export function main() {
}); });
})); }));
it('should bind properties, events in link function', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should bind properties, events in link function', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -407,7 +407,7 @@ export function main() {
})); }));
it('should support templateUrl fetched from $httpBackend', it('should support templateUrl fetched from $httpBackend',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
ng1Module.value('$httpBackend', ng1Module.value('$httpBackend',
@ -431,7 +431,7 @@ export function main() {
})); }));
it('should support templateUrl as a function', it('should support templateUrl as a function',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
ng1Module.value('$httpBackend', ng1Module.value('$httpBackend',
@ -454,7 +454,7 @@ export function main() {
}); });
})); }));
it('should support empty template', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support empty template', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -475,7 +475,7 @@ export function main() {
}); });
})); }));
it('should support template as a function', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support template as a function', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -497,7 +497,7 @@ export function main() {
})); }));
it('should support templateUrl fetched from $templateCache', it('should support templateUrl fetched from $templateCache',
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
ng1Module.run(($templateCache: any /** TODO #9100 */) => $templateCache.put('url.html', 'WORKS')); ng1Module.run(($templateCache: any /** TODO #9100 */) => $templateCache.put('url.html', 'WORKS'));
@ -519,7 +519,7 @@ export function main() {
}); });
})); }));
it('should support controller with controllerAs', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support controller with controllerAs', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -560,7 +560,7 @@ export function main() {
}); });
})); }));
it('should support bindToController', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support bindToController', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -589,7 +589,7 @@ export function main() {
}); });
})); }));
it('should support bindToController with bindings', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support bindToController with bindings', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -618,7 +618,7 @@ export function main() {
}); });
})); }));
it('should support single require in linking fn', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support single require in linking fn', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -654,7 +654,7 @@ export function main() {
}); });
})); }));
it('should support array require in linking fn', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support array require in linking fn', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -695,7 +695,7 @@ export function main() {
}); });
})); }));
it('should call $onInit of components', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should call $onInit of components', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
var valueToFind = '$onInit'; var valueToFind = '$onInit';
@ -724,7 +724,7 @@ export function main() {
}); });
})); }));
it('should bind input properties (<) of components', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should bind input properties (<) of components', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -755,7 +755,7 @@ export function main() {
}); });
})); }));
it('should support ng2 > ng1 > ng2', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should support ng2 > ng1 > ng2', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
@ -798,7 +798,7 @@ export function main() {
describe('injection', () => { describe('injection', () => {
function SomeToken() {} function SomeToken() {}
it('should export ng2 instance to ng1', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should export ng2 instance to ng1', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var module = angular.module('myExample', []); var module = angular.module('myExample', []);
adapter.addProvider({provide: SomeToken, useValue: 'correct_value'}); adapter.addProvider({provide: SomeToken, useValue: 'correct_value'});
@ -811,7 +811,7 @@ export function main() {
}); });
})); }));
it('should export ng1 instance to ng2', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should export ng1 instance to ng2', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var module = angular.module('myExample', []); var module = angular.module('myExample', []);
module.value('testValue', 'secreteToken'); module.value('testValue', 'secreteToken');
@ -830,7 +830,7 @@ export function main() {
}); });
describe('testability', () => { describe('testability', () => {
it('should handle deferred bootstrap', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should handle deferred bootstrap', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter: UpgradeAdapter = new UpgradeAdapter(); var adapter: UpgradeAdapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
var bootstrapResumed: boolean = false; var bootstrapResumed: boolean = false;
@ -851,7 +851,7 @@ export function main() {
}, 100); }, 100);
})); }));
it('should wait for ng2 testability', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should wait for ng2 testability', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter: UpgradeAdapter = new UpgradeAdapter(); var adapter: UpgradeAdapter = new UpgradeAdapter();
var ng1Module = angular.module('ng1', []); var ng1Module = angular.module('ng1', []);
var element = html("<div></div>"); var element = html("<div></div>");
@ -876,7 +876,7 @@ export function main() {
}); });
describe('examples', () => { describe('examples', () => {
it('should verify UpgradeAdapter example', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => { it('should verify UpgradeAdapter example', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var adapter = new UpgradeAdapter(); var adapter = new UpgradeAdapter();
var module = angular.module('myExample', []); var module = angular.module('myExample', []);