refactor: add types (#9116)
This commit is contained in:
committed by
Miško Hevery
parent
b60eecfc47
commit
7ce0fc7d47
@@ -25,7 +25,7 @@ export function main() {
|
||||
describe('binding to CSS class list', () => {
|
||||
|
||||
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>';
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
.createAsync(TestComponent)
|
||||
@@ -44,7 +44,7 @@ export function main() {
|
||||
describe('expressions evaluating to objects', () => {
|
||||
|
||||
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>';
|
||||
|
||||
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',
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -69,7 +69,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -85,7 +85,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<div [ngClass]="objExpr"></div>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -126,7 +126,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -146,7 +146,7 @@ export function main() {
|
||||
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -171,7 +171,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -190,7 +190,7 @@ export function main() {
|
||||
describe('expressions evaluating to lists', () => {
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -202,7 +202,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -225,7 +225,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -241,7 +241,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -257,7 +257,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -272,7 +272,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -288,7 +288,7 @@ export function main() {
|
||||
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -310,7 +310,7 @@ export function main() {
|
||||
describe('expressions evaluating to sets', () => {
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -333,7 +333,7 @@ export function main() {
|
||||
describe('expressions evaluating to string', () => {
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -345,7 +345,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -365,7 +365,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -381,7 +381,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -397,7 +397,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -415,7 +415,7 @@ export function main() {
|
||||
describe('cooperation with other class-changing constructs', () => {
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -435,7 +435,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -455,7 +455,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -475,7 +475,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 =
|
||||
'<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',
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
|
||||
@@ -25,7 +25,7 @@ export function main() {
|
||||
'<div><copy-me template="ngFor let item of items">{{item.toString()}};</copy-me></div>';
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -36,7 +36,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -51,7 +51,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -66,7 +66,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -82,7 +82,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -98,7 +98,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -128,7 +128,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
.createAsync(TestComponent)
|
||||
@@ -140,7 +140,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -160,7 +160,7 @@ export function main() {
|
||||
|
||||
if (!IS_DART) {
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -177,7 +177,7 @@ export function main() {
|
||||
}
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -191,7 +191,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(TestComponent)
|
||||
.then((fixture) => {
|
||||
@@ -204,7 +204,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>' +
|
||||
'<div template="ngFor let item of items">' +
|
||||
'<div template="ngFor let subitem of item">' +
|
||||
@@ -231,7 +231,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">' +
|
||||
'<div template="ngFor let subitem of item">' +
|
||||
'{{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',
|
||||
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" let-i="index"><div>{{i}}|</div>` +
|
||||
`<div *ngIf="i % 2 == 0">even|</div></template></div>`;
|
||||
@@ -279,7 +279,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should display indices correctly',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.overrideTemplate(
|
||||
TestComponent,
|
||||
'<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',
|
||||
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"
|
||||
[ngForTemplate]="contentTpl" let-i="index">{{i}}: {{item}};</template></ul>`)
|
||||
.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',
|
||||
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"
|
||||
[ngForTemplate]="contentTpl" let-i="index">{{i}}=> {{item}};</template></ul>`)
|
||||
.overrideTemplate(
|
||||
@@ -428,7 +428,7 @@ export function main() {
|
||||
|
||||
describe('track by', function() {
|
||||
it('should not replace tracked items',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
`<template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById" let-i="index">
|
||||
<p>{{items[i]}}</p>
|
||||
@@ -450,7 +450,7 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
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 =
|
||||
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -466,7 +466,7 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
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 =
|
||||
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -485,7 +485,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 =
|
||||
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackByIndex">{{item}}</template></div>`;
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
|
||||
@@ -21,7 +21,7 @@ import {IS_DART} from '../../src/facade/lang';
|
||||
export function main() {
|
||||
describe('ngIf directive', () => {
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, html)
|
||||
@@ -37,7 +37,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 =
|
||||
'<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',
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, html)
|
||||
@@ -86,7 +86,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should handle nested if correctly',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var html =
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var html =
|
||||
'<div>' +
|
||||
'<copy-me template="ngIf numberCondition + 1 >= 2">helloNumber</copy-me>' +
|
||||
@@ -172,7 +172,7 @@ export function main() {
|
||||
|
||||
if (!IS_DART) {
|
||||
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>';
|
||||
|
||||
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)',
|
||||
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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, html)
|
||||
@@ -222,7 +222,7 @@ export function main() {
|
||||
|
||||
if (IS_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>';
|
||||
|
||||
tcb.overrideTemplate(TestComponent, html)
|
||||
|
||||
@@ -20,7 +20,7 @@ export function main() {
|
||||
beforeEachProviders(() => [{provide: NgLocalization, useClass: TestLocalizationMap}]);
|
||||
|
||||
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>' +
|
||||
'<ul [ngPlural]="switchValue">' +
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template =
|
||||
'<div>' +
|
||||
'<ul [ngPlural]="switchValue">' +
|
||||
@@ -67,7 +67,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 =
|
||||
'<div>' +
|
||||
'<ul [ngPlural]="switchValue">' +
|
||||
@@ -87,7 +87,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 =
|
||||
'<div>' +
|
||||
'<ul [ngPlural]="switchValue">' +
|
||||
|
||||
@@ -24,7 +24,7 @@ export function main() {
|
||||
describe('binding to CSS styles', () => {
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -40,7 +40,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -66,7 +66,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -89,7 +89,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
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',
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
|
||||
@@ -18,7 +18,7 @@ export function main() {
|
||||
describe('switch', () => {
|
||||
describe('switch value changes', () => {
|
||||
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>' +
|
||||
'<ul [ngSwitch]="switchValue">' +
|
||||
'<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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var template = '<div>' +
|
||||
'<ul [ngSwitch]="switchValue">' +
|
||||
'<li template="ngSwitchWhen \'a\'">when a</li>' +
|
||||
@@ -70,7 +70,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>' +
|
||||
'<ul [ngSwitch]="switchValue">' +
|
||||
'<template ngSwitchWhen="a"><li>when a1;</li></template>' +
|
||||
@@ -103,7 +103,7 @@ export function main() {
|
||||
|
||||
describe('when values changes', () => {
|
||||
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>' +
|
||||
'<ul [ngSwitch]="switchValue">' +
|
||||
'<template [ngSwitchWhen]="when1"><li>when 1;</li></template>' +
|
||||
|
||||
@@ -16,7 +16,7 @@ import {NgTemplateOutlet} from '@angular/common';
|
||||
export function main() {
|
||||
describe('insert', () => {
|
||||
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>`;
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
.createAsync(TestComponent)
|
||||
@@ -30,7 +30,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 =
|
||||
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -51,7 +51,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 =
|
||||
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
@@ -74,7 +74,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
.createAsync(TestComponent)
|
||||
|
||||
@@ -17,7 +17,7 @@ import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
export function main() {
|
||||
describe('non-bindable', () => {
|
||||
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>';
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
.createAsync(TestComponent)
|
||||
@@ -29,7 +29,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
.createAsync(TestComponent)
|
||||
@@ -45,7 +45,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>';
|
||||
tcb.overrideTemplate(TestComponent, template)
|
||||
.createAsync(TestComponent)
|
||||
|
||||
@@ -41,7 +41,7 @@ export function main() {
|
||||
describe("integration tests", () => {
|
||||
|
||||
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">
|
||||
<input type="text" ngControl="login">
|
||||
</div>`;
|
||||
@@ -60,7 +60,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="text" ngControl="login">
|
||||
</div>`;
|
||||
@@ -75,7 +75,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
@@ -98,7 +98,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
@@ -194,7 +194,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
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 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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div [ngFormModel]="form">
|
||||
<input type="text" ngControl="login">
|
||||
</div>`;
|
||||
@@ -240,7 +240,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 form = new ControlGroup({"login": login});
|
||||
|
||||
@@ -265,7 +265,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 form = new ControlGroup({"login": login});
|
||||
|
||||
@@ -292,7 +292,7 @@ export function main() {
|
||||
|
||||
describe("different control types", () => {
|
||||
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">
|
||||
<input type="text" ngControl="text">
|
||||
</div>`;
|
||||
@@ -316,7 +316,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input ngControl="text">
|
||||
</div>`;
|
||||
@@ -339,7 +339,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<textarea ngControl="text"></textarea>
|
||||
</div>`;
|
||||
@@ -363,7 +363,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="checkbox" ngControl="checkbox">
|
||||
</div>`;
|
||||
@@ -388,7 +388,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="number" ngControl="num">
|
||||
</div>`;
|
||||
@@ -412,7 +412,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="number" ngControl="num" required>
|
||||
</div>`;
|
||||
@@ -442,7 +442,7 @@ export function main() {
|
||||
|
||||
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
<input type="number" ngControl="num" [(ngModel)]="data">
|
||||
@@ -463,7 +463,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="radio" ngControl="foodChicken" name="food">
|
||||
<input type="radio" ngControl="foodFish" name="food">
|
||||
@@ -494,7 +494,7 @@ export function main() {
|
||||
describe("should support <select>", () => {
|
||||
it("with basic selection",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<select>
|
||||
<option value="SF"></option>
|
||||
<option value="NYC"></option>
|
||||
@@ -516,7 +516,7 @@ export function main() {
|
||||
|
||||
it("with basic selection and value bindings",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<select>
|
||||
<option *ngFor="let city of list" [value]="city['id']">
|
||||
{{ city['name'] }}
|
||||
@@ -542,7 +542,7 @@ export function main() {
|
||||
|
||||
it("with ngControl",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div [ngFormModel]="form">
|
||||
<select ngControl="city">
|
||||
<option value="SF"></option>
|
||||
@@ -601,7 +601,7 @@ export function main() {
|
||||
|
||||
it("with option values that are objects",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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)",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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)",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||
@@ -698,7 +698,7 @@ export function main() {
|
||||
|
||||
it("when options are removed",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option>
|
||||
@@ -758,7 +758,7 @@ export function main() {
|
||||
|
||||
it("with duplicate option values",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||
@@ -819,7 +819,7 @@ export function main() {
|
||||
});
|
||||
|
||||
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">
|
||||
<input type="text" ngControl="name" wrapped-value>
|
||||
</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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div [ngFormModel]="form">
|
||||
<my-input ngControl="name"></my-input>
|
||||
</div>`;
|
||||
@@ -870,7 +870,7 @@ export function main() {
|
||||
|
||||
describe("validations", () => {
|
||||
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(
|
||||
{"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",
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
@@ -1007,7 +1007,7 @@ export function main() {
|
||||
|
||||
describe("nested forms", () => {
|
||||
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 =
|
||||
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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var form =
|
||||
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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<form ngNoForm>
|
||||
</form>`;
|
||||
|
||||
@@ -1322,7 +1322,7 @@ export function main() {
|
||||
|
||||
describe("setting status classes", () => {
|
||||
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 t = `<div><input type="text" [ngFormControl]="form"></div>`;
|
||||
@@ -1353,7 +1353,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`;
|
||||
@@ -1384,7 +1384,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(MyComp8, t)
|
||||
|
||||
@@ -202,7 +202,7 @@ export function main() {
|
||||
beforeEach(() => { c = new Control("old", Validators.required); });
|
||||
|
||||
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) => {
|
||||
expect(c.value).toEqual('new');
|
||||
expect(value).toEqual('new');
|
||||
@@ -253,7 +253,7 @@ export function main() {
|
||||
// TODO: remove the if statement after making observable delivery sync
|
||||
if (!IS_DART) {
|
||||
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 */) => {
|
||||
expect(c.valid).toEqual(false);
|
||||
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");
|
||||
ObservableWrapper.subscribe(c.valueChanges, (value) => {
|
||||
expect(value).toEqual('new');
|
||||
@@ -482,7 +482,7 @@ export function main() {
|
||||
});
|
||||
|
||||
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) => {
|
||||
expect(g.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",
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var controlCallbackIsCalled = false;
|
||||
|
||||
ObservableWrapper.subscribe(c1.valueChanges,
|
||||
@@ -507,7 +507,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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) => {
|
||||
expect(value).toEqual({'one': 'old1'});
|
||||
async.done();
|
||||
@@ -517,7 +517,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should fire an event when a control is included",
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
g.exclude("two");
|
||||
|
||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||
@@ -529,7 +529,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 */ = [];
|
||||
|
||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||
@@ -547,7 +547,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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
|
||||
}));
|
||||
});
|
||||
@@ -734,7 +734,7 @@ export function main() {
|
||||
});
|
||||
|
||||
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) => {
|
||||
expect(a.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",
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var controlCallbackIsCalled = false;
|
||||
|
||||
ObservableWrapper.subscribe(c1.valueChanges,
|
||||
@@ -759,7 +759,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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) => {
|
||||
expect(value).toEqual(['old1']);
|
||||
async.done();
|
||||
@@ -768,7 +768,7 @@ export function main() {
|
||||
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);
|
||||
|
||||
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
||||
|
||||
@@ -41,7 +41,7 @@ export function main() {
|
||||
describe("integration tests", () => {
|
||||
|
||||
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">
|
||||
<input type="text" ngControl="login">
|
||||
</div>`;
|
||||
@@ -60,7 +60,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="text" ngControl="login">
|
||||
</div>`;
|
||||
@@ -75,7 +75,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
@@ -98,7 +98,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
@@ -194,7 +194,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
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 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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div [ngFormModel]="form">
|
||||
<input type="text" ngControl="login">
|
||||
</div>`;
|
||||
@@ -240,7 +240,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 form = new ControlGroup({"login": login});
|
||||
|
||||
@@ -265,7 +265,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 form = new ControlGroup({"login": login});
|
||||
|
||||
@@ -292,7 +292,7 @@ export function main() {
|
||||
|
||||
describe("different control types", () => {
|
||||
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">
|
||||
<input type="text" ngControl="text">
|
||||
</div>`;
|
||||
@@ -316,7 +316,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input ngControl="text">
|
||||
</div>`;
|
||||
@@ -339,7 +339,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<textarea ngControl="text"></textarea>
|
||||
</div>`;
|
||||
@@ -363,7 +363,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="checkbox" ngControl="checkbox">
|
||||
</div>`;
|
||||
@@ -388,7 +388,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="number" ngControl="num">
|
||||
</div>`;
|
||||
@@ -412,7 +412,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="number" ngControl="num" required>
|
||||
</div>`;
|
||||
@@ -442,7 +442,7 @@ export function main() {
|
||||
|
||||
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
<input type="number" ngControl="num" [(ngModel)]="data">
|
||||
@@ -463,7 +463,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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">
|
||||
<input type="radio" ngControl="foodChicken" name="food">
|
||||
<input type="radio" ngControl="foodFish" name="food">
|
||||
@@ -494,7 +494,7 @@ export function main() {
|
||||
describe("should support <select>", () => {
|
||||
it("with basic selection",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<select>
|
||||
<option value="SF"></option>
|
||||
<option value="NYC"></option>
|
||||
@@ -516,7 +516,7 @@ export function main() {
|
||||
|
||||
it("with basic selection and value bindings",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<select>
|
||||
<option *ngFor="let city of list" [value]="city['id']">
|
||||
{{ city['name'] }}
|
||||
@@ -542,7 +542,7 @@ export function main() {
|
||||
|
||||
it("with ngControl",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div [ngFormModel]="form">
|
||||
<select ngControl="city">
|
||||
<option value="SF"></option>
|
||||
@@ -601,7 +601,7 @@ export function main() {
|
||||
|
||||
it("with option values that are objects",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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)",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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)",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||
@@ -698,7 +698,7 @@ export function main() {
|
||||
|
||||
it("when options are removed",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option>
|
||||
@@ -758,7 +758,7 @@ export function main() {
|
||||
|
||||
it("with duplicate option values",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div>
|
||||
<select [(ngModel)]="selectedCity">
|
||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||
@@ -819,7 +819,7 @@ export function main() {
|
||||
});
|
||||
|
||||
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">
|
||||
<input type="text" ngControl="name" wrapped-value>
|
||||
</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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<div [ngFormModel]="form">
|
||||
<my-input ngControl="name"></my-input>
|
||||
</div>`;
|
||||
@@ -870,7 +870,7 @@ export function main() {
|
||||
|
||||
describe("validations", () => {
|
||||
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(
|
||||
{"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",
|
||||
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 t = `<div [ngFormModel]="form">
|
||||
@@ -1007,7 +1007,7 @@ export function main() {
|
||||
|
||||
describe("nested forms", () => {
|
||||
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 =
|
||||
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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var form =
|
||||
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",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
var t = `<form ngNoForm>
|
||||
</form>`;
|
||||
|
||||
@@ -1322,7 +1322,7 @@ export function main() {
|
||||
|
||||
describe("setting status classes", () => {
|
||||
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 t = `<div><input type="text" [ngFormControl]="form"></div>`;
|
||||
@@ -1353,7 +1353,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`;
|
||||
@@ -1384,7 +1384,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>`;
|
||||
|
||||
tcb.overrideTemplate(MyComp8, t)
|
||||
|
||||
@@ -202,7 +202,7 @@ export function main() {
|
||||
beforeEach(() => { c = new Control("old", Validators.required); });
|
||||
|
||||
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) => {
|
||||
expect(c.value).toEqual('new');
|
||||
expect(value).toEqual('new');
|
||||
@@ -253,7 +253,7 @@ export function main() {
|
||||
// TODO: remove the if statement after making observable delivery sync
|
||||
if (!IS_DART) {
|
||||
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 */) => {
|
||||
expect(c.valid).toEqual(false);
|
||||
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");
|
||||
ObservableWrapper.subscribe(c.valueChanges, (value) => {
|
||||
expect(value).toEqual('new');
|
||||
@@ -482,7 +482,7 @@ export function main() {
|
||||
});
|
||||
|
||||
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) => {
|
||||
expect(g.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",
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var controlCallbackIsCalled = false;
|
||||
|
||||
ObservableWrapper.subscribe(c1.valueChanges,
|
||||
@@ -507,7 +507,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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) => {
|
||||
expect(value).toEqual({'one': 'old1'});
|
||||
async.done();
|
||||
@@ -517,7 +517,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should fire an event when a control is included",
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
g.exclude("two");
|
||||
|
||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||
@@ -529,7 +529,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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 */ = [];
|
||||
|
||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||
@@ -547,7 +547,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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
|
||||
}));
|
||||
});
|
||||
@@ -734,7 +734,7 @@ export function main() {
|
||||
});
|
||||
|
||||
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) => {
|
||||
expect(a.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",
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
var controlCallbackIsCalled = false;
|
||||
|
||||
ObservableWrapper.subscribe(c1.valueChanges,
|
||||
@@ -759,7 +759,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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) => {
|
||||
expect(value).toEqual(['old1']);
|
||||
async.done();
|
||||
@@ -768,7 +768,7 @@ export function main() {
|
||||
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);
|
||||
|
||||
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
||||
|
||||
@@ -44,7 +44,7 @@ export function main() {
|
||||
() => { expect(pipe.transform(emitter)).toBe(null); });
|
||||
|
||||
it("should return the latest available value wrapped",
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
pipe.transform(emitter);
|
||||
|
||||
ObservableWrapper.callEmit(emitter, message);
|
||||
@@ -57,7 +57,7 @@ export function main() {
|
||||
|
||||
|
||||
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);
|
||||
ObservableWrapper.callEmit(emitter, message);
|
||||
|
||||
@@ -69,7 +69,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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);
|
||||
|
||||
var newEmitter = new EventEmitter();
|
||||
@@ -85,7 +85,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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);
|
||||
ObservableWrapper.callEmit(emitter, message);
|
||||
|
||||
@@ -100,7 +100,7 @@ export function main() {
|
||||
it("should do nothing when no subscription",
|
||||
() => { 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.ngOnDestroy();
|
||||
|
||||
@@ -132,7 +132,7 @@ export function main() {
|
||||
it("should return null when subscribing to a promise",
|
||||
() => { 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);
|
||||
|
||||
completer.resolve(message);
|
||||
@@ -144,7 +144,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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);
|
||||
completer.resolve(message);
|
||||
|
||||
@@ -156,7 +156,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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);
|
||||
|
||||
var newCompleter = PromiseWrapper.completer();
|
||||
@@ -172,7 +172,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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');
|
||||
pipe.transform(completer.promise);
|
||||
completer.resolve(message);
|
||||
@@ -187,7 +187,7 @@ export function main() {
|
||||
it("should do nothing when no source",
|
||||
() => { 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);
|
||||
expect(pipe.transform(completer.promise)).toBe(null);
|
||||
completer.resolve(message)
|
||||
|
||||
@@ -53,7 +53,7 @@ export function main() {
|
||||
|
||||
describe('integration', () => {
|
||||
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) => {
|
||||
let mutable: number[] = [1];
|
||||
fixture.debugElement.componentInstance.data = mutable;
|
||||
|
||||
@@ -95,7 +95,7 @@ export function main() {
|
||||
|
||||
describe('integration', () => {
|
||||
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) => {
|
||||
let mutable: number[] = [1, 2];
|
||||
fixture.debugElement.componentInstance.data = mutable;
|
||||
|
||||
@@ -36,7 +36,7 @@ export function main() {
|
||||
describe('inline template', () => {
|
||||
it('should store the template',
|
||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||
(async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
encapsulation: null,
|
||||
template: 'a',
|
||||
@@ -53,7 +53,7 @@ export function main() {
|
||||
|
||||
it('should resolve styles on the annotation against the moduleUrl',
|
||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||
(async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
encapsulation: null,
|
||||
template: '',
|
||||
@@ -69,7 +69,7 @@ export function main() {
|
||||
|
||||
it('should resolve styles in the template against the moduleUrl',
|
||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||
(async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
encapsulation: null,
|
||||
template: '<style>@import test.css</style>',
|
||||
@@ -85,7 +85,7 @@ export function main() {
|
||||
|
||||
it('should use ViewEncapsulation.Emulated by default',
|
||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||
(async: AsyncTestCompleter, normalizer: DirectiveNormalizer) => {
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
encapsulation: null,
|
||||
template: '',
|
||||
@@ -101,7 +101,7 @@ export function main() {
|
||||
|
||||
it('should use default encapsulation provided by CompilerConfig',
|
||||
inject([AsyncTestCompleter, CompilerConfig , DirectiveNormalizer],
|
||||
(async: any /** TODO #9100 */, config: CompilerConfig, normalizer: DirectiveNormalizer) => {
|
||||
(async: AsyncTestCompleter, config: CompilerConfig, normalizer: DirectiveNormalizer) => {
|
||||
config.defaultEncapsulation = ViewEncapsulation.None;
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
encapsulation: null,
|
||||
@@ -121,7 +121,7 @@ export function main() {
|
||||
|
||||
it('should load a template from a url that is resolved against moduleUrl',
|
||||
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');
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
encapsulation: null,
|
||||
@@ -141,7 +141,7 @@ export function main() {
|
||||
|
||||
it('should resolve styles on the annotation against the moduleUrl',
|
||||
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', '');
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
encapsulation: null,
|
||||
@@ -159,7 +159,7 @@ export function main() {
|
||||
|
||||
it('should resolve styles in the template against the templateUrl',
|
||||
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',
|
||||
'<style>@import test.css</style>');
|
||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||
|
||||
@@ -43,7 +43,7 @@ export function main() {
|
||||
var injector: Injector;
|
||||
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;
|
||||
sharedStylesHost = _sharedStylesHost;
|
||||
}));
|
||||
|
||||
@@ -82,7 +82,7 @@ export function main() {
|
||||
console = new ArrayConsole();
|
||||
return [{provide: Console, useValue: console}];
|
||||
});
|
||||
beforeEach(inject([TemplateParser], (parser: any /** TODO #9100 */) => {
|
||||
beforeEach(inject([TemplateParser], (parser: TemplateParser) => {
|
||||
var component = CompileDirectiveMetadata.create({
|
||||
selector: 'root',
|
||||
type: new CompileTypeMetadata({moduleUrl: someModuleUrl, name: 'Root'}),
|
||||
|
||||
@@ -192,7 +192,7 @@ class DirectiveListComp {
|
||||
export function main() {
|
||||
describe('test component builder', function() {
|
||||
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) => {
|
||||
componentFixture.detectChanges();
|
||||
@@ -203,7 +203,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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) => {
|
||||
componentFixture.detectChanges();
|
||||
@@ -218,7 +218,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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>')
|
||||
.createAsync(MockChildComp)
|
||||
@@ -231,7 +231,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should override a view',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideView(ChildComp,
|
||||
new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
|
||||
@@ -245,7 +245,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(ParentComp)
|
||||
@@ -258,7 +258,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.createAsync(DirectiveListComp)
|
||||
@@ -271,7 +271,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
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)
|
||||
.overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp)
|
||||
@@ -286,7 +286,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should override a provider',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideProviders(TestBindingsComp,
|
||||
[{provide: FancyService, useClass: MockFancyService}])
|
||||
@@ -301,7 +301,7 @@ export function main() {
|
||||
|
||||
|
||||
it('should override a viewBinding',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.overrideViewProviders(TestViewBindingsComp,
|
||||
[{provide: FancyService, useClass: MockFancyService}])
|
||||
@@ -318,7 +318,7 @@ export function main() {
|
||||
describe('ComponentFixture', () => {
|
||||
it('should auto detect changes if autoDetectChanges is called',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AutoDetectComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -338,7 +338,7 @@ export function main() {
|
||||
it('should auto detect changes if ComponentFixtureAutoDetect is provided as true',
|
||||
withProviders(() => [{provide: ComponentFixtureAutoDetect, useValue: true}])
|
||||
.inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AutoDetectComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -354,7 +354,7 @@ export function main() {
|
||||
|
||||
it('should signal through whenStable when the fixture is stable (autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AsyncComp).then((componentFixture) => {
|
||||
componentFixture.autoDetectChanges();
|
||||
@@ -377,7 +377,7 @@ export function main() {
|
||||
|
||||
it('should signal through isStable when the fixture is stable (no autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AsyncComp).then((componentFixture) => {
|
||||
componentFixture.detectChanges();
|
||||
@@ -401,7 +401,7 @@ export function main() {
|
||||
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
|
||||
'(autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AsyncTimeoutComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -426,7 +426,7 @@ export function main() {
|
||||
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
|
||||
'(no autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AsyncTimeoutComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -452,7 +452,7 @@ export function main() {
|
||||
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
|
||||
'(autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(NestedAsyncTimeoutComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -477,7 +477,7 @@ export function main() {
|
||||
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
|
||||
'(no autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(NestedAsyncTimeoutComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -502,7 +502,7 @@ export function main() {
|
||||
|
||||
it('should stabilize after async task in change detection (autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AsyncChangeComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -523,7 +523,7 @@ export function main() {
|
||||
|
||||
it('should stabilize after async task in change detection(no autoDetectChanges)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(AsyncChangeComp)
|
||||
.then((componentFixture) => {
|
||||
@@ -554,7 +554,7 @@ export function main() {
|
||||
|
||||
it('calling autoDetectChanges raises an error', () => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ChildComp).then((componentFixture) => {
|
||||
expect(() => {
|
||||
componentFixture.autoDetectChanges();
|
||||
@@ -566,7 +566,7 @@ export function main() {
|
||||
|
||||
it('should instantiate a component with valid DOM',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(ChildComp).then((componentFixture) => {
|
||||
expect(componentFixture.ngZone).toBeNull();
|
||||
@@ -578,7 +578,7 @@ export function main() {
|
||||
|
||||
it('should allow changing members of the component',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(MyIfComp).then((componentFixture) => {
|
||||
componentFixture.detectChanges();
|
||||
@@ -596,7 +596,7 @@ export function main() {
|
||||
describe('createSync', () => {
|
||||
it('should create components',
|
||||
inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter],
|
||||
(cr: ComponentResolver, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(cr: ComponentResolver, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
cr.resolveComponent(MyIfComp).then((cmpFactory) => {
|
||||
let componentFixture = tcb.createSync(cmpFactory);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export function main() {
|
||||
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 response = 'bar';
|
||||
xhr.when(url, response);
|
||||
@@ -50,7 +50,7 @@ export function main() {
|
||||
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 response: any /** TODO #9100 */ = null;
|
||||
xhr.when(url, response);
|
||||
@@ -58,7 +58,7 @@ export function main() {
|
||||
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 response = 'bar';
|
||||
xhr.expect(url, response);
|
||||
@@ -66,7 +66,7 @@ export function main() {
|
||||
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 response: any /** TODO #9100 */ = null;
|
||||
xhr.expect(url, response);
|
||||
@@ -83,7 +83,7 @@ export function main() {
|
||||
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';
|
||||
xhr.when(url, 'when');
|
||||
xhr.expect(url, 'expect');
|
||||
|
||||
@@ -93,11 +93,9 @@ export class MockXHR extends XHR {
|
||||
}
|
||||
|
||||
class _PendingRequest {
|
||||
url: string;
|
||||
completer: PromiseCompleter<string>;
|
||||
|
||||
constructor(url: any /** TODO #9100 */) {
|
||||
this.url = url;
|
||||
constructor(public url: string) {
|
||||
this.completer = PromiseWrapper.completer();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should return a promise with rejected errors even if the exceptionHandler is not rethrowing',
|
||||
inject([AsyncTestCompleter, Injector], (async: any /** TODO #9100 */, injector: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter, Injector], (async: AsyncTestCompleter, injector: Injector) => {
|
||||
var ref = createApplication([]);
|
||||
var promise = ref.run(() => PromiseWrapper.reject('Test', null));
|
||||
PromiseWrapper.catchError(promise, (e) => {
|
||||
@@ -102,7 +102,7 @@ export function main() {
|
||||
|
||||
describe("coreLoadAndBootstrap", () => {
|
||||
it("should wait for asynchronous app initializers",
|
||||
inject([AsyncTestCompleter, Injector], (async: any /** TODO #9100 */, injector: any /** TODO #9100 */) => {
|
||||
inject([AsyncTestCompleter, Injector], (async: AsyncTestCompleter, injector: Injector) => {
|
||||
let completer: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
var initializerDone = false;
|
||||
TimerWrapper.setTimeout(() => {
|
||||
@@ -121,7 +121,7 @@ export function main() {
|
||||
|
||||
describe("coreBootstrap", () => {
|
||||
it("should throw if an APP_INITIIALIZER is not yet resolved",
|
||||
inject([Injector], (injector: any /** TODO #9100 */) => {
|
||||
inject([Injector], (injector: Injector) => {
|
||||
var app = createApplication([
|
||||
{provide: APP_INITIALIZER, useValue: () => PromiseWrapper.completer().promise, multi: true}
|
||||
]);
|
||||
|
||||
@@ -39,7 +39,7 @@ class MessageDir {
|
||||
|
||||
constructor(logger: Logger) { this.logger = logger; }
|
||||
|
||||
set message(newMessage: any /** TODO #9100 */) { this.logger.add(newMessage); }
|
||||
set message(newMessage: string) { this.logger.add(newMessage); }
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -193,7 +193,7 @@ class TestApp {
|
||||
export function main() {
|
||||
describe('debug element', function() {
|
||||
it('should list all child nodes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -205,7 +205,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list all component child elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
@@ -239,7 +239,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list conditional component child elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ConditionalParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -265,7 +265,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list child elements within viewports',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(UsingFor).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -282,7 +282,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list element attributes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(TestApp).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
var bankElem = fixture.debugElement.children[0];
|
||||
@@ -294,7 +294,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list element classes',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(TestApp).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
var bankElem = fixture.debugElement.children[0];
|
||||
@@ -306,7 +306,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list element styles',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(TestApp).then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
var bankElem = fixture.debugElement.children[0];
|
||||
@@ -318,7 +318,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should query child elements by css',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -334,7 +334,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should query child elements by directive',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -352,7 +352,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list providerTokens',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
@@ -365,7 +365,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list locals',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(LocalsComp)
|
||||
.then((fixture) => {
|
||||
fixture.detectChanges();
|
||||
@@ -377,7 +377,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should allow injecting from the element injector',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(ParentComp)
|
||||
.then((fixture) => {
|
||||
@@ -391,7 +391,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should list event listeners',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(EventsComp)
|
||||
.then((fixture) => {
|
||||
@@ -406,7 +406,7 @@ export function main() {
|
||||
|
||||
|
||||
it('should trigger event handlers',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
|
||||
tcb.createAsync(EventsComp)
|
||||
.then((fixture) => {
|
||||
|
||||
@@ -290,7 +290,7 @@ export function main() {
|
||||
|
||||
it('should support overriding factory dependencies', () => {
|
||||
var injector = createInjector(
|
||||
[Engine, {provide: Car, useFactory: (e: any /** TODO #9100 */) => new SportsCar(e), deps: [Engine]}]);
|
||||
[Engine, {provide: Car, useFactory: (e: Engine) => new SportsCar(e), deps: [Engine]}]);
|
||||
|
||||
var car = injector.get(Car);
|
||||
expect(car).toBeAnInstanceOf(SportsCar);
|
||||
@@ -483,7 +483,7 @@ export function main() {
|
||||
it("should return a dependency from self", () => {
|
||||
var inj = ReflectiveInjector.resolveAndCreate([
|
||||
Engine,
|
||||
{provide: Car, useFactory: (e: any /** TODO #9100 */) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
{provide: Car, useFactory: (e: Engine) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
]);
|
||||
|
||||
expect(inj.get(Car)).toBeAnInstanceOf(Car);
|
||||
@@ -492,7 +492,7 @@ export function main() {
|
||||
it("should throw when not requested provider on self", () => {
|
||||
var parent = ReflectiveInjector.resolveAndCreate([Engine]);
|
||||
var child = parent.resolveAndCreateChild([
|
||||
{provide: Car, useFactory: (e: any /** TODO #9100 */) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
{provide: Car, useFactory: (e: Engine) => new Car(e), deps: [[Engine, new SelfMetadata()]]}
|
||||
]);
|
||||
|
||||
expect(() => child.get(Car))
|
||||
@@ -505,7 +505,7 @@ export function main() {
|
||||
var parent = ReflectiveInjector.resolveAndCreate([Engine]);
|
||||
var child = parent.resolveAndCreateChild([
|
||||
{provide: Engine, useClass: TurboEngine},
|
||||
{provide: Car, useFactory: (e: any /** TODO #9100 */) => new Car(e), deps: [Engine]}
|
||||
{provide: Car, useFactory: (e: Engine) => new Car(e), deps: [Engine]}
|
||||
]);
|
||||
|
||||
expect(child.get(Car).engine).toBeAnInstanceOf(TurboEngine);
|
||||
|
||||
@@ -29,7 +29,7 @@ export function main() {
|
||||
|
||||
it('should invoke lifecycle methods ngOnChanges > ngOnInit > ngDoCheck > ngAfterContentChecked',
|
||||
inject([TestComponentBuilder, Log, AsyncTestCompleter], (tcb: TestComponentBuilder, log: Log,
|
||||
async: any /** TODO #9100 */) => {
|
||||
async: AsyncTestCompleter) => {
|
||||
tcb.overrideView(
|
||||
MyComp5,
|
||||
new ViewMetadata(
|
||||
|
||||
@@ -16,7 +16,7 @@ export function main() {
|
||||
describe("Observable", () => {
|
||||
describe("#core", () => {
|
||||
|
||||
it("should call next with values", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it("should call next with values", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
|
||||
let o = new Observable((sink: any /** TODO #9100 */) => { sink.next(1); });
|
||||
|
||||
@@ -27,7 +27,7 @@ export function main() {
|
||||
|
||||
}));
|
||||
|
||||
it("should call next and then complete", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it("should call next and then complete", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
|
||||
let o = new Observable((sink: any /** TODO #9100 */) => {
|
||||
sink.next(1);
|
||||
@@ -42,7 +42,7 @@ export function main() {
|
||||
|
||||
}));
|
||||
|
||||
it("should call error with errors", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
it("should call error with errors", inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
|
||||
let o = new Observable((sink: any /** TODO #9100 */) => { sink.error('oh noes!'); });
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import {asNativeElements} from '@angular/core';
|
||||
export function main() {
|
||||
describe("forwardRef integration", function() {
|
||||
it('should instantiate components which are declared using forwardRef',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(App).then((tc) => {
|
||||
tc.detectChanges();
|
||||
expect(asNativeElements(tc.debugElement.children)).toHaveText('frame(lock)');
|
||||
|
||||
@@ -19,16 +19,11 @@ import {
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
|
||||
import {
|
||||
isPresent,
|
||||
isBlank,
|
||||
isNumber,
|
||||
isJsObject,
|
||||
FunctionWrapper,
|
||||
NumberWrapper,
|
||||
normalizeBool
|
||||
} from '../../src/facade/lang';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {MapWrapper, StringMapWrapper} from '../../src/facade/collection';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
import {
|
||||
@@ -130,7 +125,7 @@ export function main() {
|
||||
]);
|
||||
|
||||
beforeEach(inject([TestComponentBuilder, ElementSchemaRegistry, RenderLog, DirectiveLog],
|
||||
(_tcb: any /** TODO #9100 */, _elSchema: any /** TODO #9100 */, _renderLog: any /** TODO #9100 */, _directiveLog: any /** TODO #9100 */) => {
|
||||
(_tcb: TestComponentBuilder, _elSchema: MockSchemaRegistry, _renderLog: RenderLog, _directiveLog: DirectiveLog) => {
|
||||
tcb = _tcb;
|
||||
elSchema = _elSchema;
|
||||
renderLog = _renderLog;
|
||||
|
||||
@@ -28,7 +28,7 @@ export function main() {
|
||||
describe("loading next to a location", () => {
|
||||
it('should work',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoaded,
|
||||
@@ -44,7 +44,7 @@ export function main() {
|
||||
it('should return a disposable component ref',
|
||||
inject(
|
||||
[DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoaded, tc.componentInstance.viewContainerRef)
|
||||
@@ -67,7 +67,7 @@ export function main() {
|
||||
|
||||
it('should update host properties',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
|
||||
@@ -90,7 +90,7 @@ export function main() {
|
||||
|
||||
it('should leave the view tree in a consistent state if hydration fails',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc: ComponentFixture<any>) => {
|
||||
tc.detectChanges();
|
||||
PromiseWrapper.catchError(
|
||||
@@ -107,7 +107,7 @@ export function main() {
|
||||
|
||||
it('should allow to pass projectable nodes',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
|
||||
@@ -124,7 +124,7 @@ export function main() {
|
||||
|
||||
it('should not throw if not enough projectable nodes are passed in',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
|
||||
tcb.createAsync(MyComp3).then((tc) => {
|
||||
tc.detectChanges();
|
||||
loader.loadNextToLocation(DynamicallyLoadedWithNgContent,
|
||||
@@ -138,7 +138,7 @@ export function main() {
|
||||
describe('loadAsRoot', () => {
|
||||
it('should allow to create, update and destroy components',
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async: any /** TODO #9100 */, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
(async: AsyncTestCompleter, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
var rootEl = createRootElement(doc, 'child-cmp');
|
||||
getDOM().appendChild(doc.body, rootEl);
|
||||
loader.loadAsRoot(ChildComp, null, injector)
|
||||
@@ -167,7 +167,7 @@ export function main() {
|
||||
|
||||
it('should allow to pass projectable nodes',
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async: any /** TODO #9100 */, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
(async: AsyncTestCompleter, loader: DynamicComponentLoader, doc: any /** TODO #9100 */, injector: Injector) => {
|
||||
var rootEl = createRootElement(doc, 'dummy');
|
||||
getDOM().appendChild(doc.body, rootEl);
|
||||
loader.loadAsRoot(DynamicallyLoadedWithNgContent, null, injector, null,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user