refactor(TypeScript): Add noImplicitAny
We automatically insert explicit 'any's where needed. These need to be addressed as in #9100. Fixes #4924
This commit is contained in:
parent
87d824e1b4
commit
86fbd50c3d
|
@ -144,7 +144,7 @@ export class NgFor implements DoCheck {
|
||||||
viewRef.context.count = ilen;
|
viewRef.context.count = ilen;
|
||||||
}
|
}
|
||||||
|
|
||||||
changes.forEachIdentityChange((record) => {
|
changes.forEachIdentityChange((record: any /** TODO #9100 */) => {
|
||||||
var viewRef = <EmbeddedViewRef<NgForRow>>this._viewContainer.get(record.currentIndex);
|
var viewRef = <EmbeddedViewRef<NgForRow>>this._viewContainer.get(record.currentIndex);
|
||||||
viewRef.context.$implicit = record.item;
|
viewRef.context.$implicit = record.item;
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,7 @@ export function main() {
|
||||||
describe('binding to CSS class list', () => {
|
describe('binding to CSS class list', () => {
|
||||||
|
|
||||||
it('should clean up when the directive is destroyed',
|
it('should clean up when the directive is destroyed',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div *ngFor="let item of items" [ngClass]="item"></div>';
|
var template = '<div *ngFor="let item of items" [ngClass]="item"></div>';
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
|
@ -44,7 +44,7 @@ export function main() {
|
||||||
describe('expressions evaluating to objects', () => {
|
describe('expressions evaluating to objects', () => {
|
||||||
|
|
||||||
it('should add classes specified in an object literal',
|
it('should add classes specified in an object literal',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="{foo: true, bar: false}"></div>';
|
var template = '<div [ngClass]="{foo: true, bar: false}"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -57,7 +57,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
it('should add classes specified in an object literal without change in class names',
|
it('should add classes specified in an object literal without change in class names',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngClass]="{'foo-bar': true, 'fooBar': true}"></div>`;
|
var template = `<div [ngClass]="{'foo-bar': true, 'fooBar': true}"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -69,7 +69,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should add and remove classes based on changes in object literal values',
|
it('should add and remove classes based on changes in object literal values',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="{foo: condition, bar: !condition}"></div>';
|
var template = '<div [ngClass]="{foo: condition, bar: !condition}"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -85,7 +85,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should add and remove classes based on changes to the expression object',
|
it('should add and remove classes based on changes to the expression object',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="objExpr"></div>';
|
var template = '<div [ngClass]="objExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -107,7 +107,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should add and remove classes based on reference changes to the expression object',
|
it('should add and remove classes based on reference changes to the expression object',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="objExpr"></div>';
|
var template = '<div [ngClass]="objExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -126,7 +126,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should remove active classes when expression evaluates to null',
|
it('should remove active classes when expression evaluates to null',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="objExpr"></div>';
|
var template = '<div [ngClass]="objExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -146,7 +146,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
it('should allow multiple classes per expression',
|
it('should allow multiple classes per expression',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="objExpr"></div>';
|
var template = '<div [ngClass]="objExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -171,7 +171,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should split by one or more spaces between classes',
|
it('should split by one or more spaces between classes',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="objExpr"></div>';
|
var template = '<div [ngClass]="objExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -190,7 +190,7 @@ export function main() {
|
||||||
describe('expressions evaluating to lists', () => {
|
describe('expressions evaluating to lists', () => {
|
||||||
|
|
||||||
it('should add classes specified in a list literal',
|
it('should add classes specified in a list literal',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngClass]="['foo', 'bar', 'foo-bar', 'fooBar']"></div>`;
|
var template = `<div [ngClass]="['foo', 'bar', 'foo-bar', 'fooBar']"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -202,7 +202,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should add and remove classes based on changes to the expression',
|
it('should add and remove classes based on changes to the expression',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="arrExpr"></div>';
|
var template = '<div [ngClass]="arrExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -225,7 +225,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should add and remove classes when a reference changes',
|
it('should add and remove classes when a reference changes',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="arrExpr"></div>';
|
var template = '<div [ngClass]="arrExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -241,7 +241,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should take initial classes into account when a reference changes',
|
it('should take initial classes into account when a reference changes',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div class="foo" [ngClass]="arrExpr"></div>';
|
var template = '<div class="foo" [ngClass]="arrExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -257,7 +257,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should ignore empty or blank class names',
|
it('should ignore empty or blank class names',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div class="foo" [ngClass]="arrExpr"></div>';
|
var template = '<div class="foo" [ngClass]="arrExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -272,7 +272,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should trim blanks from class names',
|
it('should trim blanks from class names',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div class="foo" [ngClass]="arrExpr"></div>';
|
var template = '<div class="foo" [ngClass]="arrExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -288,7 +288,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
it('should allow multiple classes per item in arrays',
|
it('should allow multiple classes per item in arrays',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="arrExpr"></div>';
|
var template = '<div [ngClass]="arrExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -310,7 +310,7 @@ export function main() {
|
||||||
describe('expressions evaluating to sets', () => {
|
describe('expressions evaluating to sets', () => {
|
||||||
|
|
||||||
it('should add and remove classes if the set instance changed',
|
it('should add and remove classes if the set instance changed',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="setExpr"></div>';
|
var template = '<div [ngClass]="setExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -333,7 +333,7 @@ export function main() {
|
||||||
describe('expressions evaluating to string', () => {
|
describe('expressions evaluating to string', () => {
|
||||||
|
|
||||||
it('should add classes specified in a string literal',
|
it('should add classes specified in a string literal',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngClass]="'foo bar foo-bar fooBar'"></div>`;
|
var template = `<div [ngClass]="'foo bar foo-bar fooBar'"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -345,7 +345,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should add and remove classes based on changes to the expression',
|
it('should add and remove classes based on changes to the expression',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="strExpr"></div>';
|
var template = '<div [ngClass]="strExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -365,7 +365,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should remove active classes when switching from string to null',
|
it('should remove active classes when switching from string to null',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngClass]="strExpr"></div>`;
|
var template = `<div [ngClass]="strExpr"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -381,7 +381,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should take initial classes into account when switching from string to null',
|
it('should take initial classes into account when switching from string to null',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div class="foo" [ngClass]="strExpr"></div>`;
|
var template = `<div class="foo" [ngClass]="strExpr"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -397,7 +397,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should ignore empty and blank strings',
|
it('should ignore empty and blank strings',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div class="foo" [ngClass]="strExpr"></div>`;
|
var template = `<div class="foo" [ngClass]="strExpr"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -415,7 +415,7 @@ export function main() {
|
||||||
describe('cooperation with other class-changing constructs', () => {
|
describe('cooperation with other class-changing constructs', () => {
|
||||||
|
|
||||||
it('should co-operate with the class attribute',
|
it('should co-operate with the class attribute',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div [ngClass]="objExpr" class="init foo"></div>';
|
var template = '<div [ngClass]="objExpr" class="init foo"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -435,7 +435,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should co-operate with the interpolated class attribute',
|
it('should co-operate with the interpolated class attribute',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngClass]="objExpr" class="{{'init foo'}}"></div>`;
|
var template = `<div [ngClass]="objExpr" class="{{'init foo'}}"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -455,7 +455,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should co-operate with the class attribute and binding to it',
|
it('should co-operate with the class attribute and binding to it',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngClass]="objExpr" class="init" [class]="'foo'"></div>`;
|
var template = `<div [ngClass]="objExpr" class="init" [class]="'foo'"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -475,7 +475,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should co-operate with the class attribute and class.name binding',
|
it('should co-operate with the class attribute and class.name binding',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div class="init foo" [ngClass]="objExpr" [class.baz]="condition"></div>';
|
'<div class="init foo" [ngClass]="objExpr" [class.baz]="condition"></div>';
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should co-operate with initial class and class attribute binding when binding changes',
|
it('should co-operate with initial class and class attribute binding when binding changes',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div class="init" [ngClass]="objExpr" [class]="strExpr"></div>';
|
var template = '<div class="init" [ngClass]="objExpr" [class]="strExpr"></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
|
|
@ -25,7 +25,7 @@ export function main() {
|
||||||
'<div><copy-me template="ngFor let item of items">{{item.toString()}};</copy-me></div>';
|
'<div><copy-me template="ngFor let item of items">{{item.toString()}};</copy-me></div>';
|
||||||
|
|
||||||
it('should reflect initial elements',
|
it('should reflect initial elements',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -36,7 +36,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should reflect added elements',
|
it('should reflect added elements',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -51,7 +51,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should reflect removed elements',
|
it('should reflect removed elements',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -66,7 +66,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should reflect moved elements',
|
it('should reflect moved elements',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -82,7 +82,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should reflect a mix of all changes (additions/removals/moves)',
|
it('should reflect a mix of all changes (additions/removals/moves)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -98,7 +98,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should iterate over an array of objects',
|
it('should iterate over an array of objects',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<ul><li template="ngFor let item of items">{{item["name"]}};</li></ul>';
|
var template = '<ul><li template="ngFor let item of items">{{item["name"]}};</li></ul>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -128,7 +128,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should gracefully handle nulls',
|
it('should gracefully handle nulls',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<ul><li template="ngFor let item of null">{{item}};</li></ul>';
|
var template = '<ul><li template="ngFor let item of null">{{item}};</li></ul>';
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
|
@ -140,7 +140,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should gracefully handle ref changing to null and back',
|
it('should gracefully handle ref changing to null and back',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -160,7 +160,7 @@ export function main() {
|
||||||
|
|
||||||
if (!IS_DART) {
|
if (!IS_DART) {
|
||||||
it('should throw on non-iterable ref and suggest using an array',
|
it('should throw on non-iterable ref and suggest using an array',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -177,7 +177,7 @@ export function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should throw on ref changing to string',
|
it('should throw on ref changing to string',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -191,7 +191,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should works with duplicates',
|
it('should works with duplicates',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
tcb.overrideTemplate(TestComponent, TEMPLATE)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
.then((fixture) => {
|
.then((fixture) => {
|
||||||
|
@ -204,7 +204,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should repeat over nested arrays',
|
it('should repeat over nested arrays',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div>' +
|
var template = '<div>' +
|
||||||
'<div template="ngFor let item of items">' +
|
'<div template="ngFor let item of items">' +
|
||||||
'<div template="ngFor let subitem of item">' +
|
'<div template="ngFor let subitem of item">' +
|
||||||
|
@ -231,7 +231,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should repeat over nested arrays with no intermediate element',
|
it('should repeat over nested arrays with no intermediate element',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div><template ngFor let-item [ngForOf]="items">' +
|
var template = '<div><template ngFor let-item [ngForOf]="items">' +
|
||||||
'<div template="ngFor let subitem of item">' +
|
'<div template="ngFor let subitem of item">' +
|
||||||
'{{subitem}}-{{item.length}};' +
|
'{{subitem}}-{{item.length}};' +
|
||||||
|
@ -252,7 +252,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should repeat over nested ngIf that are the last node in the ngFor temlate',
|
it('should repeat over nested ngIf that are the last node in the ngFor temlate',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
`<div><template ngFor let-item [ngForOf]="items" let-i="index"><div>{{i}}|</div>` +
|
`<div><template ngFor let-item [ngForOf]="items" let-i="index"><div>{{i}}|</div>` +
|
||||||
`<div *ngIf="i % 2 == 0">even|</div></template></div>`;
|
`<div *ngIf="i % 2 == 0">even|</div></template></div>`;
|
||||||
|
@ -279,7 +279,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should display indices correctly',
|
it('should display indices correctly',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div><copy-me template="ngFor: let item of items; let i=index">{{i.toString()}}</copy-me></div>';
|
'<div><copy-me template="ngFor: let item of items; let i=index">{{i.toString()}}</copy-me></div>';
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should display first item correctly',
|
it('should display first item correctly',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div><copy-me template="ngFor: let item of items; let isFirst=first">{{isFirst.toString()}}</copy-me></div>';
|
'<div><copy-me template="ngFor: let item of items; let isFirst=first">{{isFirst.toString()}}</copy-me></div>';
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should display last item correctly',
|
it('should display last item correctly',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div><copy-me template="ngFor: let item of items; let isLast=last">{{isLast.toString()}}</copy-me></div>';
|
'<div><copy-me template="ngFor: let item of items; let isLast=last">{{isLast.toString()}}</copy-me></div>';
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should display even items correctly',
|
it('should display even items correctly',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div><copy-me template="ngFor: let item of items; let isEven=even">{{isEven.toString()}}</copy-me></div>';
|
'<div><copy-me template="ngFor: let item of items; let isEven=even">{{isEven.toString()}}</copy-me></div>';
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should display odd items correctly',
|
it('should display odd items correctly',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div><copy-me template="ngFor: let item of items; let isOdd=odd">{{isOdd.toString()}}</copy-me></div>';
|
'<div><copy-me template="ngFor: let item of items; let isOdd=odd">{{isOdd.toString()}}</copy-me></div>';
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should allow to use a custom template',
|
it('should allow to use a custom template',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(
|
tcb.overrideTemplate(
|
||||||
TestComponent,
|
TestComponent,
|
||||||
'<ul><template ngFor [ngForOf]="items" [ngForTemplate]="contentTpl"></template></ul>')
|
'<ul><template ngFor [ngForOf]="items" [ngForTemplate]="contentTpl"></template></ul>')
|
||||||
|
@ -393,7 +393,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should use a default template if a custom one is null',
|
it('should use a default template if a custom one is null',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items"
|
tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items"
|
||||||
[ngForTemplate]="contentTpl" let-i="index">{{i}}: {{item}};</template></ul>`)
|
[ngForTemplate]="contentTpl" let-i="index">{{i}}: {{item}};</template></ul>`)
|
||||||
.overrideTemplate(ComponentUsingTestComponent, '<test-cmp></test-cmp>')
|
.overrideTemplate(ComponentUsingTestComponent, '<test-cmp></test-cmp>')
|
||||||
|
@ -409,7 +409,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should use a custom template when both default and a custom one are present',
|
it('should use a custom template when both default and a custom one are present',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items"
|
tcb.overrideTemplate(TestComponent, `<ul><template ngFor let-item [ngForOf]="items"
|
||||||
[ngForTemplate]="contentTpl" let-i="index">{{i}}=> {{item}};</template></ul>`)
|
[ngForTemplate]="contentTpl" let-i="index">{{i}}=> {{item}};</template></ul>`)
|
||||||
.overrideTemplate(
|
.overrideTemplate(
|
||||||
|
@ -428,7 +428,7 @@ export function main() {
|
||||||
|
|
||||||
describe('track by', function() {
|
describe('track by', function() {
|
||||||
it('should not replace tracked items',
|
it('should not replace tracked items',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
`<template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById" let-i="index">
|
`<template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById" let-i="index">
|
||||||
<p>{{items[i]}}</p>
|
<p>{{items[i]}}</p>
|
||||||
|
@ -450,7 +450,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
it('should update implicit local variable on view',
|
it('should update implicit local variable on view',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
|
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -466,7 +466,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
it('should move items around and keep them updated ',
|
it('should move items around and keep them updated ',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
|
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById">{{item['color']}}</template></div>`;
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -485,7 +485,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should handle added and removed items properly when tracking by index',
|
it('should handle added and removed items properly when tracking by index',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackByIndex">{{item}}</template></div>`;
|
`<div><template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackByIndex">{{item}}</template></div>`;
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {IS_DART} from '../../src/facade/lang';
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('ngIf directive', () => {
|
describe('ngIf directive', () => {
|
||||||
it('should work in a template attribute',
|
it('should work in a template attribute',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>';
|
var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, html)
|
tcb.overrideTemplate(TestComponent, html)
|
||||||
|
@ -37,7 +37,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should work in a template element',
|
it('should work in a template element',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html =
|
var html =
|
||||||
'<div><template [ngIf]="booleanCondition"><copy-me>hello2</copy-me></template></div>';
|
'<div><template [ngIf]="booleanCondition"><copy-me>hello2</copy-me></template></div>';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should toggle node when condition changes',
|
it('should toggle node when condition changes',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>';
|
var html = '<div><copy-me template="ngIf booleanCondition">hello</copy-me></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, html)
|
tcb.overrideTemplate(TestComponent, html)
|
||||||
|
@ -86,7 +86,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should handle nested if correctly',
|
it('should handle nested if correctly',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html =
|
var html =
|
||||||
'<div><template [ngIf]="booleanCondition"><copy-me *ngIf="nestedBooleanCondition">hello</copy-me></template></div>';
|
'<div><template [ngIf]="booleanCondition"><copy-me *ngIf="nestedBooleanCondition">hello</copy-me></template></div>';
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should update several nodes with if',
|
it('should update several nodes with if',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html =
|
var html =
|
||||||
'<div>' +
|
'<div>' +
|
||||||
'<copy-me template="ngIf numberCondition + 1 >= 2">helloNumber</copy-me>' +
|
'<copy-me template="ngIf numberCondition + 1 >= 2">helloNumber</copy-me>' +
|
||||||
|
@ -172,7 +172,7 @@ export function main() {
|
||||||
|
|
||||||
if (!IS_DART) {
|
if (!IS_DART) {
|
||||||
it('should not add the element twice if the condition goes from true to true (JS)',
|
it('should not add the element twice if the condition goes from true to true (JS)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
|
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, html)
|
tcb.overrideTemplate(TestComponent, html)
|
||||||
|
@ -198,7 +198,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should not recreate the element if the condition goes from true to true (JS)',
|
it('should not recreate the element if the condition goes from true to true (JS)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
|
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, html)
|
tcb.overrideTemplate(TestComponent, html)
|
||||||
|
@ -222,7 +222,7 @@ export function main() {
|
||||||
|
|
||||||
if (IS_DART) {
|
if (IS_DART) {
|
||||||
it('should not create the element if the condition is not a boolean (DART)',
|
it('should not create the element if the condition is not a boolean (DART)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
|
var html = '<div><copy-me template="ngIf numberCondition">hello</copy-me></div>';
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, html)
|
tcb.overrideTemplate(TestComponent, html)
|
||||||
|
@ -254,6 +254,6 @@ class TestComponent {
|
||||||
this.nestedBooleanCondition = true;
|
this.nestedBooleanCondition = true;
|
||||||
this.numberCondition = 1;
|
this.numberCondition = 1;
|
||||||
this.stringCondition = "foo";
|
this.stringCondition = "foo";
|
||||||
this.functionCondition = function(s, n) { return s == "foo" && n == 1; };
|
this.functionCondition = function(s: any /** TODO #9100 */, n: any /** TODO #9100 */) { return s == "foo" && n == 1; };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function main() {
|
||||||
beforeEachProviders(() => [{provide: NgLocalization, useClass: TestLocalizationMap}]);
|
beforeEachProviders(() => [{provide: NgLocalization, useClass: TestLocalizationMap}]);
|
||||||
|
|
||||||
it('should display the template according to the exact value',
|
it('should display the template according to the exact value',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div>' +
|
var template = '<div>' +
|
||||||
'<ul [ngPlural]="switchValue">' +
|
'<ul [ngPlural]="switchValue">' +
|
||||||
'<template ngPluralCase="=0"><li>you have no messages.</li></template>' +
|
'<template ngPluralCase="=0"><li>you have no messages.</li></template>' +
|
||||||
|
@ -43,7 +43,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should display the template according to the category',
|
it('should display the template according to the category',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div>' +
|
'<div>' +
|
||||||
'<ul [ngPlural]="switchValue">' +
|
'<ul [ngPlural]="switchValue">' +
|
||||||
|
@ -67,7 +67,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should default to other when no matches are found',
|
it('should default to other when no matches are found',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div>' +
|
'<div>' +
|
||||||
'<ul [ngPlural]="switchValue">' +
|
'<ul [ngPlural]="switchValue">' +
|
||||||
|
@ -87,7 +87,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should prioritize value matches over category matches',
|
it('should prioritize value matches over category matches',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
'<div>' +
|
'<div>' +
|
||||||
'<ul [ngPlural]="switchValue">' +
|
'<ul [ngPlural]="switchValue">' +
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function main() {
|
||||||
describe('binding to CSS styles', () => {
|
describe('binding to CSS styles', () => {
|
||||||
|
|
||||||
it('should add styles specified in an object literal',
|
it('should add styles specified in an object literal',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngStyle]="{'max-width': '40px'}"></div>`;
|
var template = `<div [ngStyle]="{'max-width': '40px'}"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -40,7 +40,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should add and change styles specified in an object expression',
|
it('should add and change styles specified in an object expression',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngStyle]="expr"></div>`;
|
var template = `<div [ngStyle]="expr"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -55,7 +55,7 @@ export function main() {
|
||||||
.toEqual('40px');
|
.toEqual('40px');
|
||||||
|
|
||||||
expr = fixture.debugElement.componentInstance.expr;
|
expr = fixture.debugElement.componentInstance.expr;
|
||||||
expr['max-width'] = '30%';
|
(expr as any /** TODO #9100 */)['max-width'] = '30%';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(
|
expect(
|
||||||
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
|
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
|
||||||
|
@ -66,7 +66,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should remove styles when deleting a key in an object expression',
|
it('should remove styles when deleting a key in an object expression',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [ngStyle]="expr"></div>`;
|
var template = `<div [ngStyle]="expr"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -89,7 +89,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should co-operate with the style attribute',
|
it('should co-operate with the style attribute',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div style="font-size: 12px" [ngStyle]="expr"></div>`;
|
var template = `<div style="font-size: 12px" [ngStyle]="expr"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -118,7 +118,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should co-operate with the style.[styleName]="expr" special-case in the compiler',
|
it('should co-operate with the style.[styleName]="expr" special-case in the compiler',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<div [style.font-size.px]="12" [ngStyle]="expr"></div>`;
|
var template = `<div [style.font-size.px]="12" [ngStyle]="expr"></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -151,5 +151,5 @@ export function main() {
|
||||||
|
|
||||||
@Component({selector: 'test-cmp', directives: [NgStyle], template: ''})
|
@Component({selector: 'test-cmp', directives: [NgStyle], template: ''})
|
||||||
class TestComponent {
|
class TestComponent {
|
||||||
expr;
|
expr: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function main() {
|
||||||
describe('switch', () => {
|
describe('switch', () => {
|
||||||
describe('switch value changes', () => {
|
describe('switch value changes', () => {
|
||||||
it('should switch amongst when values',
|
it('should switch amongst when values',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div>' +
|
var template = '<div>' +
|
||||||
'<ul [ngSwitch]="switchValue">' +
|
'<ul [ngSwitch]="switchValue">' +
|
||||||
'<template ngSwitchWhen="a"><li>when a</li></template>' +
|
'<template ngSwitchWhen="a"><li>when a</li></template>' +
|
||||||
|
@ -44,7 +44,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should switch amongst when values with fallback to default',
|
it('should switch amongst when values with fallback to default',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div>' +
|
var template = '<div>' +
|
||||||
'<ul [ngSwitch]="switchValue">' +
|
'<ul [ngSwitch]="switchValue">' +
|
||||||
'<li template="ngSwitchWhen \'a\'">when a</li>' +
|
'<li template="ngSwitchWhen \'a\'">when a</li>' +
|
||||||
|
@ -70,7 +70,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should support multiple whens with the same value',
|
it('should support multiple whens with the same value',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div>' +
|
var template = '<div>' +
|
||||||
'<ul [ngSwitch]="switchValue">' +
|
'<ul [ngSwitch]="switchValue">' +
|
||||||
'<template ngSwitchWhen="a"><li>when a1;</li></template>' +
|
'<template ngSwitchWhen="a"><li>when a1;</li></template>' +
|
||||||
|
@ -103,7 +103,7 @@ export function main() {
|
||||||
|
|
||||||
describe('when values changes', () => {
|
describe('when values changes', () => {
|
||||||
it('should switch amongst when values',
|
it('should switch amongst when values',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div>' +
|
var template = '<div>' +
|
||||||
'<ul [ngSwitch]="switchValue">' +
|
'<ul [ngSwitch]="switchValue">' +
|
||||||
'<template [ngSwitchWhen]="when1"><li>when 1;</li></template>' +
|
'<template [ngSwitchWhen]="when1"><li>when 1;</li></template>' +
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {NgTemplateOutlet} from '@angular/common';
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('insert', () => {
|
describe('insert', () => {
|
||||||
it('should do nothing if templateRef is null',
|
it('should do nothing if templateRef is null',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<template [ngTemplateOutlet]="null"></template>`;
|
var template = `<template [ngTemplateOutlet]="null"></template>`;
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
|
@ -30,7 +30,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should insert content specified by TemplateRef',
|
it('should insert content specified by TemplateRef',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -51,7 +51,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should clear content if TemplateRef becomes null',
|
it('should clear content if TemplateRef becomes null',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template =
|
var template =
|
||||||
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
`<tpl-refs #refs="tplRefs"><template>foo</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
|
@ -74,7 +74,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should swap content if TemplateRef changes',
|
it('should swap content if TemplateRef changes',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = `<tpl-refs #refs="tplRefs"><template>foo</template><template>bar</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
var template = `<tpl-refs #refs="tplRefs"><template>foo</template><template>bar</template></tpl-refs><template [ngTemplateOutlet]="currentTplRef"></template>`;
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('non-bindable', () => {
|
describe('non-bindable', () => {
|
||||||
it('should not interpolate children',
|
it('should not interpolate children',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div>{{text}}<span ngNonBindable>{{text}}</span></div>';
|
var template = '<div>{{text}}<span ngNonBindable>{{text}}</span></div>';
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
|
@ -29,7 +29,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should ignore directives on child nodes',
|
it('should ignore directives on child nodes',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div ngNonBindable><span id=child test-dec>{{text}}</span></div>';
|
var template = '<div ngNonBindable><span id=child test-dec>{{text}}</span></div>';
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
|
@ -45,7 +45,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should trigger directives on the same node',
|
it('should trigger directives on the same node',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var template = '<div><span id=child ngNonBindable test-dec>{{text}}</span></div>';
|
var template = '<div><span id=child ngNonBindable test-dec>{{text}}</span></div>';
|
||||||
tcb.overrideTemplate(TestComponent, template)
|
tcb.overrideTemplate(TestComponent, template)
|
||||||
.createAsync(TestComponent)
|
.createAsync(TestComponent)
|
||||||
|
|
|
@ -44,10 +44,10 @@ import {PromiseWrapper} from '../../src/facade/promise';
|
||||||
import {SimpleChange} from '@angular/core/src/change_detection';
|
import {SimpleChange} from '@angular/core/src/change_detection';
|
||||||
|
|
||||||
class DummyControlValueAccessor implements ControlValueAccessor {
|
class DummyControlValueAccessor implements ControlValueAccessor {
|
||||||
writtenValue;
|
writtenValue: any /** TODO #9100 */;
|
||||||
|
|
||||||
registerOnChange(fn) {}
|
registerOnChange(fn: any /** TODO #9100 */) {}
|
||||||
registerOnTouched(fn) {}
|
registerOnTouched(fn: any /** TODO #9100 */) {}
|
||||||
|
|
||||||
writeValue(obj: any): void { this.writtenValue = obj; }
|
writeValue(obj: any): void { this.writtenValue = obj; }
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ class CustomValidatorDirective implements Validator {
|
||||||
validate(c: Control): {[key: string]: any} { return {"custom": true}; }
|
validate(c: Control): {[key: string]: any} { return {"custom": true}; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function asyncValidator(expected, timeout = 0) {
|
function asyncValidator(expected: any /** TODO #9100 */, timeout = 0) {
|
||||||
return (c) => {
|
return (c: any /** TODO #9100 */) => {
|
||||||
var completer = PromiseWrapper.completer();
|
var completer = PromiseWrapper.completer();
|
||||||
var res = c.value != expected ? {"async": true} : null;
|
var res = c.value != expected ? {"async": true} : null;
|
||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
|
@ -120,14 +120,14 @@ export function main() {
|
||||||
|
|
||||||
describe("composeValidators", () => {
|
describe("composeValidators", () => {
|
||||||
it("should compose functions", () => {
|
it("should compose functions", () => {
|
||||||
var dummy1 = (_) => ({"dummy1": true});
|
var dummy1 = (_: any /** TODO #9100 */) => ({"dummy1": true});
|
||||||
var dummy2 = (_) => ({"dummy2": true});
|
var dummy2 = (_: any /** TODO #9100 */) => ({"dummy2": true});
|
||||||
var v = composeValidators([dummy1, dummy2]);
|
var v = composeValidators([dummy1, dummy2]);
|
||||||
expect(v(new Control(""))).toEqual({"dummy1": true, "dummy2": true});
|
expect(v(new Control(""))).toEqual({"dummy1": true, "dummy2": true});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should compose validator directives", () => {
|
it("should compose validator directives", () => {
|
||||||
var dummy1 = (_) => ({"dummy1": true});
|
var dummy1 = (_: any /** TODO #9100 */) => ({"dummy1": true});
|
||||||
var v = composeValidators([dummy1, new CustomValidatorDirective()]);
|
var v = composeValidators([dummy1, new CustomValidatorDirective()]);
|
||||||
expect(v(new Control(""))).toEqual({"dummy1": true, "custom": true});
|
expect(v(new Control(""))).toEqual({"dummy1": true, "custom": true});
|
||||||
});
|
});
|
||||||
|
@ -135,9 +135,9 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("NgFormModel", () => {
|
describe("NgFormModel", () => {
|
||||||
var form;
|
var form: any /** TODO #9100 */;
|
||||||
var formModel: ControlGroup;
|
var formModel: ControlGroup;
|
||||||
var loginControlDir;
|
var loginControlDir: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
form = new NgFormModel([], []);
|
form = new NgFormModel([], []);
|
||||||
|
@ -215,7 +215,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("addControlGroup", () => {
|
describe("addControlGroup", () => {
|
||||||
var matchingPasswordsValidator = (g) => {
|
var matchingPasswordsValidator = (g: any /** TODO #9100 */) => {
|
||||||
if (g.controls["password"].value != g.controls["passwordConfirm"].value) {
|
if (g.controls["password"].value != g.controls["passwordConfirm"].value) {
|
||||||
return {"differentPasswords": true};
|
return {"differentPasswords": true};
|
||||||
} else {
|
} else {
|
||||||
|
@ -268,7 +268,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should set up a sync validator", () => {
|
it("should set up a sync validator", () => {
|
||||||
var formValidator = (c) => ({"custom": true});
|
var formValidator = (c: any /** TODO #9100 */) => ({"custom": true});
|
||||||
var f = new NgFormModel([formValidator], []);
|
var f = new NgFormModel([formValidator], []);
|
||||||
f.form = formModel;
|
f.form = formModel;
|
||||||
f.ngOnChanges({"form": new SimpleChange(null, null)});
|
f.ngOnChanges({"form": new SimpleChange(null, null)});
|
||||||
|
@ -289,10 +289,10 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("NgForm", () => {
|
describe("NgForm", () => {
|
||||||
var form;
|
var form: any /** TODO #9100 */;
|
||||||
var formModel: ControlGroup;
|
var formModel: ControlGroup;
|
||||||
var loginControlDir;
|
var loginControlDir: any /** TODO #9100 */;
|
||||||
var personControlGroupDir;
|
var personControlGroupDir: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
form = new NgForm([], []);
|
form = new NgForm([], []);
|
||||||
|
@ -348,7 +348,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should set up sync validator", fakeAsync(() => {
|
it("should set up sync validator", fakeAsync(() => {
|
||||||
var formValidator = (c) => ({"custom": true});
|
var formValidator = (c: any /** TODO #9100 */) => ({"custom": true});
|
||||||
var f = new NgForm([formValidator], []);
|
var f = new NgForm([formValidator], []);
|
||||||
|
|
||||||
tick();
|
tick();
|
||||||
|
@ -366,8 +366,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("NgControlGroup", () => {
|
describe("NgControlGroup", () => {
|
||||||
var formModel;
|
var formModel: any /** TODO #9100 */;
|
||||||
var controlGroupDir;
|
var controlGroupDir: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formModel = new ControlGroup({"login": new Control(null)});
|
formModel = new ControlGroup({"login": new Control(null)});
|
||||||
|
@ -391,9 +391,9 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("NgFormControl", () => {
|
describe("NgFormControl", () => {
|
||||||
var controlDir;
|
var controlDir: any /** TODO #9100 */;
|
||||||
var control;
|
var control: any /** TODO #9100 */;
|
||||||
var checkProperties = function(control) {
|
var checkProperties = function(control: any /** TODO #9100 */) {
|
||||||
expect(controlDir.control).toBe(control);
|
expect(controlDir.control).toBe(control);
|
||||||
expect(controlDir.value).toBe(control.value);
|
expect(controlDir.value).toBe(control.value);
|
||||||
expect(controlDir.valid).toBe(control.valid);
|
expect(controlDir.valid).toBe(control.valid);
|
||||||
|
@ -433,7 +433,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("NgModel", () => {
|
describe("NgModel", () => {
|
||||||
var ngModel;
|
var ngModel: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
ngModel =
|
ngModel =
|
||||||
|
@ -468,8 +468,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("NgControlName", () => {
|
describe("NgControlName", () => {
|
||||||
var formModel;
|
var formModel: any /** TODO #9100 */;
|
||||||
var controlNameDir;
|
var controlNameDir: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
formModel = new Control("name");
|
formModel = new Control("name");
|
||||||
|
|
|
@ -12,11 +12,11 @@ import {Control, FormBuilder} from '@angular/common';
|
||||||
import {PromiseWrapper} from '../../src/facade/promise';
|
import {PromiseWrapper} from '../../src/facade/promise';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function syncValidator(_) { return null; }
|
function syncValidator(_: any /** TODO #9100 */): any /** TODO #9100 */ { return null; }
|
||||||
function asyncValidator(_) { return PromiseWrapper.resolve(null); }
|
function asyncValidator(_: any /** TODO #9100 */) { return PromiseWrapper.resolve(null); }
|
||||||
|
|
||||||
describe("Form Builder", () => {
|
describe("Form Builder", () => {
|
||||||
var b;
|
var b: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => { b = new FormBuilder(); });
|
beforeEach(() => { b = new FormBuilder(); });
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export function main() {
|
||||||
describe("integration tests", () => {
|
describe("integration tests", () => {
|
||||||
|
|
||||||
it("should initialize DOM elements with the given form object",
|
it("should initialize DOM elements with the given form object",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="text" ngControl="login">
|
<input type="text" ngControl="login">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -60,7 +60,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should throw if a form isn't passed into ngFormModel",
|
it("should throw if a form isn't passed into ngFormModel",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="text" ngControl="login">
|
<input type="text" ngControl="login">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -75,7 +75,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should update the control group values on DOM change",
|
it("should update the control group values on DOM change",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form = new ControlGroup({"login": new Control("oldValue")});
|
var form = new ControlGroup({"login": new Control("oldValue")});
|
||||||
|
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
|
@ -98,7 +98,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should ignore the change event for <input type=text>",
|
it("should ignore the change event for <input type=text>",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form = new ControlGroup({"login": new Control("oldValue")});
|
var form = new ControlGroup({"login": new Control("oldValue")});
|
||||||
|
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
|
@ -194,7 +194,7 @@ export function main() {
|
||||||
})));
|
})));
|
||||||
|
|
||||||
it("should work with single controls",
|
it("should work with single controls",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var control = new Control("loginValue");
|
var control = new Control("loginValue");
|
||||||
|
|
||||||
var t = `<div><input type="text" [ngFormControl]="form"></div>`;
|
var t = `<div><input type="text" [ngFormControl]="form"></div>`;
|
||||||
|
@ -217,7 +217,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should update DOM elements when rebinding the control group",
|
it("should update DOM elements when rebinding the control group",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="text" ngControl="login">
|
<input type="text" ngControl="login">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -240,7 +240,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should update DOM elements when updating the value of a control",
|
it("should update DOM elements when updating the value of a control",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var login = new Control("oldValue");
|
var login = new Control("oldValue");
|
||||||
var form = new ControlGroup({"login": login});
|
var form = new ControlGroup({"login": login});
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should mark controls as touched after interacting with the DOM control",
|
it("should mark controls as touched after interacting with the DOM control",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var login = new Control("oldValue");
|
var login = new Control("oldValue");
|
||||||
var form = new ControlGroup({"login": login});
|
var form = new ControlGroup({"login": login});
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ export function main() {
|
||||||
|
|
||||||
describe("different control types", () => {
|
describe("different control types", () => {
|
||||||
it("should support <input type=text>",
|
it("should support <input type=text>",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="text" ngControl="text">
|
<input type="text" ngControl="text">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -316,7 +316,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should support <input> without type",
|
it("should support <input> without type",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input ngControl="text">
|
<input ngControl="text">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -339,7 +339,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should support <textarea>",
|
it("should support <textarea>",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<textarea ngControl="text"></textarea>
|
<textarea ngControl="text"></textarea>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -363,7 +363,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should support <type=checkbox>",
|
it("should support <type=checkbox>",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="checkbox" ngControl="checkbox">
|
<input type="checkbox" ngControl="checkbox">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -388,7 +388,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should support <type=number>",
|
it("should support <type=number>",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="number" ngControl="num">
|
<input type="number" ngControl="num">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -412,7 +412,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should support <type=number> when value is cleared in the UI",
|
it("should support <type=number> when value is cleared in the UI",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="number" ngControl="num" required>
|
<input type="number" ngControl="num" required>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -442,7 +442,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
it("should support <type=number> when value is cleared programmatically",
|
it("should support <type=number> when value is cleared programmatically",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form = new ControlGroup({"num": new Control(10)});
|
var form = new ControlGroup({"num": new Control(10)});
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="number" ngControl="num" [(ngModel)]="data">
|
<input type="number" ngControl="num" [(ngModel)]="data">
|
||||||
|
@ -463,7 +463,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should support <type=radio>",
|
it("should support <type=radio>",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<form [ngFormModel]="form">
|
var t = `<form [ngFormModel]="form">
|
||||||
<input type="radio" ngControl="foodChicken" name="food">
|
<input type="radio" ngControl="foodChicken" name="food">
|
||||||
<input type="radio" ngControl="foodFish" name="food">
|
<input type="radio" ngControl="foodFish" name="food">
|
||||||
|
@ -494,7 +494,7 @@ export function main() {
|
||||||
describe("should support <select>", () => {
|
describe("should support <select>", () => {
|
||||||
it("with basic selection",
|
it("with basic selection",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<select>
|
var t = `<select>
|
||||||
<option value="SF"></option>
|
<option value="SF"></option>
|
||||||
<option value="NYC"></option>
|
<option value="NYC"></option>
|
||||||
|
@ -516,7 +516,7 @@ export function main() {
|
||||||
|
|
||||||
it("with basic selection and value bindings",
|
it("with basic selection and value bindings",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<select>
|
var t = `<select>
|
||||||
<option *ngFor="let city of list" [value]="city['id']">
|
<option *ngFor="let city of list" [value]="city['id']">
|
||||||
{{ city['name'] }}
|
{{ city['name'] }}
|
||||||
|
@ -542,7 +542,7 @@ export function main() {
|
||||||
|
|
||||||
it("with ngControl",
|
it("with ngControl",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<select ngControl="city">
|
<select ngControl="city">
|
||||||
<option value="SF"></option>
|
<option value="SF"></option>
|
||||||
|
@ -582,7 +582,7 @@ export function main() {
|
||||||
</select>
|
</select>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
var fixture;
|
var fixture: any /** TODO #9100 */;
|
||||||
tcb.overrideTemplate(MyComp8, t)
|
tcb.overrideTemplate(MyComp8, t)
|
||||||
.createAsync(MyComp8)
|
.createAsync(MyComp8)
|
||||||
.then((compFixture) => fixture = compFixture);
|
.then((compFixture) => fixture = compFixture);
|
||||||
|
@ -601,7 +601,7 @@ export function main() {
|
||||||
|
|
||||||
it("with option values that are objects",
|
it("with option values that are objects",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div>
|
var t = `<div>
|
||||||
<select [(ngModel)]="selectedCity">
|
<select [(ngModel)]="selectedCity">
|
||||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||||
|
@ -635,7 +635,7 @@ export function main() {
|
||||||
|
|
||||||
it("when new options are added (selection through the model)",
|
it("when new options are added (selection through the model)",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div>
|
var t = `<div>
|
||||||
<select [(ngModel)]="selectedCity">
|
<select [(ngModel)]="selectedCity">
|
||||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||||
|
@ -665,7 +665,7 @@ export function main() {
|
||||||
|
|
||||||
it("when new options are added (selection through the UI)",
|
it("when new options are added (selection through the UI)",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div>
|
var t = `<div>
|
||||||
<select [(ngModel)]="selectedCity">
|
<select [(ngModel)]="selectedCity">
|
||||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||||
|
@ -698,7 +698,7 @@ export function main() {
|
||||||
|
|
||||||
it("when options are removed",
|
it("when options are removed",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div>
|
var t = `<div>
|
||||||
<select [(ngModel)]="selectedCity">
|
<select [(ngModel)]="selectedCity">
|
||||||
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
|
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
|
||||||
|
@ -726,7 +726,7 @@ export function main() {
|
||||||
|
|
||||||
it("when option values change identity while tracking by index",
|
it("when option values change identity while tracking by index",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div>
|
var t = `<div>
|
||||||
<select [(ngModel)]="selectedCity">
|
<select [(ngModel)]="selectedCity">
|
||||||
<option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option>
|
<option *ngFor="let c of list; trackBy:customTrackBy" [ngValue]="c">{{c}}</option>
|
||||||
|
@ -758,7 +758,7 @@ export function main() {
|
||||||
|
|
||||||
it("with duplicate option values",
|
it("with duplicate option values",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div>
|
var t = `<div>
|
||||||
<select [(ngModel)]="selectedCity">
|
<select [(ngModel)]="selectedCity">
|
||||||
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
|
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
|
||||||
|
@ -789,7 +789,7 @@ export function main() {
|
||||||
|
|
||||||
it("when option values have same content, but different identities",
|
it("when option values have same content, but different identities",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div>
|
var t = `<div>
|
||||||
<select [(ngModel)]="selectedCity">
|
<select [(ngModel)]="selectedCity">
|
||||||
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
<option *ngFor="let c of list" [ngValue]="c">{{c['name']}}</option>
|
||||||
|
@ -819,7 +819,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should support custom value accessors",
|
it("should support custom value accessors",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<input type="text" ngControl="name" wrapped-value>
|
<input type="text" ngControl="name" wrapped-value>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -842,7 +842,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should support custom value accessors on non builtin input elements that fire a change event without a 'target' property",
|
it("should support custom value accessors on non builtin input elements that fire a change event without a 'target' property",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
<my-input ngControl="name"></my-input>
|
<my-input ngControl="name"></my-input>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -870,7 +870,7 @@ export function main() {
|
||||||
|
|
||||||
describe("validations", () => {
|
describe("validations", () => {
|
||||||
it("should use sync validators defined in html",
|
it("should use sync validators defined in html",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form = new ControlGroup(
|
var form = new ControlGroup(
|
||||||
{"login": new Control(""), "min": new Control(""), "max": new Control("")});
|
{"login": new Control(""), "min": new Control(""), "max": new Control("")});
|
||||||
|
|
||||||
|
@ -924,7 +924,7 @@ export function main() {
|
||||||
<input type="text" ngControl="login" uniq-login-validator="expected">
|
<input type="text" ngControl="login" uniq-login-validator="expected">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
var rootTC;
|
var rootTC: any /** TODO #9100 */;
|
||||||
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => rootTC = root);
|
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => rootTC = root);
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
|
@ -946,7 +946,7 @@ export function main() {
|
||||||
})));
|
})));
|
||||||
|
|
||||||
it("should use sync validators defined in the model",
|
it("should use sync validators defined in the model",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form = new ControlGroup({"login": new Control("aa", Validators.required)});
|
var form = new ControlGroup({"login": new Control("aa", Validators.required)});
|
||||||
|
|
||||||
var t = `<div [ngFormModel]="form">
|
var t = `<div [ngFormModel]="form">
|
||||||
|
@ -979,7 +979,7 @@ export function main() {
|
||||||
<input type="text" ngControl="login">
|
<input type="text" ngControl="login">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
var fixture;
|
var fixture: any /** TODO #9100 */;
|
||||||
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => fixture = root);
|
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => fixture = root);
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ export function main() {
|
||||||
|
|
||||||
describe("nested forms", () => {
|
describe("nested forms", () => {
|
||||||
it("should init DOM with the given form object",
|
it("should init DOM with the given form object",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form =
|
var form =
|
||||||
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
|
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
|
||||||
|
|
||||||
|
@ -1030,7 +1030,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should update the control group values on DOM change",
|
it("should update the control group values on DOM change",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form =
|
var form =
|
||||||
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
|
new ControlGroup({"nested": new ControlGroup({"login": new Control("value")})});
|
||||||
|
|
||||||
|
@ -1141,7 +1141,7 @@ export function main() {
|
||||||
})));
|
})));
|
||||||
|
|
||||||
it("should not create a template-driven form when ngNoForm is used",
|
it("should not create a template-driven form when ngNoForm is used",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<form ngNoForm>
|
var t = `<form ngNoForm>
|
||||||
</form>`;
|
</form>`;
|
||||||
|
|
||||||
|
@ -1322,7 +1322,7 @@ export function main() {
|
||||||
|
|
||||||
describe("setting status classes", () => {
|
describe("setting status classes", () => {
|
||||||
it("should work with single fields",
|
it("should work with single fields",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form = new Control("", Validators.required);
|
var form = new Control("", Validators.required);
|
||||||
|
|
||||||
var t = `<div><input type="text" [ngFormControl]="form"></div>`;
|
var t = `<div><input type="text" [ngFormControl]="form"></div>`;
|
||||||
|
@ -1353,7 +1353,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should work with complex model-driven forms",
|
it("should work with complex model-driven forms",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var form = new ControlGroup({"name": new Control("", Validators.required)});
|
var form = new ControlGroup({"name": new Control("", Validators.required)});
|
||||||
|
|
||||||
var t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`;
|
var t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`;
|
||||||
|
@ -1384,7 +1384,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should work with ngModel",
|
it("should work with ngModel",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
var t = `<div><input [(ngModel)]="name" required></div>`;
|
var t = `<div><input [(ngModel)]="name" required></div>`;
|
||||||
|
|
||||||
tcb.overrideTemplate(MyComp8, t)
|
tcb.overrideTemplate(MyComp8, t)
|
||||||
|
@ -1486,17 +1486,17 @@ export function main() {
|
||||||
host: {'(input)': 'handleOnInput($event.target.value)', '[value]': 'value'}
|
host: {'(input)': 'handleOnInput($event.target.value)', '[value]': 'value'}
|
||||||
})
|
})
|
||||||
class WrappedValue implements ControlValueAccessor {
|
class WrappedValue implements ControlValueAccessor {
|
||||||
value;
|
value: any /** TODO #9100 */;
|
||||||
onChange: Function;
|
onChange: Function;
|
||||||
|
|
||||||
constructor(cd: NgControl) { cd.valueAccessor = this; }
|
constructor(cd: NgControl) { cd.valueAccessor = this; }
|
||||||
|
|
||||||
writeValue(value) { this.value = `!${value}!`; }
|
writeValue(value: any /** TODO #9100 */) { this.value = `!${value}!`; }
|
||||||
|
|
||||||
registerOnChange(fn) { this.onChange = fn; }
|
registerOnChange(fn: any /** TODO #9100 */) { this.onChange = fn; }
|
||||||
registerOnTouched(fn) {}
|
registerOnTouched(fn: any /** TODO #9100 */) {}
|
||||||
|
|
||||||
handleOnInput(value) { this.onChange(value.substring(1, value.length - 1)); }
|
handleOnInput(value: any /** TODO #9100 */) { this.onChange(value.substring(1, value.length - 1)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({selector: "my-input", template: ''})
|
@Component({selector: "my-input", template: ''})
|
||||||
|
@ -1506,11 +1506,11 @@ class MyInput implements ControlValueAccessor {
|
||||||
|
|
||||||
constructor(cd: NgControl) { cd.valueAccessor = this; }
|
constructor(cd: NgControl) { cd.valueAccessor = this; }
|
||||||
|
|
||||||
writeValue(value) { this.value = `!${value}!`; }
|
writeValue(value: any /** TODO #9100 */) { this.value = `!${value}!`; }
|
||||||
|
|
||||||
registerOnChange(fn) { ObservableWrapper.subscribe(this.onInput, fn); }
|
registerOnChange(fn: any /** TODO #9100 */) { ObservableWrapper.subscribe(this.onInput, fn); }
|
||||||
|
|
||||||
registerOnTouched(fn) {}
|
registerOnTouched(fn: any /** TODO #9100 */) {}
|
||||||
|
|
||||||
dispatchChangeEvent() {
|
dispatchChangeEvent() {
|
||||||
ObservableWrapper.callEmit(this.onInput, this.value.substring(1, this.value.length - 1));
|
ObservableWrapper.callEmit(this.onInput, this.value.substring(1, this.value.length - 1));
|
||||||
|
@ -1518,7 +1518,7 @@ class MyInput implements ControlValueAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
function uniqLoginAsyncValidator(expectedValue: string) {
|
function uniqLoginAsyncValidator(expectedValue: string) {
|
||||||
return (c) => {
|
return (c: any /** TODO #9100 */) => {
|
||||||
var completer = PromiseWrapper.completer();
|
var completer = PromiseWrapper.completer();
|
||||||
var res = (c.value == expectedValue) ? null : {"uniqLogin": true};
|
var res = (c.value == expectedValue) ? null : {"uniqLogin": true};
|
||||||
completer.resolve(res);
|
completer.resolve(res);
|
||||||
|
@ -1550,9 +1550,9 @@ class LoginIsEmptyValidator {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
class UniqLoginValidator implements Validator {
|
class UniqLoginValidator implements Validator {
|
||||||
@Input('uniq-login-validator') expected;
|
@Input('uniq-login-validator') expected: any /** TODO #9100 */;
|
||||||
|
|
||||||
validate(c) { return uniqLoginAsyncValidator(this.expected)(c); }
|
validate(c: any /** TODO #9100 */) { return uniqLoginAsyncValidator(this.expected)(c); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -1577,7 +1577,7 @@ class MyComp8 {
|
||||||
customTrackBy(index: number, obj: any): number { return index; };
|
customTrackBy(index: number, obj: any): number { return index; };
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortedClassList(el) {
|
function sortedClassList(el: any /** TODO #9100 */) {
|
||||||
var l = getDOM().classList(el);
|
var l = getDOM().classList(el);
|
||||||
ListWrapper.sort(l);
|
ListWrapper.sort(l);
|
||||||
return l;
|
return l;
|
||||||
|
|
|
@ -17,10 +17,10 @@ import {PromiseWrapper} from '../../src/facade/promise';
|
||||||
import {TimerWrapper, ObservableWrapper, EventEmitter} from '../../src/facade/async';
|
import {TimerWrapper, ObservableWrapper, EventEmitter} from '../../src/facade/async';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function asyncValidator(expected, timeouts = /*@ts2dart_const*/ {}) {
|
function asyncValidator(expected: any /** TODO #9100 */, timeouts = /*@ts2dart_const*/ {}) {
|
||||||
return (c) => {
|
return (c: any /** TODO #9100 */) => {
|
||||||
var completer = PromiseWrapper.completer();
|
var completer = PromiseWrapper.completer();
|
||||||
var t = isPresent(timeouts[c.value]) ? timeouts[c.value] : 0;
|
var t = isPresent((timeouts as any /** TODO #9100 */)[c.value]) ? (timeouts as any /** TODO #9100 */)[c.value] : 0;
|
||||||
var res = c.value != expected ? {"async": true} : null;
|
var res = c.value != expected ? {"async": true} : null;
|
||||||
|
|
||||||
if (t == 0) {
|
if (t == 0) {
|
||||||
|
@ -33,7 +33,7 @@ export function main() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function asyncValidatorReturningObservable(c) {
|
function asyncValidatorReturningObservable(c: any /** TODO #9100 */) {
|
||||||
var e = new EventEmitter();
|
var e = new EventEmitter();
|
||||||
PromiseWrapper.scheduleMicrotask(() => ObservableWrapper.callEmit(e, {"async": true}));
|
PromiseWrapper.scheduleMicrotask(() => ObservableWrapper.callEmit(e, {"async": true}));
|
||||||
return e;
|
return e;
|
||||||
|
@ -140,7 +140,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("updateValue", () => {
|
describe("updateValue", () => {
|
||||||
var g, c;
|
var g: any /** TODO #9100 */, c: any /** TODO #9100 */;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
c = new Control("oldValue");
|
c = new Control("oldValue");
|
||||||
g = new ControlGroup({"one": c});
|
g = new ControlGroup({"one": c});
|
||||||
|
@ -152,8 +152,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should invoke ngOnChanges if it is present", () => {
|
it("should invoke ngOnChanges if it is present", () => {
|
||||||
var ngOnChanges;
|
var ngOnChanges: any /** TODO #9100 */;
|
||||||
c.registerOnChange((v) => ngOnChanges = ["invoked", v]);
|
c.registerOnChange((v: any /** TODO #9100 */) => ngOnChanges = ["invoked", v]);
|
||||||
|
|
||||||
c.updateValue("newValue");
|
c.updateValue("newValue");
|
||||||
|
|
||||||
|
@ -161,8 +161,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not invoke on change when explicitly specified", () => {
|
it("should not invoke on change when explicitly specified", () => {
|
||||||
var onChange = null;
|
var onChange: any /** TODO #9100 */ = null;
|
||||||
c.registerOnChange((v) => onChange = ["invoked", v]);
|
c.registerOnChange((v: any /** TODO #9100 */) => onChange = ["invoked", v]);
|
||||||
|
|
||||||
c.updateValue("newValue", {emitModelToViewChange: false});
|
c.updateValue("newValue", {emitModelToViewChange: false});
|
||||||
|
|
||||||
|
@ -197,12 +197,12 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("valueChanges & statusChanges", () => {
|
describe("valueChanges & statusChanges", () => {
|
||||||
var c;
|
var c: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => { c = new Control("old", Validators.required); });
|
beforeEach(() => { c = new Control("old", Validators.required); });
|
||||||
|
|
||||||
it("should fire an event after the value has been updated",
|
it("should fire an event after the value has been updated",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
ObservableWrapper.subscribe(c.valueChanges, (value) => {
|
ObservableWrapper.subscribe(c.valueChanges, (value) => {
|
||||||
expect(c.value).toEqual('new');
|
expect(c.value).toEqual('new');
|
||||||
expect(value).toEqual('new');
|
expect(value).toEqual('new');
|
||||||
|
@ -224,7 +224,7 @@ export function main() {
|
||||||
it("should fire an event after the status has been updated to pending", fakeAsync(() => {
|
it("should fire an event after the status has been updated to pending", fakeAsync(() => {
|
||||||
var c = new Control("old", Validators.required, asyncValidator("expected"));
|
var c = new Control("old", Validators.required, asyncValidator("expected"));
|
||||||
|
|
||||||
var log = [];
|
var log: any[] /** TODO #9100 */ = [];
|
||||||
ObservableWrapper.subscribe(c.valueChanges, (value) => log.push(`value: '${value}'`));
|
ObservableWrapper.subscribe(c.valueChanges, (value) => log.push(`value: '${value}'`));
|
||||||
ObservableWrapper.subscribe(c.statusChanges,
|
ObservableWrapper.subscribe(c.statusChanges,
|
||||||
(status) => log.push(`status: '${status}'`));
|
(status) => log.push(`status: '${status}'`));
|
||||||
|
@ -253,8 +253,8 @@ export function main() {
|
||||||
// TODO: remove the if statement after making observable delivery sync
|
// TODO: remove the if statement after making observable delivery sync
|
||||||
if (!IS_DART) {
|
if (!IS_DART) {
|
||||||
it("should update set errors and status before emitting an event",
|
it("should update set errors and status before emitting an event",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
c.valueChanges.subscribe(value => {
|
c.valueChanges.subscribe((value: any /** TODO #9100 */) => {
|
||||||
expect(c.valid).toEqual(false);
|
expect(c.valid).toEqual(false);
|
||||||
expect(c.errors).toEqual({"required": true});
|
expect(c.errors).toEqual({"required": true});
|
||||||
async.done();
|
async.done();
|
||||||
|
@ -263,7 +263,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
it("should return a cold observable", inject([AsyncTestCompleter], (async) => {
|
it("should return a cold observable", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
c.updateValue("will be ignored");
|
c.updateValue("will be ignored");
|
||||||
ObservableWrapper.subscribe(c.valueChanges, (value) => {
|
ObservableWrapper.subscribe(c.valueChanges, (value) => {
|
||||||
expect(value).toEqual('new');
|
expect(value).toEqual('new');
|
||||||
|
@ -380,7 +380,7 @@ export function main() {
|
||||||
|
|
||||||
describe("errors", () => {
|
describe("errors", () => {
|
||||||
it("should run the validator when the value changes", () => {
|
it("should run the validator when the value changes", () => {
|
||||||
var simpleValidator = (c) =>
|
var simpleValidator = (c: any /** TODO #9100 */) =>
|
||||||
c.controls["one"].value != "correct" ? {"broken": true} : null;
|
c.controls["one"].value != "correct" ? {"broken": true} : null;
|
||||||
|
|
||||||
var c = new Control(null);
|
var c = new Control(null);
|
||||||
|
@ -399,7 +399,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("dirty", () => {
|
describe("dirty", () => {
|
||||||
var c, g;
|
var c: any /** TODO #9100 */, g: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
c = new Control('value');
|
c = new Control('value');
|
||||||
|
@ -417,7 +417,7 @@ export function main() {
|
||||||
|
|
||||||
describe("optional components", () => {
|
describe("optional components", () => {
|
||||||
describe("contains", () => {
|
describe("contains", () => {
|
||||||
var group;
|
var group: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
group = new ControlGroup(
|
group = new ControlGroup(
|
||||||
|
@ -473,7 +473,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("valueChanges", () => {
|
describe("valueChanges", () => {
|
||||||
var g, c1, c2;
|
var g: any /** TODO #9100 */, c1: any /** TODO #9100 */, c2: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
c1 = new Control("old1");
|
c1 = new Control("old1");
|
||||||
|
@ -482,7 +482,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should fire an event after the value has been updated",
|
it("should fire an event after the value has been updated",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||||
expect(g.value).toEqual({'one': 'new1', 'two': 'old2'});
|
expect(g.value).toEqual({'one': 'new1', 'two': 'old2'});
|
||||||
expect(value).toEqual({'one': 'new1', 'two': 'old2'});
|
expect(value).toEqual({'one': 'new1', 'two': 'old2'});
|
||||||
|
@ -492,7 +492,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should fire an event after the control's observable fired an event",
|
it("should fire an event after the control's observable fired an event",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var controlCallbackIsCalled = false;
|
var controlCallbackIsCalled = false;
|
||||||
|
|
||||||
ObservableWrapper.subscribe(c1.valueChanges,
|
ObservableWrapper.subscribe(c1.valueChanges,
|
||||||
|
@ -507,7 +507,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should fire an event when a control is excluded",
|
it("should fire an event when a control is excluded",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||||
expect(value).toEqual({'one': 'old1'});
|
expect(value).toEqual({'one': 'old1'});
|
||||||
async.done();
|
async.done();
|
||||||
|
@ -517,7 +517,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should fire an event when a control is included",
|
it("should fire an event when a control is included",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
g.exclude("two");
|
g.exclude("two");
|
||||||
|
|
||||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||||
|
@ -529,8 +529,8 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should fire an event every time a control is updated",
|
it("should fire an event every time a control is updated",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var loggedValues = [];
|
var loggedValues: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||||
loggedValues.push(value);
|
loggedValues.push(value);
|
||||||
|
@ -547,7 +547,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
xit("should not fire an event when an excluded control is updated",
|
xit("should not fire an event when an excluded control is updated",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
// hard to test without hacking zones
|
// hard to test without hacking zones
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -609,7 +609,7 @@ export function main() {
|
||||||
describe("ControlArray", () => {
|
describe("ControlArray", () => {
|
||||||
describe("adding/removing", () => {
|
describe("adding/removing", () => {
|
||||||
var a: ControlArray;
|
var a: ControlArray;
|
||||||
var c1, c2, c3;
|
var c1: any /** TODO #9100 */, c2: any /** TODO #9100 */, c3: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
a = new ControlArray([]);
|
a = new ControlArray([]);
|
||||||
|
@ -658,7 +658,7 @@ export function main() {
|
||||||
|
|
||||||
describe("errors", () => {
|
describe("errors", () => {
|
||||||
it("should run the validator when the value changes", () => {
|
it("should run the validator when the value changes", () => {
|
||||||
var simpleValidator = (c) => c.controls[0].value != "correct" ? {"broken": true} : null;
|
var simpleValidator = (c: any /** TODO #9100 */) => c.controls[0].value != "correct" ? {"broken": true} : null;
|
||||||
|
|
||||||
var c = new Control(null);
|
var c = new Control(null);
|
||||||
var g = new ControlArray([c], simpleValidator);
|
var g = new ControlArray([c], simpleValidator);
|
||||||
|
@ -725,7 +725,7 @@ export function main() {
|
||||||
|
|
||||||
describe("valueChanges", () => {
|
describe("valueChanges", () => {
|
||||||
var a: ControlArray;
|
var a: ControlArray;
|
||||||
var c1, c2;
|
var c1: any /** TODO #9100 */, c2: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
c1 = new Control("old1");
|
c1 = new Control("old1");
|
||||||
|
@ -734,7 +734,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should fire an event after the value has been updated",
|
it("should fire an event after the value has been updated",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
||||||
expect(a.value).toEqual(['new1', 'old2']);
|
expect(a.value).toEqual(['new1', 'old2']);
|
||||||
expect(value).toEqual(['new1', 'old2']);
|
expect(value).toEqual(['new1', 'old2']);
|
||||||
|
@ -744,7 +744,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should fire an event after the control's observable fired an event",
|
it("should fire an event after the control's observable fired an event",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var controlCallbackIsCalled = false;
|
var controlCallbackIsCalled = false;
|
||||||
|
|
||||||
ObservableWrapper.subscribe(c1.valueChanges,
|
ObservableWrapper.subscribe(c1.valueChanges,
|
||||||
|
@ -759,7 +759,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should fire an event when a control is removed",
|
it("should fire an event when a control is removed",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
||||||
expect(value).toEqual(['old1']);
|
expect(value).toEqual(['old1']);
|
||||||
async.done();
|
async.done();
|
||||||
|
@ -768,7 +768,7 @@ export function main() {
|
||||||
a.removeAt(1);
|
a.removeAt(1);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should fire an event when a control is added", inject([AsyncTestCompleter], (async) => {
|
it("should fire an event when a control is added", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
a.removeAt(1);
|
a.removeAt(1);
|
||||||
|
|
||||||
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
ObservableWrapper.subscribe(a.valueChanges, (value) => {
|
||||||
|
|
|
@ -17,7 +17,7 @@ export function main() {
|
||||||
function validator(key: string, error: any) {
|
function validator(key: string, error: any) {
|
||||||
return function(c: AbstractControl) {
|
return function(c: AbstractControl) {
|
||||||
var r = {};
|
var r = {};
|
||||||
r[key] = error;
|
(r as any /** TODO #9100 */)[key] = error;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,8 +111,8 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("composeAsync", () => {
|
describe("composeAsync", () => {
|
||||||
function asyncValidator(expected, response) {
|
function asyncValidator(expected: any /** TODO #9100 */, response: any /** TODO #9100 */) {
|
||||||
return (c) => {
|
return (c: any /** TODO #9100 */) => {
|
||||||
var emitter = new EventEmitter();
|
var emitter = new EventEmitter();
|
||||||
var res = c.value != expected ? response : null;
|
var res = c.value != expected ? response : null;
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ export function main() {
|
||||||
asyncValidator("expected", {"two": true})
|
asyncValidator("expected", {"two": true})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var value = null;
|
var value: any /** TODO #9100 */ = null;
|
||||||
(<Promise<any>>c(new Control("invalid"))).then(v => value = v);
|
(<Promise<any>>c(new Control("invalid"))).then(v => value = v);
|
||||||
|
|
||||||
tick(1);
|
tick(1);
|
||||||
|
@ -147,7 +147,7 @@ export function main() {
|
||||||
it("should return null when no errors", fakeAsync(() => {
|
it("should return null when no errors", fakeAsync(() => {
|
||||||
var c = Validators.composeAsync([asyncValidator("expected", {"one": true})]);
|
var c = Validators.composeAsync([asyncValidator("expected", {"one": true})]);
|
||||||
|
|
||||||
var value = null;
|
var value: any /** TODO #9100 */ = null;
|
||||||
(<Promise<any>>c(new Control("expected"))).then(v => value = v);
|
(<Promise<any>>c(new Control("expected"))).then(v => value = v);
|
||||||
|
|
||||||
tick(1);
|
tick(1);
|
||||||
|
@ -158,7 +158,7 @@ export function main() {
|
||||||
it("should ignore nulls", fakeAsync(() => {
|
it("should ignore nulls", fakeAsync(() => {
|
||||||
var c = Validators.composeAsync([asyncValidator("expected", {"one": true}), null]);
|
var c = Validators.composeAsync([asyncValidator("expected", {"one": true}), null]);
|
||||||
|
|
||||||
var value = null;
|
var value: any /** TODO #9100 */ = null;
|
||||||
(<Promise<any>>c(new Control("invalid"))).then(v => value = v);
|
(<Promise<any>>c(new Control("invalid"))).then(v => value = v);
|
||||||
|
|
||||||
tick(1);
|
tick(1);
|
||||||
|
|
|
@ -28,9 +28,9 @@ export function main() {
|
||||||
describe("AsyncPipe", () => {
|
describe("AsyncPipe", () => {
|
||||||
|
|
||||||
describe('Observable', () => {
|
describe('Observable', () => {
|
||||||
var emitter;
|
var emitter: any /** TODO #9100 */;
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
var ref;
|
var ref: any /** TODO #9100 */;
|
||||||
var message = new Object();
|
var message = new Object();
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -44,7 +44,7 @@ export function main() {
|
||||||
() => { expect(pipe.transform(emitter)).toBe(null); });
|
() => { expect(pipe.transform(emitter)).toBe(null); });
|
||||||
|
|
||||||
it("should return the latest available value wrapped",
|
it("should return the latest available value wrapped",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(emitter);
|
pipe.transform(emitter);
|
||||||
|
|
||||||
ObservableWrapper.callEmit(emitter, message);
|
ObservableWrapper.callEmit(emitter, message);
|
||||||
|
@ -57,7 +57,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
it("should return same value when nothing has changed since the last call",
|
it("should return same value when nothing has changed since the last call",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(emitter);
|
pipe.transform(emitter);
|
||||||
ObservableWrapper.callEmit(emitter, message);
|
ObservableWrapper.callEmit(emitter, message);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should dispose of the existing subscription when subscribing to a new observable",
|
it("should dispose of the existing subscription when subscribing to a new observable",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(emitter);
|
pipe.transform(emitter);
|
||||||
|
|
||||||
var newEmitter = new EventEmitter();
|
var newEmitter = new EventEmitter();
|
||||||
|
@ -85,7 +85,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should request a change detection check upon receiving a new value",
|
it("should request a change detection check upon receiving a new value",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(emitter);
|
pipe.transform(emitter);
|
||||||
ObservableWrapper.callEmit(emitter, message);
|
ObservableWrapper.callEmit(emitter, message);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ export function main() {
|
||||||
it("should do nothing when no subscription",
|
it("should do nothing when no subscription",
|
||||||
() => { expect(() => pipe.ngOnDestroy()).not.toThrow(); });
|
() => { expect(() => pipe.ngOnDestroy()).not.toThrow(); });
|
||||||
|
|
||||||
it("should dispose of the existing subscription", inject([AsyncTestCompleter], (async) => {
|
it("should dispose of the existing subscription", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(emitter);
|
pipe.transform(emitter);
|
||||||
pipe.ngOnDestroy();
|
pipe.ngOnDestroy();
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ export function main() {
|
||||||
it("should return null when subscribing to a promise",
|
it("should return null when subscribing to a promise",
|
||||||
() => { expect(pipe.transform(completer.promise)).toBe(null); });
|
() => { expect(pipe.transform(completer.promise)).toBe(null); });
|
||||||
|
|
||||||
it("should return the latest available value", inject([AsyncTestCompleter], (async) => {
|
it("should return the latest available value", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(completer.promise);
|
pipe.transform(completer.promise);
|
||||||
|
|
||||||
completer.resolve(message);
|
completer.resolve(message);
|
||||||
|
@ -144,7 +144,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should return unwrapped value when nothing has changed since the last call",
|
it("should return unwrapped value when nothing has changed since the last call",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(completer.promise);
|
pipe.transform(completer.promise);
|
||||||
completer.resolve(message);
|
completer.resolve(message);
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should dispose of the existing subscription when subscribing to a new promise",
|
it("should dispose of the existing subscription when subscribing to a new promise",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(completer.promise);
|
pipe.transform(completer.promise);
|
||||||
|
|
||||||
var newCompleter = PromiseWrapper.completer();
|
var newCompleter = PromiseWrapper.completer();
|
||||||
|
@ -172,7 +172,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should request a change detection check upon receiving a new value",
|
it("should request a change detection check upon receiving a new value",
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var markForCheck = ref.spy('markForCheck');
|
var markForCheck = ref.spy('markForCheck');
|
||||||
pipe.transform(completer.promise);
|
pipe.transform(completer.promise);
|
||||||
completer.resolve(message);
|
completer.resolve(message);
|
||||||
|
@ -187,7 +187,7 @@ export function main() {
|
||||||
it("should do nothing when no source",
|
it("should do nothing when no source",
|
||||||
() => { expect(() => pipe.ngOnDestroy()).not.toThrow(); });
|
() => { expect(() => pipe.ngOnDestroy()).not.toThrow(); });
|
||||||
|
|
||||||
it("should dispose of the existing source", inject([AsyncTestCompleter], (async) => {
|
it("should dispose of the existing source", inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
pipe.transform(completer.promise);
|
pipe.transform(completer.promise);
|
||||||
expect(pipe.transform(completer.promise)).toBe(null);
|
expect(pipe.transform(completer.promise)).toBe(null);
|
||||||
completer.resolve(message)
|
completer.resolve(message)
|
||||||
|
|
|
@ -16,8 +16,8 @@ import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("DatePipe", () => {
|
describe("DatePipe", () => {
|
||||||
var date;
|
var date: any /** TODO #9100 */;
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
date = DateWrapper.create(2015, 6, 15, 21, 43, 11);
|
date = DateWrapper.create(2015, 6, 15, 21, 43, 11);
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("I18nPluralPipe", () => {
|
describe("I18nPluralPipe", () => {
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
var mapping = {'=0': 'No messages.', '=1': 'One message.', 'other': 'There are some messages.'};
|
var mapping = {'=0': 'No messages.', '=1': 'One message.', 'other': 'There are some messages.'};
|
||||||
var interpolatedMapping =
|
var interpolatedMapping =
|
||||||
{'=0': 'No messages.', '=1': 'One message.', 'other': 'There are # messages, that is #.'};
|
{'=0': 'No messages.', '=1': 'One message.', 'other': 'There are # messages, that is #.'};
|
||||||
|
@ -46,7 +46,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should use 'other' if value is undefined", () => {
|
it("should use 'other' if value is undefined", () => {
|
||||||
var messageLength;
|
var messageLength: any /** TODO #9100 */;
|
||||||
var val = pipe.transform(messageLength, interpolatedMapping);
|
var val = pipe.transform(messageLength, interpolatedMapping);
|
||||||
expect(val).toEqual('There are messages, that is .');
|
expect(val).toEqual('There are messages, that is .');
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {PipeResolver} from '@angular/compiler/src/pipe_resolver';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("I18nSelectPipe", () => {
|
describe("I18nSelectPipe", () => {
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
var mapping = {'male': 'Invite him.', 'female': 'Invite her.', 'other': 'Invite them.'};
|
var mapping = {'male': 'Invite him.', 'female': 'Invite her.', 'other': 'Invite them.'};
|
||||||
|
|
||||||
beforeEach(() => { pipe = new I18nSelectPipe(); });
|
beforeEach(() => { pipe = new I18nSelectPipe(); });
|
||||||
|
@ -39,7 +39,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should use 'other' if value is undefined", () => {
|
it("should use 'other' if value is undefined", () => {
|
||||||
var gender;
|
var gender: any /** TODO #9100 */;
|
||||||
var val = pipe.transform(gender, mapping);
|
var val = pipe.transform(gender, mapping);
|
||||||
expect(val).toEqual('Invite them.');
|
expect(val).toEqual('Invite them.');
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,9 +19,9 @@ import {JsonPipe} from '@angular/common';
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("JsonPipe", () => {
|
describe("JsonPipe", () => {
|
||||||
var regNewLine = '\n';
|
var regNewLine = '\n';
|
||||||
var inceptionObj;
|
var inceptionObj: any /** TODO #9100 */;
|
||||||
var inceptionObjString;
|
var inceptionObjString: any /** TODO #9100 */;
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); }
|
function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); }
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ export function main() {
|
||||||
|
|
||||||
describe('integration', () => {
|
describe('integration', () => {
|
||||||
it('should work with mutable objects',
|
it('should work with mutable objects',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.createAsync(TestComp).then((fixture) => {
|
tcb.createAsync(TestComp).then((fixture) => {
|
||||||
let mutable: number[] = [1];
|
let mutable: number[] = [1];
|
||||||
fixture.debugElement.componentInstance.data = mutable;
|
fixture.debugElement.componentInstance.data = mutable;
|
||||||
|
|
|
@ -13,9 +13,9 @@ import {LowerCasePipe} from '@angular/common';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("LowerCasePipe", () => {
|
describe("LowerCasePipe", () => {
|
||||||
var upper;
|
var upper: any /** TODO #9100 */;
|
||||||
var lower;
|
var lower: any /** TODO #9100 */;
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
lower = 'something';
|
lower = 'something';
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function main() {
|
||||||
// https://github.com/angular/angular/issues/3333
|
// https://github.com/angular/angular/issues/3333
|
||||||
if (browserDetection.supportsIntlApi) {
|
if (browserDetection.supportsIntlApi) {
|
||||||
describe("DecimalPipe", () => {
|
describe("DecimalPipe", () => {
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => { pipe = new DecimalPipe(); });
|
beforeEach(() => { pipe = new DecimalPipe(); });
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("PercentPipe", () => {
|
describe("PercentPipe", () => {
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => { pipe = new PercentPipe(); });
|
beforeEach(() => { pipe = new PercentPipe(); });
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("CurrencyPipe", () => {
|
describe("CurrencyPipe", () => {
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => { pipe = new CurrencyPipe(); });
|
beforeEach(() => { pipe = new CurrencyPipe(); });
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ import {RegExpWrapper, StringJoiner} from '../../src/facade/lang';
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("ReplacePipe", () => {
|
describe("ReplacePipe", () => {
|
||||||
var someNumber: number;
|
var someNumber: number;
|
||||||
var str;
|
var str: any /** TODO #9100 */;
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
someNumber = 42;
|
someNumber = 42;
|
||||||
|
@ -52,7 +52,7 @@ export function main() {
|
||||||
|
|
||||||
var result3 = pipe.transform(str, RegExpWrapper.create("a", "i"), "_");
|
var result3 = pipe.transform(str, RegExpWrapper.create("a", "i"), "_");
|
||||||
|
|
||||||
var f = (x => { return "Adams!"; });
|
var f = ((x: any /** TODO #9100 */) => { return "Adams!"; });
|
||||||
|
|
||||||
var result4 = pipe.transform(str, "Adams", f);
|
var result4 = pipe.transform(str, "Adams", f);
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ import {SlicePipe} from '@angular/common';
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("SlicePipe", () => {
|
describe("SlicePipe", () => {
|
||||||
var list: number[];
|
var list: number[];
|
||||||
var str;
|
var str: any /** TODO #9100 */;
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
list = [1, 2, 3, 4, 5];
|
list = [1, 2, 3, 4, 5];
|
||||||
|
@ -95,7 +95,7 @@ export function main() {
|
||||||
|
|
||||||
describe('integration', () => {
|
describe('integration', () => {
|
||||||
it('should work with mutable arrays',
|
it('should work with mutable arrays',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
tcb.createAsync(TestComp).then((fixture) => {
|
tcb.createAsync(TestComp).then((fixture) => {
|
||||||
let mutable: number[] = [1, 2];
|
let mutable: number[] = [1, 2];
|
||||||
fixture.debugElement.componentInstance.data = mutable;
|
fixture.debugElement.componentInstance.data = mutable;
|
||||||
|
|
|
@ -12,9 +12,9 @@ import {UpperCasePipe} from '@angular/common';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("UpperCasePipe", () => {
|
describe("UpperCasePipe", () => {
|
||||||
var upper;
|
var upper: any /** TODO #9100 */;
|
||||||
var lower;
|
var lower: any /** TODO #9100 */;
|
||||||
var pipe;
|
var pipe: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
lower = 'something';
|
lower = 'something';
|
||||||
|
|
|
@ -88,7 +88,7 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||||
|
|
||||||
visitAnimationStyles(ast: AnimationStylesAst,
|
visitAnimationStyles(ast: AnimationStylesAst,
|
||||||
context: _AnimationBuilderContext): o.Expression {
|
context: _AnimationBuilderContext): o.Expression {
|
||||||
var stylesArr = [];
|
var stylesArr: any[] /** TODO #9100 */ = [];
|
||||||
if (context.isExpectingFirstStyleStep) {
|
if (context.isExpectingFirstStyleStep) {
|
||||||
stylesArr.push(_ANIMATION_START_STATE_STYLES_VAR);
|
stylesArr.push(_ANIMATION_START_STATE_STYLES_VAR);
|
||||||
context.isExpectingFirstStyleStep = false;
|
context.isExpectingFirstStyleStep = false;
|
||||||
|
@ -139,7 +139,7 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_callAnimateMethod(ast: AnimationStepAst, startingStylesExpr, keyframesExpr) {
|
_callAnimateMethod(ast: AnimationStepAst, startingStylesExpr: any /** TODO #9100 */, keyframesExpr: any /** TODO #9100 */) {
|
||||||
return _ANIMATION_FACTORY_RENDERER_VAR.callMethod('animate', [
|
return _ANIMATION_FACTORY_RENDERER_VAR.callMethod('animate', [
|
||||||
_ANIMATION_FACTORY_ELEMENT_VAR,
|
_ANIMATION_FACTORY_ELEMENT_VAR,
|
||||||
startingStylesExpr,
|
startingStylesExpr,
|
||||||
|
@ -165,8 +165,8 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||||
|
|
||||||
visitAnimationStateDeclaration(ast: AnimationStateDeclarationAst, context: _AnimationBuilderContext): void {
|
visitAnimationStateDeclaration(ast: AnimationStateDeclarationAst, context: _AnimationBuilderContext): void {
|
||||||
var flatStyles: {[key: string]: string|number} = {};
|
var flatStyles: {[key: string]: string|number} = {};
|
||||||
_getStylesArray(ast).forEach(entry => {
|
_getStylesArray(ast).forEach((entry: any /** TODO #9100 */) => {
|
||||||
StringMapWrapper.forEach(entry, (value, key) => {
|
StringMapWrapper.forEach(entry, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => {
|
||||||
flatStyles[key] = value;
|
flatStyles[key] = value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -182,7 +182,7 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||||
|
|
||||||
context.isExpectingFirstStyleStep = true;
|
context.isExpectingFirstStyleStep = true;
|
||||||
|
|
||||||
var stateChangePreconditions = [];
|
var stateChangePreconditions: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
ast.stateChanges.forEach(stateChange => {
|
ast.stateChanges.forEach(stateChange => {
|
||||||
stateChangePreconditions.push(
|
stateChangePreconditions.push(
|
||||||
|
@ -216,7 +216,7 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||||
//this should always be defined even if the user overrides it
|
//this should always be defined even if the user overrides it
|
||||||
context.stateMap.registerState(DEFAULT_STATE, {});
|
context.stateMap.registerState(DEFAULT_STATE, {});
|
||||||
|
|
||||||
var statements = [];
|
var statements: any[] /** TODO #9100 */ = [];
|
||||||
statements.push(
|
statements.push(
|
||||||
_ANIMATION_FACTORY_VIEW_VAR.callMethod('cancelActiveAnimation', [
|
_ANIMATION_FACTORY_VIEW_VAR.callMethod('cancelActiveAnimation', [
|
||||||
_ANIMATION_FACTORY_ELEMENT_VAR,
|
_ANIMATION_FACTORY_ELEMENT_VAR,
|
||||||
|
@ -313,12 +313,12 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||||
var fnStatement = ast.visit(this, context).toDeclStmt(this._fnVarName);
|
var fnStatement = ast.visit(this, context).toDeclStmt(this._fnVarName);
|
||||||
var fnVariable = o.variable(this._fnVarName);
|
var fnVariable = o.variable(this._fnVarName);
|
||||||
|
|
||||||
var lookupMap = [];
|
var lookupMap: any[] /** TODO #9100 */ = [];
|
||||||
StringMapWrapper.forEach(context.stateMap.states, (value, stateName) => {
|
StringMapWrapper.forEach(context.stateMap.states, (value: any /** TODO #9100 */, stateName: any /** TODO #9100 */) => {
|
||||||
var variableValue = EMPTY_MAP;
|
var variableValue = EMPTY_MAP;
|
||||||
if (isPresent(value)) {
|
if (isPresent(value)) {
|
||||||
let styleMap = [];
|
let styleMap: any[] /** TODO #9100 */ = [];
|
||||||
StringMapWrapper.forEach(value, (value, key) => {
|
StringMapWrapper.forEach(value, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => {
|
||||||
styleMap.push([key, o.literal(value)]);
|
styleMap.push([key, o.literal(value)]);
|
||||||
});
|
});
|
||||||
variableValue = o.literalMap(styleMap);
|
variableValue = o.literalMap(styleMap);
|
||||||
|
|
|
@ -46,7 +46,7 @@ const _TERMINAL_KEYFRAME = 1;
|
||||||
const _ONE_SECOND = 1000;
|
const _ONE_SECOND = 1000;
|
||||||
|
|
||||||
export class AnimationParseError extends ParseError {
|
export class AnimationParseError extends ParseError {
|
||||||
constructor(message) { super(null, message); }
|
constructor(message: any /** TODO #9100 */) { super(null, message); }
|
||||||
toString(): string { return `${this.msg}`; }
|
toString(): string { return `${this.msg}`; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ export function parseAnimationEntry(entry: CompileAnimationEntryMetadata): Parse
|
||||||
var stateStyles: {[key: string]: AnimationStylesAst} = {};
|
var stateStyles: {[key: string]: AnimationStylesAst} = {};
|
||||||
var transitions: CompileAnimationStateTransitionMetadata[] = [];
|
var transitions: CompileAnimationStateTransitionMetadata[] = [];
|
||||||
|
|
||||||
var stateDeclarationAsts = [];
|
var stateDeclarationAsts: any[] /** TODO #9100 */ = [];
|
||||||
entry.definitions.forEach(def => {
|
entry.definitions.forEach(def => {
|
||||||
if (def instanceof CompileAnimationStateDeclarationMetadata) {
|
if (def instanceof CompileAnimationStateDeclarationMetadata) {
|
||||||
_parseAnimationDeclarationStates(def, errors).forEach(ast => {
|
_parseAnimationDeclarationStates(def, errors).forEach(ast => {
|
||||||
|
@ -98,7 +98,7 @@ function _parseAnimationStateTransition(transitionStateMetadata: CompileAnimatio
|
||||||
stateStyles: {[key: string]: AnimationStylesAst},
|
stateStyles: {[key: string]: AnimationStylesAst},
|
||||||
errors: AnimationParseError[]): AnimationStateTransitionAst {
|
errors: AnimationParseError[]): AnimationStateTransitionAst {
|
||||||
var styles = new StylesCollection();
|
var styles = new StylesCollection();
|
||||||
var transitionExprs = [];
|
var transitionExprs: any[] /** TODO #9100 */ = [];
|
||||||
var transitionStates = transitionStateMetadata.stateChangeExpr.split(/\s*,\s*/);
|
var transitionStates = transitionStateMetadata.stateChangeExpr.split(/\s*,\s*/);
|
||||||
transitionStates.forEach(expr => {
|
transitionStates.forEach(expr => {
|
||||||
_parseAnimationTransitionExpr(expr, errors).forEach(transExpr => {
|
_parseAnimationTransitionExpr(expr, errors).forEach(transExpr => {
|
||||||
|
@ -120,7 +120,7 @@ function _parseAnimationStateTransition(transitionStateMetadata: CompileAnimatio
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseAnimationTransitionExpr(eventStr: string, errors: AnimationParseError[]): AnimationStateTransitionExpression[] {
|
function _parseAnimationTransitionExpr(eventStr: string, errors: AnimationParseError[]): AnimationStateTransitionExpression[] {
|
||||||
var expressions = [];
|
var expressions: any[] /** TODO #9100 */ = [];
|
||||||
var match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);
|
var match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);
|
||||||
if (!isPresent(match) || match.length < 4) {
|
if (!isPresent(match) || match.length < 4) {
|
||||||
errors.push(new AnimationParseError(`the provided ${eventStr} is not of a supported format`));
|
errors.push(new AnimationParseError(`the provided ${eventStr} is not of a supported format`));
|
||||||
|
@ -161,7 +161,7 @@ function _normalizeAnimationEntry(entry: CompileAnimationMetadata | CompileAnima
|
||||||
function _normalizeStyleMetadata(entry: CompileAnimationStyleMetadata,
|
function _normalizeStyleMetadata(entry: CompileAnimationStyleMetadata,
|
||||||
stateStyles: {[key: string]: AnimationStylesAst},
|
stateStyles: {[key: string]: AnimationStylesAst},
|
||||||
errors: AnimationParseError[]): Array<{[key: string]: string|number}> {
|
errors: AnimationParseError[]): Array<{[key: string]: string|number}> {
|
||||||
var normalizedStyles = [];
|
var normalizedStyles: any[] /** TODO #9100 */ = [];
|
||||||
entry.styles.forEach(styleEntry => {
|
entry.styles.forEach(styleEntry => {
|
||||||
if (isString(styleEntry)) {
|
if (isString(styleEntry)) {
|
||||||
ListWrapper.addAll(normalizedStyles, _resolveStylesFromState(<string>styleEntry, stateStyles, errors));
|
ListWrapper.addAll(normalizedStyles, _resolveStylesFromState(<string>styleEntry, stateStyles, errors));
|
||||||
|
@ -299,7 +299,7 @@ function _parseAnimationKeyframes(keyframeSequence: CompileAnimationKeyframesSeq
|
||||||
|
|
||||||
var limit = totalEntries - 1;
|
var limit = totalEntries - 1;
|
||||||
var margin = totalOffsets == 0 ? (1 / limit) : 0;
|
var margin = totalOffsets == 0 ? (1 / limit) : 0;
|
||||||
var rawKeyframes = [];
|
var rawKeyframes: any[] /** TODO #9100 */ = [];
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var doSortKeyframes = false;
|
var doSortKeyframes = false;
|
||||||
var lastOffset = 0;
|
var lastOffset = 0;
|
||||||
|
@ -307,7 +307,7 @@ function _parseAnimationKeyframes(keyframeSequence: CompileAnimationKeyframesSeq
|
||||||
var offset = styleMetadata.offset;
|
var offset = styleMetadata.offset;
|
||||||
var keyframeStyles: {[key: string]: string|number} = {};
|
var keyframeStyles: {[key: string]: string|number} = {};
|
||||||
styleMetadata.styles.forEach(entry => {
|
styleMetadata.styles.forEach(entry => {
|
||||||
StringMapWrapper.forEach(<{[key: string]: string|number}>entry, (value, prop) => {
|
StringMapWrapper.forEach(<{[key: string]: string|number}>entry, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||||
if (prop != 'offset') {
|
if (prop != 'offset') {
|
||||||
keyframeStyles[prop] = value;
|
keyframeStyles[prop] = value;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ function _parseAnimationKeyframes(keyframeSequence: CompileAnimationKeyframesSeq
|
||||||
ListWrapper.sort(rawKeyframes, (a,b) => a[0] <= b[0] ? -1 : 1);
|
ListWrapper.sort(rawKeyframes, (a,b) => a[0] <= b[0] ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var i;
|
var i: any /** TODO #9100 */;
|
||||||
var firstKeyframe = rawKeyframes[0];
|
var firstKeyframe = rawKeyframes[0];
|
||||||
if (firstKeyframe[0] != _INITIAL_KEYFRAME) {
|
if (firstKeyframe[0] != _INITIAL_KEYFRAME) {
|
||||||
ListWrapper.insert(rawKeyframes, 0, firstKeyframe = [_INITIAL_KEYFRAME, {}]);
|
ListWrapper.insert(rawKeyframes, 0, firstKeyframe = [_INITIAL_KEYFRAME, {}]);
|
||||||
|
@ -348,7 +348,7 @@ function _parseAnimationKeyframes(keyframeSequence: CompileAnimationKeyframesSeq
|
||||||
let entry = rawKeyframes[i];
|
let entry = rawKeyframes[i];
|
||||||
let styles = entry[1];
|
let styles = entry[1];
|
||||||
|
|
||||||
StringMapWrapper.forEach(styles, (value, prop) => {
|
StringMapWrapper.forEach(styles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||||
if (!isPresent(firstKeyframeStyles[prop])) {
|
if (!isPresent(firstKeyframeStyles[prop])) {
|
||||||
firstKeyframeStyles[prop] = FILL_STYLE_FLAG;
|
firstKeyframeStyles[prop] = FILL_STYLE_FLAG;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ function _parseAnimationKeyframes(keyframeSequence: CompileAnimationKeyframesSeq
|
||||||
let entry = rawKeyframes[i];
|
let entry = rawKeyframes[i];
|
||||||
let styles = entry[1];
|
let styles = entry[1];
|
||||||
|
|
||||||
StringMapWrapper.forEach(styles, (value, prop) => {
|
StringMapWrapper.forEach(styles, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||||
if (!isPresent(lastKeyframeStyles[prop])) {
|
if (!isPresent(lastKeyframeStyles[prop])) {
|
||||||
lastKeyframeStyles[prop] = value;
|
lastKeyframeStyles[prop] = value;
|
||||||
}
|
}
|
||||||
|
@ -374,14 +374,14 @@ function _parseTransitionAnimation(entry: CompileAnimationMetadata,
|
||||||
collectedStyles: StylesCollection,
|
collectedStyles: StylesCollection,
|
||||||
stateStyles: {[key: string]: AnimationStylesAst},
|
stateStyles: {[key: string]: AnimationStylesAst},
|
||||||
errors: AnimationParseError[]): AnimationAst {
|
errors: AnimationParseError[]): AnimationAst {
|
||||||
var ast;
|
var ast: any /** TODO #9100 */;
|
||||||
var playTime = 0;
|
var playTime = 0;
|
||||||
var startingTime = currentTime;
|
var startingTime = currentTime;
|
||||||
if (entry instanceof CompileAnimationWithStepsMetadata) {
|
if (entry instanceof CompileAnimationWithStepsMetadata) {
|
||||||
var maxDuration = 0;
|
var maxDuration = 0;
|
||||||
var steps = [];
|
var steps: any[] /** TODO #9100 */ = [];
|
||||||
var isGroup = entry instanceof CompileAnimationGroupMetadata;
|
var isGroup = entry instanceof CompileAnimationGroupMetadata;
|
||||||
var previousStyles;
|
var previousStyles: any /** TODO #9100 */;
|
||||||
entry.steps.forEach(entry => {
|
entry.steps.forEach(entry => {
|
||||||
// these will get picked up by the next step...
|
// these will get picked up by the next step...
|
||||||
var time = isGroup ? startingTime : currentTime;
|
var time = isGroup ? startingTime : currentTime;
|
||||||
|
@ -389,7 +389,7 @@ function _parseTransitionAnimation(entry: CompileAnimationMetadata,
|
||||||
entry.styles.forEach(stylesEntry => {
|
entry.styles.forEach(stylesEntry => {
|
||||||
// by this point we know that we only have stringmap values
|
// by this point we know that we only have stringmap values
|
||||||
var map = <{[key: string]: string|number}>stylesEntry;
|
var map = <{[key: string]: string|number}>stylesEntry;
|
||||||
StringMapWrapper.forEach(map, (value, prop) => {
|
StringMapWrapper.forEach(map, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||||
collectedStyles.insertAtTime(prop, time, value);
|
collectedStyles.insertAtTime(prop, time, value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -430,7 +430,7 @@ function _parseTransitionAnimation(entry: CompileAnimationMetadata,
|
||||||
var timings = _parseTimeExpression(entry.timings, errors);
|
var timings = _parseTimeExpression(entry.timings, errors);
|
||||||
var styles = entry.styles;
|
var styles = entry.styles;
|
||||||
|
|
||||||
var keyframes;
|
var keyframes: any /** TODO #9100 */;
|
||||||
if (styles instanceof CompileAnimationKeyframesSequenceMetadata) {
|
if (styles instanceof CompileAnimationKeyframesSequenceMetadata) {
|
||||||
keyframes = _parseAnimationKeyframes(styles, currentTime, collectedStyles, stateStyles, errors);
|
keyframes = _parseAnimationKeyframes(styles, currentTime, collectedStyles, stateStyles, errors);
|
||||||
} else {
|
} else {
|
||||||
|
@ -445,9 +445,9 @@ function _parseTransitionAnimation(entry: CompileAnimationMetadata,
|
||||||
playTime = timings.duration + timings.delay;
|
playTime = timings.duration + timings.delay;
|
||||||
currentTime += playTime;
|
currentTime += playTime;
|
||||||
|
|
||||||
keyframes.forEach(keyframe =>
|
keyframes.forEach((keyframe: any /** TODO #9100 */) =>
|
||||||
keyframe.styles.styles.forEach(entry =>
|
keyframe.styles.styles.forEach((entry: any /** TODO #9100 */) =>
|
||||||
StringMapWrapper.forEach(entry, (value, prop) =>
|
StringMapWrapper.forEach(entry, (value: any /** TODO #9100 */, prop: any /** TODO #9100 */) =>
|
||||||
collectedStyles.insertAtTime(prop, currentTime, value))
|
collectedStyles.insertAtTime(prop, currentTime, value))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -526,11 +526,11 @@ function _createStartKeyframeFromEndKeyframe(endKeyframe: AnimationKeyframeAst,
|
||||||
var values: {[key: string]: string | number} = {};
|
var values: {[key: string]: string | number} = {};
|
||||||
var endTime = startTime + duration;
|
var endTime = startTime + duration;
|
||||||
endKeyframe.styles.styles.forEach((styleData: {[key: string]: string|number}) => {
|
endKeyframe.styles.styles.forEach((styleData: {[key: string]: string|number}) => {
|
||||||
StringMapWrapper.forEach(styleData, (val, prop) => {
|
StringMapWrapper.forEach(styleData, (val: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||||
if (prop == 'offset') return;
|
if (prop == 'offset') return;
|
||||||
|
|
||||||
var resultIndex = collectedStyles.indexOfAtOrBeforeTime(prop, startTime);
|
var resultIndex = collectedStyles.indexOfAtOrBeforeTime(prop, startTime);
|
||||||
var resultEntry, nextEntry, value;
|
var resultEntry: any /** TODO #9100 */, nextEntry: any /** TODO #9100 */, value: any /** TODO #9100 */;
|
||||||
if (isPresent(resultIndex)) {
|
if (isPresent(resultIndex)) {
|
||||||
resultEntry = collectedStyles.getByIndex(prop, resultIndex);
|
resultEntry = collectedStyles.getByIndex(prop, resultIndex);
|
||||||
value = resultEntry.value;
|
value = resultEntry.value;
|
||||||
|
|
|
@ -46,7 +46,7 @@ export abstract class CompileMetadataWithType extends CompileMetadataWithIdentif
|
||||||
}
|
}
|
||||||
|
|
||||||
export function metadataFromJson(data: {[key: string]: any}): any {
|
export function metadataFromJson(data: {[key: string]: any}): any {
|
||||||
return _COMPILE_METADATA_FROM_JSON[data['class']](data);
|
return (_COMPILE_METADATA_FROM_JSON as any /** TODO #9100 */)[data['class']](data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CompileAnimationEntryMetadata {
|
export class CompileAnimationEntryMetadata {
|
||||||
|
@ -523,7 +523,7 @@ export class CompileTokenMap<VALUE> {
|
||||||
get(token: CompileTokenMetadata): VALUE {
|
get(token: CompileTokenMetadata): VALUE {
|
||||||
var rk = token.runtimeCacheKey;
|
var rk = token.runtimeCacheKey;
|
||||||
var ak = token.assetCacheKey;
|
var ak = token.assetCacheKey;
|
||||||
var result;
|
var result: any /** TODO #9100 */;
|
||||||
if (isPresent(rk)) {
|
if (isPresent(rk)) {
|
||||||
result = this._valueMap.get(rk);
|
result = this._valueMap.get(rk);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ export abstract class RenderTypes {
|
||||||
|
|
||||||
export class DefaultRenderTypes implements RenderTypes {
|
export class DefaultRenderTypes implements RenderTypes {
|
||||||
renderer = Identifiers.Renderer;
|
renderer = Identifiers.Renderer;
|
||||||
renderText = null;
|
renderText: any /** TODO #9100 */ = null;
|
||||||
renderElement = null;
|
renderElement: any /** TODO #9100 */ = null;
|
||||||
renderComment = null;
|
renderComment: any /** TODO #9100 */ = null;
|
||||||
renderNode = null;
|
renderNode: any /** TODO #9100 */ = null;
|
||||||
renderEvent = null;
|
renderEvent: any /** TODO #9100 */ = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ export class CssScannerError extends BaseException {
|
||||||
public rawMessage: string;
|
public rawMessage: string;
|
||||||
public message: string;
|
public message: string;
|
||||||
|
|
||||||
constructor(public token: CssToken, message) {
|
constructor(public token: CssToken, message: any /** TODO #9100 */) {
|
||||||
super('Css Parse Error: ' + message);
|
super('Css Parse Error: ' + message);
|
||||||
this.rawMessage = message;
|
this.rawMessage = message;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ export class CssScanner {
|
||||||
next = new CssToken(0, 0, 0, CssTokenType.EOF, "end of file");
|
next = new CssToken(0, 0, 0, CssTokenType.EOF, "end of file");
|
||||||
}
|
}
|
||||||
|
|
||||||
var isMatchingType;
|
var isMatchingType: any /** TODO #9100 */;
|
||||||
if (type == CssTokenType.IdentifierOrNumber) {
|
if (type == CssTokenType.IdentifierOrNumber) {
|
||||||
// TODO (matsko): implement array traversal for lookup here
|
// TODO (matsko): implement array traversal for lookup here
|
||||||
isMatchingType = next.type == CssTokenType.Number || next.type == CssTokenType.Identifier;
|
isMatchingType = next.type == CssTokenType.Number || next.type == CssTokenType.Identifier;
|
||||||
|
@ -263,7 +263,7 @@ export class CssScanner {
|
||||||
// mode so that the parser can recover...
|
// mode so that the parser can recover...
|
||||||
this.setMode(mode);
|
this.setMode(mode);
|
||||||
|
|
||||||
var error = null;
|
var error: any /** TODO #9100 */ = null;
|
||||||
if (!isMatchingType || (isPresent(value) && value != next.strValue)) {
|
if (!isMatchingType || (isPresent(value) && value != next.strValue)) {
|
||||||
var errorMessage = resolveEnumToken(CssTokenType, next.type) + " does not match expected " +
|
var errorMessage = resolveEnumToken(CssTokenType, next.type) + " does not match expected " +
|
||||||
resolveEnumToken(CssTokenType, type) + " value";
|
resolveEnumToken(CssTokenType, type) + " value";
|
||||||
|
@ -740,7 +740,7 @@ function isValidCssCharacter(code: number, mode: CssLexerMode): boolean {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function charCode(input, index): number {
|
function charCode(input: any /** TODO #9100 */, index: any /** TODO #9100 */): number {
|
||||||
return index >= input.length ? $EOF : StringWrapper.charCodeAt(input, index);
|
return index >= input.length ? $EOF : StringWrapper.charCodeAt(input, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ function charStr(code: number): string {
|
||||||
return StringWrapper.fromCharCode(code);
|
return StringWrapper.fromCharCode(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNewline(code): boolean {
|
export function isNewline(code: any /** TODO #9100 */): boolean {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case $FF:
|
case $FF:
|
||||||
case $CR:
|
case $CR:
|
||||||
|
|
|
@ -181,8 +181,8 @@ export class CssParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_parseStyleSheet(delimiters): CssStyleSheetAST {
|
_parseStyleSheet(delimiters: any /** TODO #9100 */): CssStyleSheetAST {
|
||||||
var results = [];
|
var results: any[] /** TODO #9100 */ = [];
|
||||||
this._scanner.consumeEmptyStatements();
|
this._scanner.consumeEmptyStatements();
|
||||||
while (this._scanner.peek != $EOF) {
|
while (this._scanner.peek != $EOF) {
|
||||||
this._scanner.setMode(CssLexerMode.BLOCK);
|
this._scanner.setMode(CssLexerMode.BLOCK);
|
||||||
|
@ -208,7 +208,7 @@ export class CssParser {
|
||||||
this._assertCondition(token.type == CssTokenType.AtKeyword,
|
this._assertCondition(token.type == CssTokenType.AtKeyword,
|
||||||
`The CSS Rule ${token.strValue} is not a valid [@] rule.`, token);
|
`The CSS Rule ${token.strValue} is not a valid [@] rule.`, token);
|
||||||
|
|
||||||
var block, type = this._resolveBlockType(token);
|
var block: any /** TODO #9100 */, type = this._resolveBlockType(token);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BlockType.Charset:
|
case BlockType.Charset:
|
||||||
case BlockType.Namespace:
|
case BlockType.Namespace:
|
||||||
|
@ -243,7 +243,7 @@ export class CssParser {
|
||||||
|
|
||||||
// if a custom @rule { ... } is used it should still tokenize the insides
|
// if a custom @rule { ... } is used it should still tokenize the insides
|
||||||
default:
|
default:
|
||||||
var listOfTokens = [];
|
var listOfTokens: any[] /** TODO #9100 */ = [];
|
||||||
this._scanner.setMode(CssLexerMode.ALL);
|
this._scanner.setMode(CssLexerMode.ALL);
|
||||||
this._error(generateErrorMessage(
|
this._error(generateErrorMessage(
|
||||||
this._scanner.input,
|
this._scanner.input,
|
||||||
|
@ -276,7 +276,7 @@ export class CssParser {
|
||||||
_parseSelectors(delimiters: number): CssSelectorAST[] {
|
_parseSelectors(delimiters: number): CssSelectorAST[] {
|
||||||
delimiters = bitWiseOr([delimiters, LBRACE_DELIM]);
|
delimiters = bitWiseOr([delimiters, LBRACE_DELIM]);
|
||||||
|
|
||||||
var selectors = [];
|
var selectors: any[] /** TODO #9100 */ = [];
|
||||||
var isParsingSelectors = true;
|
var isParsingSelectors = true;
|
||||||
while (isParsingSelectors) {
|
while (isParsingSelectors) {
|
||||||
selectors.push(this._parseSelector(delimiters));
|
selectors.push(this._parseSelector(delimiters));
|
||||||
|
@ -321,7 +321,7 @@ export class CssParser {
|
||||||
|
|
||||||
this._consume(CssTokenType.Character, '{');
|
this._consume(CssTokenType.Character, '{');
|
||||||
|
|
||||||
var definitions = [];
|
var definitions: any[] /** TODO #9100 */ = [];
|
||||||
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
||||||
definitions.push(this._parseKeyframeDefinition(delimiters));
|
definitions.push(this._parseKeyframeDefinition(delimiters));
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ export class CssParser {
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_parseKeyframeDefinition(delimiters: number): CssKeyframeDefinitionAST {
|
_parseKeyframeDefinition(delimiters: number): CssKeyframeDefinitionAST {
|
||||||
var stepTokens = [];
|
var stepTokens: any[] /** TODO #9100 */ = [];
|
||||||
delimiters = bitWiseOr([delimiters, LBRACE_DELIM]);
|
delimiters = bitWiseOr([delimiters, LBRACE_DELIM]);
|
||||||
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
||||||
stepTokens.push(this._parseKeyframeLabel(bitWiseOr([delimiters, COMMA_DELIM])));
|
stepTokens.push(this._parseKeyframeLabel(bitWiseOr([delimiters, COMMA_DELIM])));
|
||||||
|
@ -357,11 +357,11 @@ export class CssParser {
|
||||||
delimiters = bitWiseOr([delimiters, COMMA_DELIM, LBRACE_DELIM]);
|
delimiters = bitWiseOr([delimiters, COMMA_DELIM, LBRACE_DELIM]);
|
||||||
this._scanner.setMode(CssLexerMode.SELECTOR);
|
this._scanner.setMode(CssLexerMode.SELECTOR);
|
||||||
|
|
||||||
var selectorCssTokens = [];
|
var selectorCssTokens: any[] /** TODO #9100 */ = [];
|
||||||
var isComplex = false;
|
var isComplex = false;
|
||||||
var wsCssToken;
|
var wsCssToken: any /** TODO #9100 */;
|
||||||
|
|
||||||
var previousToken;
|
var previousToken: any /** TODO #9100 */;
|
||||||
var parenCount = 0;
|
var parenCount = 0;
|
||||||
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
||||||
var code = this._scanner.peek;
|
var code = this._scanner.peek;
|
||||||
|
@ -454,10 +454,10 @@ export class CssParser {
|
||||||
this._scanner.setMode(CssLexerMode.STYLE_VALUE);
|
this._scanner.setMode(CssLexerMode.STYLE_VALUE);
|
||||||
|
|
||||||
var strValue = "";
|
var strValue = "";
|
||||||
var tokens = [];
|
var tokens: any[] /** TODO #9100 */ = [];
|
||||||
var previous: CssToken;
|
var previous: CssToken;
|
||||||
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
||||||
var token;
|
var token: any /** TODO #9100 */;
|
||||||
if (isPresent(previous) && previous.type == CssTokenType.Identifier &&
|
if (isPresent(previous) && previous.type == CssTokenType.Identifier &&
|
||||||
this._scanner.peek == $LPAREN) {
|
this._scanner.peek == $LPAREN) {
|
||||||
token = this._consume(CssTokenType.Character, '(');
|
token = this._consume(CssTokenType.Character, '(');
|
||||||
|
@ -504,7 +504,7 @@ export class CssParser {
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_collectUntilDelim(delimiters: number, assertType: CssTokenType = null): CssToken[] {
|
_collectUntilDelim(delimiters: number, assertType: CssTokenType = null): CssToken[] {
|
||||||
var tokens = [];
|
var tokens: any[] /** TODO #9100 */ = [];
|
||||||
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
||||||
var val = isPresent(assertType) ? this._consume(assertType) : this._scan();
|
var val = isPresent(assertType) ? this._consume(assertType) : this._scan();
|
||||||
tokens.push(val);
|
tokens.push(val);
|
||||||
|
@ -521,7 +521,7 @@ export class CssParser {
|
||||||
this._consume(CssTokenType.Character, '{');
|
this._consume(CssTokenType.Character, '{');
|
||||||
this._scanner.consumeEmptyStatements();
|
this._scanner.consumeEmptyStatements();
|
||||||
|
|
||||||
var results = [];
|
var results: any[] /** TODO #9100 */ = [];
|
||||||
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
||||||
results.push(this._parseRule(delimiters));
|
results.push(this._parseRule(delimiters));
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,7 @@ export class CssParser {
|
||||||
this._consume(CssTokenType.Character, '{');
|
this._consume(CssTokenType.Character, '{');
|
||||||
this._scanner.consumeEmptyStatements();
|
this._scanner.consumeEmptyStatements();
|
||||||
|
|
||||||
var definitions = [];
|
var definitions: any[] /** TODO #9100 */ = [];
|
||||||
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
while (!characterContainsDelimiter(this._scanner.peek, delimiters)) {
|
||||||
definitions.push(this._parseDefinition(delimiters));
|
definitions.push(this._parseDefinition(delimiters));
|
||||||
this._scanner.consumeEmptyStatements();
|
this._scanner.consumeEmptyStatements();
|
||||||
|
@ -562,7 +562,7 @@ export class CssParser {
|
||||||
this._scanner.setMode(CssLexerMode.STYLE_BLOCK);
|
this._scanner.setMode(CssLexerMode.STYLE_BLOCK);
|
||||||
|
|
||||||
var prop = this._consume(CssTokenType.Identifier);
|
var prop = this._consume(CssTokenType.Identifier);
|
||||||
var parseValue, value = null;
|
var parseValue: any /** TODO #9100 */, value: any /** TODO #9100 */ = null;
|
||||||
|
|
||||||
// the colon value separates the prop from the style.
|
// the colon value separates the prop from the style.
|
||||||
// there are a few cases as to what could happen if it
|
// there are a few cases as to what could happen if it
|
||||||
|
@ -655,7 +655,7 @@ export class CssKeyframeRuleAST extends CssBlockRuleAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CssKeyframeDefinitionAST extends CssBlockRuleAST {
|
export class CssKeyframeDefinitionAST extends CssBlockRuleAST {
|
||||||
public steps;
|
public steps: any /** TODO #9100 */;
|
||||||
constructor(_steps: CssToken[], block: CssBlockAST) {
|
constructor(_steps: CssToken[], block: CssBlockAST) {
|
||||||
super(BlockType.Keyframes, block, mergeTokens(_steps, ","));
|
super(BlockType.Keyframes, block, mergeTokens(_steps, ","));
|
||||||
this.steps = _steps;
|
this.steps = _steps;
|
||||||
|
@ -704,7 +704,7 @@ export class CssDefinitionAST extends CssAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CssSelectorAST extends CssAST {
|
export class CssSelectorAST extends CssAST {
|
||||||
public strValue;
|
public strValue: any /** TODO #9100 */;
|
||||||
constructor(public tokens: CssToken[], public isComplex: boolean = false) {
|
constructor(public tokens: CssToken[], public isComplex: boolean = false) {
|
||||||
super();
|
super();
|
||||||
this.strValue = tokens.map(token => token.strValue).join("");
|
this.strValue = tokens.map(token => token.strValue).join("");
|
||||||
|
@ -735,6 +735,6 @@ export class CssParseError extends ParseError {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CssUnknownTokenListAST extends CssRuleAST {
|
export class CssUnknownTokenListAST extends CssRuleAST {
|
||||||
constructor(public name, public tokens: CssToken[]) { super(); }
|
constructor(public name: any /** TODO #9100 */, public tokens: CssToken[]) { super(); }
|
||||||
visit(visitor: CssASTVisitor, context?: any) { visitor.visitUnkownRule(this, context); }
|
visit(visitor: CssASTVisitor, context?: any) { visitor.visitUnkownRule(this, context); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ const LIFECYCLE_PROPS: Map<any, string> = MapWrapper.createFromPairs([
|
||||||
[LifecycleHooks.AfterViewChecked, 'ngAfterViewChecked'],
|
[LifecycleHooks.AfterViewChecked, 'ngAfterViewChecked'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function hasLifecycleHook(hook: LifecycleHooks, token): boolean {
|
export function hasLifecycleHook(hook: LifecycleHooks, token: any /** TODO #9100 */): boolean {
|
||||||
var lcInterface = LIFECYCLE_INTERFACES.get(hook);
|
var lcInterface = LIFECYCLE_INTERFACES.get(hook);
|
||||||
var lcProp = LIFECYCLE_PROPS.get(hook);
|
var lcProp = LIFECYCLE_PROPS.get(hook);
|
||||||
return reflector.hasLifecycleHook(token, lcInterface, lcProp);
|
return reflector.hasLifecycleHook(token, lcInterface, lcProp);
|
||||||
|
|
|
@ -61,8 +61,8 @@ export class DirectiveResolver {
|
||||||
private _mergeWithPropertyMetadata(dm: DirectiveMetadata,
|
private _mergeWithPropertyMetadata(dm: DirectiveMetadata,
|
||||||
propertyMetadata: {[key: string]: any[]},
|
propertyMetadata: {[key: string]: any[]},
|
||||||
directiveType: Type): DirectiveMetadata {
|
directiveType: Type): DirectiveMetadata {
|
||||||
var inputs = [];
|
var inputs: any[] /** TODO #9100 */ = [];
|
||||||
var outputs = [];
|
var outputs: any[] /** TODO #9100 */ = [];
|
||||||
var host: {[key: string]: string} = {};
|
var host: {[key: string]: string} = {};
|
||||||
var queries: {[key: string]: any} = {};
|
var queries: {[key: string]: any} = {};
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ export class DirectiveResolver {
|
||||||
directiveType: Type): DirectiveMetadata {
|
directiveType: Type): DirectiveMetadata {
|
||||||
var mergedInputs = isPresent(dm.inputs) ? ListWrapper.concat(dm.inputs, inputs) : inputs;
|
var mergedInputs = isPresent(dm.inputs) ? ListWrapper.concat(dm.inputs, inputs) : inputs;
|
||||||
|
|
||||||
var mergedOutputs;
|
var mergedOutputs: any /** TODO #9100 */;
|
||||||
if (isPresent(dm.outputs)) {
|
if (isPresent(dm.outputs)) {
|
||||||
dm.outputs.forEach((propName: string) => {
|
dm.outputs.forEach((propName: string) => {
|
||||||
if (ListWrapper.contains(outputs, propName)) {
|
if (ListWrapper.contains(outputs, propName)) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ export class BindingPipe extends AST {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LiteralPrimitive extends AST {
|
export class LiteralPrimitive extends AST {
|
||||||
constructor(public value) { super(); }
|
constructor(public value: any /** TODO #9100 */) { super(); }
|
||||||
visit(visitor: AstVisitor, context: any = null): any {
|
visit(visitor: AstVisitor, context: any = null): any {
|
||||||
return visitor.visitLiteralPrimitive(this, context);
|
return visitor.visitLiteralPrimitive(this, context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ export enum TokenType {
|
||||||
export class Lexer {
|
export class Lexer {
|
||||||
tokenize(text: string): any[] {
|
tokenize(text: string): any[] {
|
||||||
var scanner = new _Scanner(text);
|
var scanner = new _Scanner(text);
|
||||||
var tokens = [];
|
var tokens: any[] /** TODO #9100 */ = [];
|
||||||
var token = scanner.scanToken();
|
var token = scanner.scanToken();
|
||||||
while (token != null) {
|
while (token != null) {
|
||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
|
@ -160,7 +160,7 @@ export const $RBRACE = /*@ts2dart_const*/ 125;
|
||||||
const $NBSP = /*@ts2dart_const*/ 160;
|
const $NBSP = /*@ts2dart_const*/ 160;
|
||||||
|
|
||||||
export class ScannerError extends BaseException {
|
export class ScannerError extends BaseException {
|
||||||
constructor(public message) { super(); }
|
constructor(public message: any /** TODO #9100 */) { super(); }
|
||||||
|
|
||||||
toString(): string { return this.message; }
|
toString(): string { return this.message; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ export class Parser {
|
||||||
let split = this.splitInterpolation(input, location);
|
let split = this.splitInterpolation(input, location);
|
||||||
if (split == null) return null;
|
if (split == null) return null;
|
||||||
|
|
||||||
let expressions = [];
|
let expressions: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
for (let i = 0; i < split.expressions.length; ++i) {
|
for (let i = 0; i < split.expressions.length; ++i) {
|
||||||
var tokens = this._lexer.tokenize(this._stripComments(split.expressions[i]));
|
var tokens = this._lexer.tokenize(this._stripComments(split.expressions[i]));
|
||||||
|
@ -141,8 +141,8 @@ export class Parser {
|
||||||
if (parts.length <= 1) {
|
if (parts.length <= 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var strings = [];
|
var strings: any[] /** TODO #9100 */ = [];
|
||||||
var expressions = [];
|
var expressions: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
for (var i = 0; i < parts.length; i++) {
|
for (var i = 0; i < parts.length; i++) {
|
||||||
var part: string = parts[i];
|
var part: string = parts[i];
|
||||||
|
@ -170,7 +170,7 @@ export class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _commentStart(input: string): number {
|
private _commentStart(input: string): number {
|
||||||
var outerQuote = null;
|
var outerQuote: any /** TODO #9100 */ = null;
|
||||||
for (var i = 0; i < input.length - 1; i++) {
|
for (var i = 0; i < input.length - 1; i++) {
|
||||||
let char = StringWrapper.charCodeAt(input, i);
|
let char = StringWrapper.charCodeAt(input, i);
|
||||||
let nextChar = StringWrapper.charCodeAt(input, i + 1);
|
let nextChar = StringWrapper.charCodeAt(input, i + 1);
|
||||||
|
@ -277,7 +277,7 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseChain(): AST {
|
parseChain(): AST {
|
||||||
var exprs = [];
|
var exprs: any[] /** TODO #9100 */ = [];
|
||||||
while (this.index < this.tokens.length) {
|
while (this.index < this.tokens.length) {
|
||||||
var expr = this.parsePipe();
|
var expr = this.parsePipe();
|
||||||
exprs.push(expr);
|
exprs.push(expr);
|
||||||
|
@ -306,7 +306,7 @@ export class _ParseAST {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
var name = this.expectIdentifierOrKeyword();
|
var name = this.expectIdentifierOrKeyword();
|
||||||
var args = [];
|
var args: any[] /** TODO #9100 */ = [];
|
||||||
while (this.optionalCharacter($COLON)) {
|
while (this.optionalCharacter($COLON)) {
|
||||||
args.push(this.parseExpression());
|
args.push(this.parseExpression());
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseExpressionList(terminator: number): any[] {
|
parseExpressionList(terminator: number): any[] {
|
||||||
var result = [];
|
var result: any[] /** TODO #9100 */ = [];
|
||||||
if (!this.next.isCharacter(terminator)) {
|
if (!this.next.isCharacter(terminator)) {
|
||||||
do {
|
do {
|
||||||
result.push(this.parsePipe());
|
result.push(this.parsePipe());
|
||||||
|
@ -522,8 +522,8 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseLiteralMap(): LiteralMap {
|
parseLiteralMap(): LiteralMap {
|
||||||
var keys = [];
|
var keys: any[] /** TODO #9100 */ = [];
|
||||||
var values = [];
|
var values: any[] /** TODO #9100 */ = [];
|
||||||
this.expectCharacter($LBRACE);
|
this.expectCharacter($LBRACE);
|
||||||
if (!this.optionalCharacter($RBRACE)) {
|
if (!this.optionalCharacter($RBRACE)) {
|
||||||
do {
|
do {
|
||||||
|
@ -571,7 +571,7 @@ export class _ParseAST {
|
||||||
|
|
||||||
parseCallArguments(): BindingPipe[] {
|
parseCallArguments(): BindingPipe[] {
|
||||||
if (this.next.isCharacter($RPAREN)) return [];
|
if (this.next.isCharacter($RPAREN)) return [];
|
||||||
var positionals = [];
|
var positionals: any[] /** TODO #9100 */ = [];
|
||||||
do {
|
do {
|
||||||
positionals.push(this.parsePipe());
|
positionals.push(this.parsePipe());
|
||||||
} while (this.optionalCharacter($COMMA));
|
} while (this.optionalCharacter($COMMA));
|
||||||
|
@ -582,7 +582,7 @@ export class _ParseAST {
|
||||||
if (!this.parseAction) {
|
if (!this.parseAction) {
|
||||||
this.error("Binding expression cannot contain chained expression");
|
this.error("Binding expression cannot contain chained expression");
|
||||||
}
|
}
|
||||||
var exprs = [];
|
var exprs: any[] /** TODO #9100 */ = [];
|
||||||
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
|
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
|
||||||
var expr = this.parseExpression();
|
var expr = this.parseExpression();
|
||||||
exprs.push(expr);
|
exprs.push(expr);
|
||||||
|
@ -618,7 +618,7 @@ export class _ParseAST {
|
||||||
|
|
||||||
parseTemplateBindings(): TemplateBindingParseResult {
|
parseTemplateBindings(): TemplateBindingParseResult {
|
||||||
var bindings: TemplateBinding[] = [];
|
var bindings: TemplateBinding[] = [];
|
||||||
var prefix = null;
|
var prefix: any /** TODO #9100 */ = null;
|
||||||
var warnings: string[] = [];
|
var warnings: string[] = [];
|
||||||
while (this.index < this.tokens.length) {
|
while (this.index < this.tokens.length) {
|
||||||
var keyIsVar: boolean = this.peekKeywordLet();
|
var keyIsVar: boolean = this.peekKeywordLet();
|
||||||
|
@ -642,8 +642,8 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.optionalCharacter($COLON);
|
this.optionalCharacter($COLON);
|
||||||
var name = null;
|
var name: any /** TODO #9100 */ = null;
|
||||||
var expression = null;
|
var expression: any /** TODO #9100 */ = null;
|
||||||
if (keyIsVar) {
|
if (keyIsVar) {
|
||||||
if (this.optionalOperator("=")) {
|
if (this.optionalOperator("=")) {
|
||||||
name = this.expectTemplateBindingKey();
|
name = this.expectTemplateBindingKey();
|
||||||
|
|
|
@ -57,7 +57,7 @@ export interface HtmlAstVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function htmlVisitAll(visitor: HtmlAstVisitor, asts: HtmlAst[], context: any = null): any[] {
|
export function htmlVisitAll(visitor: HtmlAstVisitor, asts: HtmlAst[], context: any = null): any[] {
|
||||||
var result = [];
|
var result: any[] /** TODO #9100 */ = [];
|
||||||
asts.forEach(ast => {
|
asts.forEach(ast => {
|
||||||
var astResult = ast.visit(visitor, context);
|
var astResult = ast.visit(visitor, context);
|
||||||
if (isPresent(astResult)) {
|
if (isPresent(astResult)) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ class _HtmlTokenizer {
|
||||||
private currentTokenStart: ParseLocation;
|
private currentTokenStart: ParseLocation;
|
||||||
private currentTokenType: HtmlTokenType;
|
private currentTokenType: HtmlTokenType;
|
||||||
|
|
||||||
private expansionCaseStack = [];
|
private expansionCaseStack: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
tokens: HtmlToken[] = [];
|
tokens: HtmlToken[] = [];
|
||||||
errors: HtmlTokenError[] = [];
|
errors: HtmlTokenError[] = [];
|
||||||
|
@ -357,7 +357,7 @@ class _HtmlTokenizer {
|
||||||
}
|
}
|
||||||
this._advance();
|
this._advance();
|
||||||
let name = this.input.substring(start.offset + 1, this.index - 1);
|
let name = this.input.substring(start.offset + 1, this.index - 1);
|
||||||
let char = NAMED_ENTITIES[name];
|
let char = (NAMED_ENTITIES as any /** TODO #9100 */)[name];
|
||||||
if (isBlank(char)) {
|
if (isBlank(char)) {
|
||||||
throw this._createError(unknownEntityErrorMsg(name), this._getSpan(start));
|
throw this._createError(unknownEntityErrorMsg(name), this._getSpan(start));
|
||||||
}
|
}
|
||||||
|
@ -367,11 +367,11 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumeRawText(decodeEntities: boolean, firstCharOfEnd: number,
|
private _consumeRawText(decodeEntities: boolean, firstCharOfEnd: number,
|
||||||
attemptEndRest: Function): HtmlToken {
|
attemptEndRest: Function): HtmlToken {
|
||||||
var tagCloseStart;
|
var tagCloseStart: any /** TODO #9100 */;
|
||||||
var textStart = this._getLocation();
|
var textStart = this._getLocation();
|
||||||
this._beginToken(decodeEntities ? HtmlTokenType.ESCAPABLE_RAW_TEXT : HtmlTokenType.RAW_TEXT,
|
this._beginToken(decodeEntities ? HtmlTokenType.ESCAPABLE_RAW_TEXT : HtmlTokenType.RAW_TEXT,
|
||||||
textStart);
|
textStart);
|
||||||
var parts = [];
|
var parts: any[] /** TODO #9100 */ = [];
|
||||||
while (true) {
|
while (true) {
|
||||||
tagCloseStart = this._getLocation();
|
tagCloseStart = this._getLocation();
|
||||||
if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
|
if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
|
||||||
|
@ -414,11 +414,11 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumePrefixAndName(): string[] {
|
private _consumePrefixAndName(): string[] {
|
||||||
var nameOrPrefixStart = this.index;
|
var nameOrPrefixStart = this.index;
|
||||||
var prefix = null;
|
var prefix: any /** TODO #9100 */ = null;
|
||||||
while (this.peek !== $COLON && !isPrefixEnd(this.peek)) {
|
while (this.peek !== $COLON && !isPrefixEnd(this.peek)) {
|
||||||
this._advance();
|
this._advance();
|
||||||
}
|
}
|
||||||
var nameStart;
|
var nameStart: any /** TODO #9100 */;
|
||||||
if (this.peek === $COLON) {
|
if (this.peek === $COLON) {
|
||||||
this._advance();
|
this._advance();
|
||||||
prefix = this.input.substring(nameOrPrefixStart, this.index - 1);
|
prefix = this.input.substring(nameOrPrefixStart, this.index - 1);
|
||||||
|
@ -433,7 +433,7 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumeTagOpen(start: ParseLocation) {
|
private _consumeTagOpen(start: ParseLocation) {
|
||||||
let savedPos = this._savePosition();
|
let savedPos = this._savePosition();
|
||||||
let lowercaseTagName;
|
let lowercaseTagName: any /** TODO #9100 */;
|
||||||
try {
|
try {
|
||||||
if (!isAsciiLetter(this.peek)) {
|
if (!isAsciiLetter(this.peek)) {
|
||||||
throw this._createError(unexpectedCharacterErrorMsg(this.peek), this._getSpan());
|
throw this._createError(unexpectedCharacterErrorMsg(this.peek), this._getSpan());
|
||||||
|
@ -500,11 +500,11 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumeAttributeValue() {
|
private _consumeAttributeValue() {
|
||||||
this._beginToken(HtmlTokenType.ATTR_VALUE);
|
this._beginToken(HtmlTokenType.ATTR_VALUE);
|
||||||
var value;
|
var value: any /** TODO #9100 */;
|
||||||
if (this.peek === $SQ || this.peek === $DQ) {
|
if (this.peek === $SQ || this.peek === $DQ) {
|
||||||
var quoteChar = this.peek;
|
var quoteChar = this.peek;
|
||||||
this._advance();
|
this._advance();
|
||||||
var parts = [];
|
var parts: any[] /** TODO #9100 */ = [];
|
||||||
while (this.peek !== quoteChar) {
|
while (this.peek !== quoteChar) {
|
||||||
parts.push(this._readChar(true));
|
parts.push(this._readChar(true));
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,7 @@ class _HtmlTokenizer {
|
||||||
private _consumeTagClose(start: ParseLocation) {
|
private _consumeTagClose(start: ParseLocation) {
|
||||||
this._beginToken(HtmlTokenType.TAG_CLOSE, start);
|
this._beginToken(HtmlTokenType.TAG_CLOSE, start);
|
||||||
this._attemptCharCodeUntilFn(isNotWhitespace);
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
||||||
var prefixAndName;
|
var prefixAndName: any /** TODO #9100 */;
|
||||||
prefixAndName = this._consumePrefixAndName();
|
prefixAndName = this._consumePrefixAndName();
|
||||||
this._attemptCharCodeUntilFn(isNotWhitespace);
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
||||||
this._requireCharCode($GT);
|
this._requireCharCode($GT);
|
||||||
|
@ -593,7 +593,7 @@ class _HtmlTokenizer {
|
||||||
var start = this._getLocation();
|
var start = this._getLocation();
|
||||||
this._beginToken(HtmlTokenType.TEXT, start);
|
this._beginToken(HtmlTokenType.TEXT, start);
|
||||||
|
|
||||||
var parts = [];
|
var parts: any[] /** TODO #9100 */ = [];
|
||||||
let interpolation = false;
|
let interpolation = false;
|
||||||
|
|
||||||
if (this.peek === $LBRACE && this.nextPeek === $LBRACE) {
|
if (this.peek === $LBRACE && this.nextPeek === $LBRACE) {
|
||||||
|
@ -712,7 +712,7 @@ function toUpperCaseCharCode(code: number): number {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeTextTokens(srcTokens: HtmlToken[]): HtmlToken[] {
|
function mergeTextTokens(srcTokens: HtmlToken[]): HtmlToken[] {
|
||||||
let dstTokens = [];
|
let dstTokens: any[] /** TODO #9100 */ = [];
|
||||||
let lastDstToken: HtmlToken;
|
let lastDstToken: HtmlToken;
|
||||||
for (let i = 0; i < srcTokens.length; i++) {
|
for (let i = 0; i < srcTokens.length; i++) {
|
||||||
let token = srcTokens[i];
|
let token = srcTokens[i];
|
||||||
|
|
|
@ -115,7 +115,7 @@ class TreeBuilder {
|
||||||
let switchValue = this._advance();
|
let switchValue = this._advance();
|
||||||
|
|
||||||
let type = this._advance();
|
let type = this._advance();
|
||||||
let cases = [];
|
let cases: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
// read =
|
// read =
|
||||||
while (this.peek.type === HtmlTokenType.EXPANSION_CASE_VALUE) {
|
while (this.peek.type === HtmlTokenType.EXPANSION_CASE_VALUE) {
|
||||||
|
@ -170,7 +170,7 @@ class TreeBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _collectExpansionExpTokens(start: HtmlToken): HtmlToken[] {
|
private _collectExpansionExpTokens(start: HtmlToken): HtmlToken[] {
|
||||||
let exp = [];
|
let exp: any[] /** TODO #9100 */ = [];
|
||||||
let expansionFormStack = [HtmlTokenType.EXPANSION_CASE_EXP_START];
|
let expansionFormStack = [HtmlTokenType.EXPANSION_CASE_EXP_START];
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -239,7 +239,7 @@ class TreeBuilder {
|
||||||
private _consumeStartTag(startTagToken: HtmlToken) {
|
private _consumeStartTag(startTagToken: HtmlToken) {
|
||||||
var prefix = startTagToken.parts[0];
|
var prefix = startTagToken.parts[0];
|
||||||
var name = startTagToken.parts[1];
|
var name = startTagToken.parts[1];
|
||||||
var attrs = [];
|
var attrs: any[] /** TODO #9100 */ = [];
|
||||||
while (this.peek.type === HtmlTokenType.ATTR_NAME) {
|
while (this.peek.type === HtmlTokenType.ATTR_NAME) {
|
||||||
attrs.push(this._consumeAttr(this._advance()));
|
attrs.push(this._consumeAttr(this._advance()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,14 +279,14 @@ export class I18nHtmlParser implements HtmlParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _i18nAttributes(el: HtmlElementAst): HtmlAttrAst[] {
|
private _i18nAttributes(el: HtmlElementAst): HtmlAttrAst[] {
|
||||||
let res = [];
|
let res: any[] /** TODO #9100 */ = [];
|
||||||
let implicitAttrs: string[] =
|
let implicitAttrs: string[] =
|
||||||
isPresent(this._implicitAttrs[el.name]) ? this._implicitAttrs[el.name] : [];
|
isPresent(this._implicitAttrs[el.name]) ? this._implicitAttrs[el.name] : [];
|
||||||
|
|
||||||
el.attrs.forEach(attr => {
|
el.attrs.forEach(attr => {
|
||||||
if (attr.name.startsWith(I18N_ATTR_PREFIX) || attr.name == I18N_ATTR) return;
|
if (attr.name.startsWith(I18N_ATTR_PREFIX) || attr.name == I18N_ATTR) return;
|
||||||
|
|
||||||
let message;
|
let message: any /** TODO #9100 */;
|
||||||
|
|
||||||
let i18ns = el.attrs.filter(a => a.name == `${I18N_ATTR_PREFIX}${attr.name}`);
|
let i18ns = el.attrs.filter(a => a.name == `${I18N_ATTR_PREFIX}${attr.name}`);
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ export class I18nHtmlParser implements HtmlParser {
|
||||||
private _replacePlaceholdersWithExpressions(message: string, exps: string[],
|
private _replacePlaceholdersWithExpressions(message: string, exps: string[],
|
||||||
sourceSpan: ParseSourceSpan): string {
|
sourceSpan: ParseSourceSpan): string {
|
||||||
let expMap = this._buildExprMap(exps);
|
let expMap = this._buildExprMap(exps);
|
||||||
return RegExpWrapper.replaceAll(_PLACEHOLDER_EXPANDED_REGEXP, message, (match) => {
|
return RegExpWrapper.replaceAll(_PLACEHOLDER_EXPANDED_REGEXP, message, (match: any /** TODO #9100 */) => {
|
||||||
let nameWithQuotes = match[2];
|
let nameWithQuotes = match[2];
|
||||||
let name = nameWithQuotes.substring(1, nameWithQuotes.length - 1);
|
let name = nameWithQuotes.substring(1, nameWithQuotes.length - 1);
|
||||||
return this._convertIntoExpression(name, expMap, sourceSpan);
|
return this._convertIntoExpression(name, expMap, sourceSpan);
|
||||||
|
|
|
@ -28,11 +28,11 @@ export class I18nError extends ParseError {
|
||||||
|
|
||||||
// Man, this is so ugly!
|
// Man, this is so ugly!
|
||||||
export function partition(nodes: HtmlAst[], errors: ParseError[], implicitTags: string[]): Part[] {
|
export function partition(nodes: HtmlAst[], errors: ParseError[], implicitTags: string[]): Part[] {
|
||||||
let res = [];
|
let res: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
for (let i = 0; i < nodes.length; ++i) {
|
for (let i = 0; i < nodes.length; ++i) {
|
||||||
let n = nodes[i];
|
let n = nodes[i];
|
||||||
let temp = [];
|
let temp: any[] /** TODO #9100 */ = [];
|
||||||
if (_isOpeningComment(n)) {
|
if (_isOpeningComment(n)) {
|
||||||
let i18n = (<HtmlCommentAst>n).value.substring(5).trim();
|
let i18n = (<HtmlCommentAst>n).value.substring(5).trim();
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -38,7 +38,7 @@ export function deserializeXmb(content: string, url: string): XmbDeserialization
|
||||||
}
|
}
|
||||||
|
|
||||||
let bundleEl = <HtmlElementAst>parsed.rootNodes[0]; // test this
|
let bundleEl = <HtmlElementAst>parsed.rootNodes[0]; // test this
|
||||||
let errors = [];
|
let errors: any[] /** TODO #9100 */ = [];
|
||||||
let messages: {[key: string]: HtmlAst[]} = {};
|
let messages: {[key: string]: HtmlAst[]} = {};
|
||||||
|
|
||||||
_createMessages(bundleEl.children, messages, errors);
|
_createMessages(bundleEl.children, messages, errors);
|
||||||
|
@ -88,7 +88,7 @@ function _serializeMessage(m: Message): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _expandPlaceholder(input: string): string {
|
function _expandPlaceholder(input: string): string {
|
||||||
return RegExpWrapper.replaceAll(_PLACEHOLDER_REGEXP, input, (match) => {
|
return RegExpWrapper.replaceAll(_PLACEHOLDER_REGEXP, input, (match: any /** TODO #9100 */) => {
|
||||||
let nameWithQuotes = match[2];
|
let nameWithQuotes = match[2];
|
||||||
return `<ph name=${nameWithQuotes}></ph>`;
|
return `<ph name=${nameWithQuotes}></ph>`;
|
||||||
});
|
});
|
||||||
|
|
|
@ -126,9 +126,9 @@ export class CompileMetadataResolver {
|
||||||
var meta = this._directiveCache.get(directiveType);
|
var meta = this._directiveCache.get(directiveType);
|
||||||
if (isBlank(meta)) {
|
if (isBlank(meta)) {
|
||||||
var dirMeta = this._directiveResolver.resolve(directiveType);
|
var dirMeta = this._directiveResolver.resolve(directiveType);
|
||||||
var templateMeta = null;
|
var templateMeta: any /** TODO #9100 */ = null;
|
||||||
var changeDetectionStrategy = null;
|
var changeDetectionStrategy: any /** TODO #9100 */ = null;
|
||||||
var viewProviders = [];
|
var viewProviders: any[] /** TODO #9100 */ = [];
|
||||||
var moduleUrl = staticTypeModuleUrl(directiveType);
|
var moduleUrl = staticTypeModuleUrl(directiveType);
|
||||||
if (dirMeta instanceof ComponentMetadata) {
|
if (dirMeta instanceof ComponentMetadata) {
|
||||||
assertArrayOfStrings('styles', dirMeta.styles);
|
assertArrayOfStrings('styles', dirMeta.styles);
|
||||||
|
@ -154,12 +154,12 @@ export class CompileMetadataResolver {
|
||||||
moduleUrl = componentModuleUrl(this._reflector, directiveType, cmpMeta);
|
moduleUrl = componentModuleUrl(this._reflector, directiveType, cmpMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
var providers = [];
|
var providers: any[] /** TODO #9100 */ = [];
|
||||||
if (isPresent(dirMeta.providers)) {
|
if (isPresent(dirMeta.providers)) {
|
||||||
providers = this.getProvidersMetadata(dirMeta.providers);
|
providers = this.getProvidersMetadata(dirMeta.providers);
|
||||||
}
|
}
|
||||||
var queries = [];
|
var queries: any[] /** TODO #9100 */ = [];
|
||||||
var viewQueries = [];
|
var viewQueries: any[] /** TODO #9100 */ = [];
|
||||||
if (isPresent(dirMeta.queries)) {
|
if (isPresent(dirMeta.queries)) {
|
||||||
queries = this.getQueriesMetadata(dirMeta.queries, false, directiveType);
|
queries = this.getQueriesMetadata(dirMeta.queries, false, directiveType);
|
||||||
viewQueries = this.getQueriesMetadata(dirMeta.queries, true, directiveType);
|
viewQueries = this.getQueriesMetadata(dirMeta.queries, true, directiveType);
|
||||||
|
@ -275,7 +275,7 @@ export class CompileMetadataResolver {
|
||||||
let isOptional = false;
|
let isOptional = false;
|
||||||
let query: QueryMetadata = null;
|
let query: QueryMetadata = null;
|
||||||
let viewQuery: ViewQueryMetadata = null;
|
let viewQuery: ViewQueryMetadata = null;
|
||||||
var token = null;
|
var token: any /** TODO #9100 */ = null;
|
||||||
if (isArray(param)) {
|
if (isArray(param)) {
|
||||||
(<any[]>param)
|
(<any[]>param)
|
||||||
.forEach((paramEntry) => {
|
.forEach((paramEntry) => {
|
||||||
|
@ -324,7 +324,7 @@ export class CompileMetadataResolver {
|
||||||
|
|
||||||
getTokenMetadata(token: any): cpl.CompileTokenMetadata {
|
getTokenMetadata(token: any): cpl.CompileTokenMetadata {
|
||||||
token = resolveForwardRef(token);
|
token = resolveForwardRef(token);
|
||||||
var compileToken;
|
var compileToken: any /** TODO #9100 */;
|
||||||
if (isString(token)) {
|
if (isString(token)) {
|
||||||
compileToken = new cpl.CompileTokenMetadata({value: token});
|
compileToken = new cpl.CompileTokenMetadata({value: token});
|
||||||
} else {
|
} else {
|
||||||
|
@ -356,7 +356,7 @@ export class CompileMetadataResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
getProviderMetadata(provider: Provider): cpl.CompileProviderMetadata {
|
getProviderMetadata(provider: Provider): cpl.CompileProviderMetadata {
|
||||||
var compileDeps;
|
var compileDeps: any /** TODO #9100 */;
|
||||||
if (isPresent(provider.useClass)) {
|
if (isPresent(provider.useClass)) {
|
||||||
compileDeps = this.getDependenciesMetadata(provider.useClass, provider.dependencies);
|
compileDeps = this.getDependenciesMetadata(provider.useClass, provider.dependencies);
|
||||||
} else if (isPresent(provider.useFactory)) {
|
} else if (isPresent(provider.useFactory)) {
|
||||||
|
@ -382,8 +382,8 @@ export class CompileMetadataResolver {
|
||||||
|
|
||||||
getQueriesMetadata(queries: {[key: string]: QueryMetadata},
|
getQueriesMetadata(queries: {[key: string]: QueryMetadata},
|
||||||
isViewQuery: boolean, directiveType: Type): cpl.CompileQueryMetadata[] {
|
isViewQuery: boolean, directiveType: Type): cpl.CompileQueryMetadata[] {
|
||||||
var compileQueries = [];
|
var compileQueries: any[] /** TODO #9100 */ = [];
|
||||||
StringMapWrapper.forEach(queries, (query, propertyName) => {
|
StringMapWrapper.forEach(queries, (query: any /** TODO #9100 */, propertyName: any /** TODO #9100 */) => {
|
||||||
if (query.isViewQuery === isViewQuery) {
|
if (query.isViewQuery === isViewQuery) {
|
||||||
compileQueries.push(this.getQueryMetadata(query, propertyName, directiveType));
|
compileQueries.push(this.getQueryMetadata(query, propertyName, directiveType));
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ export class CompileMetadataResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type | Function): cpl.CompileQueryMetadata {
|
getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type | Function): cpl.CompileQueryMetadata {
|
||||||
var selectors;
|
var selectors: any /** TODO #9100 */;
|
||||||
if (q.isVarBindingQuery) {
|
if (q.isVarBindingQuery) {
|
||||||
selectors = q.varBindings.map(varName => this.getTokenMetadata(varName));
|
selectors = q.varBindings.map(varName => this.getTokenMetadata(varName));
|
||||||
} else {
|
} else {
|
||||||
|
@ -412,7 +412,7 @@ export class CompileMetadataResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
function flattenDirectives(view: ViewMetadata, platformDirectives: any[]): Type[] {
|
function flattenDirectives(view: ViewMetadata, platformDirectives: any[]): Type[] {
|
||||||
let directives = [];
|
let directives: any[] /** TODO #9100 */ = [];
|
||||||
if (isPresent(platformDirectives)) {
|
if (isPresent(platformDirectives)) {
|
||||||
flattenArray(platformDirectives, directives);
|
flattenArray(platformDirectives, directives);
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ function flattenDirectives(view: ViewMetadata, platformDirectives: any[]): Type[
|
||||||
}
|
}
|
||||||
|
|
||||||
function flattenPipes(view: ViewMetadata, platformPipes: any[]): Type[] {
|
function flattenPipes(view: ViewMetadata, platformPipes: any[]): Type[] {
|
||||||
let pipes = [];
|
let pipes: any[] /** TODO #9100 */ = [];
|
||||||
if (isPresent(platformPipes)) {
|
if (isPresent(platformPipes)) {
|
||||||
flattenArray(platformPipes, pipes);
|
flattenArray(platformPipes, pipes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ export class OfflineCompiler {
|
||||||
if (components.length === 0) {
|
if (components.length === 0) {
|
||||||
throw new BaseException('No components given');
|
throw new BaseException('No components given');
|
||||||
}
|
}
|
||||||
var statements = [];
|
var statements: any[] /** TODO #9100 */ = [];
|
||||||
var exportedVars = [];
|
var exportedVars: any[] /** TODO #9100 */ = [];
|
||||||
var moduleUrl = _templateModuleUrl(components[0].component);
|
var moduleUrl = _templateModuleUrl(components[0].component);
|
||||||
components.forEach(componentWithDirs => {
|
components.forEach(componentWithDirs => {
|
||||||
var compMeta = <CompileDirectiveMetadata>componentWithDirs.component;
|
var compMeta = <CompileDirectiveMetadata>componentWithDirs.component;
|
||||||
|
@ -88,7 +88,7 @@ export class OfflineCompiler {
|
||||||
return this._xhr.get(stylesheetUrl)
|
return this._xhr.get(stylesheetUrl)
|
||||||
.then((cssText) => {
|
.then((cssText) => {
|
||||||
var compileResult = this._styleCompiler.compileStylesheet(stylesheetUrl, cssText, shim);
|
var compileResult = this._styleCompiler.compileStylesheet(stylesheetUrl, cssText, shim);
|
||||||
var importedUrls = [];
|
var importedUrls: any[] /** TODO #9100 */ = [];
|
||||||
compileResult.dependencies.forEach((dep) => {
|
compileResult.dependencies.forEach((dep) => {
|
||||||
importedUrls.push(dep.moduleUrl);
|
importedUrls.push(dep.moduleUrl);
|
||||||
dep.valuePlaceholder.moduleUrl = _stylesModuleUrl(dep.moduleUrl, dep.isShimmed, suffix);
|
dep.valuePlaceholder.moduleUrl = _stylesModuleUrl(dep.moduleUrl, dep.isShimmed, suffix);
|
||||||
|
|
|
@ -274,7 +274,7 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex
|
||||||
abstract visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, context: any): any;
|
abstract visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, context: any): any;
|
||||||
|
|
||||||
visitBinaryOperatorExpr(ast: o.BinaryOperatorExpr, ctx: EmitterVisitorContext): any {
|
visitBinaryOperatorExpr(ast: o.BinaryOperatorExpr, ctx: EmitterVisitorContext): any {
|
||||||
var opStr;
|
var opStr: any /** TODO #9100 */;
|
||||||
switch (ast.operator) {
|
switch (ast.operator) {
|
||||||
case o.BinaryOperator.Equals:
|
case o.BinaryOperator.Equals:
|
||||||
opStr = '==';
|
opStr = '==';
|
||||||
|
@ -358,7 +358,7 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex
|
||||||
var useNewLine = ast.entries.length > 1;
|
var useNewLine = ast.entries.length > 1;
|
||||||
ctx.print(`{`, useNewLine);
|
ctx.print(`{`, useNewLine);
|
||||||
ctx.incIndent();
|
ctx.incIndent();
|
||||||
this.visitAllObjects((entry) => {
|
this.visitAllObjects((entry: any /** TODO #9100 */) => {
|
||||||
ctx.print(`${escapeSingleQuoteString(entry[0], this._escapeDollarInStrings)}: `);
|
ctx.print(`${escapeSingleQuoteString(entry[0], this._escapeDollarInStrings)}: `);
|
||||||
entry[1].visitExpression(this, ctx);
|
entry[1].visitExpression(this, ctx);
|
||||||
}, ast.entries, ctx, ',', useNewLine);
|
}, ast.entries, ctx, ',', useNewLine);
|
||||||
|
@ -369,7 +369,7 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex
|
||||||
|
|
||||||
visitAllExpressions(expressions: o.Expression[], ctx: EmitterVisitorContext, separator: string,
|
visitAllExpressions(expressions: o.Expression[], ctx: EmitterVisitorContext, separator: string,
|
||||||
newLine: boolean = false): void {
|
newLine: boolean = false): void {
|
||||||
this.visitAllObjects((expr) => expr.visitExpression(this, ctx), expressions, ctx, separator,
|
this.visitAllObjects((expr: any /** TODO #9100 */) => expr.visitExpression(this, ctx), expressions, ctx, separator,
|
||||||
newLine);
|
newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ export function escapeSingleQuoteString(input: string, escapeDollar: boolean): a
|
||||||
if (isBlank(input)) {
|
if (isBlank(input)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var body = StringWrapper.replaceAllMapped(input, _SINGLE_QUOTE_ESCAPE_STRING_RE, (match) => {
|
var body = StringWrapper.replaceAllMapped(input, _SINGLE_QUOTE_ESCAPE_STRING_RE, (match: any /** TODO #9100 */) => {
|
||||||
if (match[0] == '$') {
|
if (match[0] == '$') {
|
||||||
return escapeDollar ? '\\$' : '$';
|
return escapeDollar ? '\\$' : '$';
|
||||||
} else if (match[0] == '\n') {
|
} else if (match[0] == '\n') {
|
||||||
|
|
|
@ -141,11 +141,11 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void {
|
private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void {
|
||||||
this.visitAllObjects((param) => ctx.print(param.name), params, ctx, ',');
|
this.visitAllObjects((param: any /** TODO #9100 */) => ctx.print(param.name), params, ctx, ',');
|
||||||
}
|
}
|
||||||
|
|
||||||
getBuiltinMethodName(method: o.BuiltinMethod): string {
|
getBuiltinMethodName(method: o.BuiltinMethod): string {
|
||||||
var name;
|
var name: any /** TODO #9100 */;
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case o.BuiltinMethod.ConcatArray:
|
case o.BuiltinMethod.ConcatArray:
|
||||||
name = 'concat';
|
name = 'concat';
|
||||||
|
|
|
@ -39,7 +39,7 @@ export function debugOutputAstAsDart(ast: o.Statement | o.Expression | o.Type |
|
||||||
export class DartEmitter implements OutputEmitter {
|
export class DartEmitter implements OutputEmitter {
|
||||||
constructor(private _importGenerator: ImportGenerator) {}
|
constructor(private _importGenerator: ImportGenerator) {}
|
||||||
emitStatements(moduleUrl: string, stmts: o.Statement[], exportedVars: string[]): string {
|
emitStatements(moduleUrl: string, stmts: o.Statement[], exportedVars: string[]): string {
|
||||||
var srcParts = [];
|
var srcParts: any[] /** TODO #9100 */ = [];
|
||||||
// Note: We are not creating a library here as Dart does not need it.
|
// Note: We are not creating a library here as Dart does not need it.
|
||||||
// Dart analzyer might complain about it though.
|
// Dart analzyer might complain about it though.
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ class _DartEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisito
|
||||||
}
|
}
|
||||||
|
|
||||||
getBuiltinMethodName(method: o.BuiltinMethod): string {
|
getBuiltinMethodName(method: o.BuiltinMethod): string {
|
||||||
var name;
|
var name: any /** TODO #9100 */;
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case o.BuiltinMethod.ConcatArray:
|
case o.BuiltinMethod.ConcatArray:
|
||||||
name = '.addAll';
|
name = '.addAll';
|
||||||
|
@ -271,7 +271,7 @@ class _DartEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisito
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
visitBuiltintType(type: o.BuiltinType, ctx: EmitterVisitorContext): any {
|
visitBuiltintType(type: o.BuiltinType, ctx: EmitterVisitorContext): any {
|
||||||
var typeStr;
|
var typeStr: any /** TODO #9100 */;
|
||||||
switch (type.name) {
|
switch (type.name) {
|
||||||
case o.BuiltinTypeName.Bool:
|
case o.BuiltinTypeName.Bool:
|
||||||
typeStr = 'bool';
|
typeStr = 'bool';
|
||||||
|
@ -323,7 +323,7 @@ class _DartEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisito
|
||||||
}
|
}
|
||||||
|
|
||||||
private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void {
|
private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void {
|
||||||
this.visitAllObjects((param) => {
|
this.visitAllObjects((param: any /** TODO #9100 */) => {
|
||||||
if (isPresent(param.type)) {
|
if (isPresent(param.type)) {
|
||||||
param.type.visitType(this, ctx);
|
param.type.visitType(this, ctx);
|
||||||
ctx.print(' ');
|
ctx.print(' ');
|
||||||
|
@ -348,7 +348,7 @@ class _DartEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisito
|
||||||
ctx.print(value.name);
|
ctx.print(value.name);
|
||||||
if (isPresent(typeParams) && typeParams.length > 0) {
|
if (isPresent(typeParams) && typeParams.length > 0) {
|
||||||
ctx.print(`<`);
|
ctx.print(`<`);
|
||||||
this.visitAllObjects((type) => type.visitType(this, ctx), typeParams, ctx, ',');
|
this.visitAllObjects((type: any /** TODO #9100 */) => type.visitType(this, ctx), typeParams, ctx, ',');
|
||||||
ctx.print(`>`);
|
ctx.print(`>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ export function getRelativePath(modulePath: string, importedPath: string): strin
|
||||||
var importedParts = importedPath.split(_PATH_SEP_RE);
|
var importedParts = importedPath.split(_PATH_SEP_RE);
|
||||||
var longestPrefix = getLongestPathSegmentPrefix(moduleParts, importedParts);
|
var longestPrefix = getLongestPathSegmentPrefix(moduleParts, importedParts);
|
||||||
|
|
||||||
var resultParts = [];
|
var resultParts: any[] /** TODO #9100 */ = [];
|
||||||
var goParentCount = moduleParts.length - 1 - longestPrefix;
|
var goParentCount = moduleParts.length - 1 - longestPrefix;
|
||||||
for (var i = 0; i < goParentCount; i++) {
|
for (var i = 0; i < goParentCount; i++) {
|
||||||
resultParts.push('..');
|
resultParts.push('..');
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class JavaScriptEmitter implements OutputEmitter {
|
||||||
var converter = new JsEmitterVisitor(moduleUrl);
|
var converter = new JsEmitterVisitor(moduleUrl);
|
||||||
var ctx = EmitterVisitorContext.createRoot(exportedVars);
|
var ctx = EmitterVisitorContext.createRoot(exportedVars);
|
||||||
converter.visitAllStatements(stmts, ctx);
|
converter.visitAllStatements(stmts, ctx);
|
||||||
var srcParts = [];
|
var srcParts: any[] /** TODO #9100 */ = [];
|
||||||
converter.importsWithPrefixes.forEach((prefix, importedModuleUrl) => {
|
converter.importsWithPrefixes.forEach((prefix, importedModuleUrl) => {
|
||||||
// Note: can't write the real word for import as it screws up system.js auto detection...
|
// Note: can't write the real word for import as it screws up system.js auto detection...
|
||||||
srcParts.push(
|
srcParts.push(
|
||||||
|
|
|
@ -179,7 +179,7 @@ export enum BuiltinVar {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ReadVarExpr extends Expression {
|
export class ReadVarExpr extends Expression {
|
||||||
public name;
|
public name: any /** TODO #9100 */;
|
||||||
public builtin: BuiltinVar;
|
public builtin: BuiltinVar;
|
||||||
|
|
||||||
constructor(name: string | BuiltinVar, type: Type = null) {
|
constructor(name: string | BuiltinVar, type: Type = null) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||||
visitInvokeMethodExpr(expr: o.InvokeMethodExpr, ctx: _ExecutionContext): any {
|
visitInvokeMethodExpr(expr: o.InvokeMethodExpr, ctx: _ExecutionContext): any {
|
||||||
var receiver = expr.receiver.visitExpression(this, ctx);
|
var receiver = expr.receiver.visitExpression(this, ctx);
|
||||||
var args = this.visitAllExpressions(expr.args, ctx);
|
var args = this.visitAllExpressions(expr.args, ctx);
|
||||||
var result;
|
var result: any /** TODO #9100 */;
|
||||||
if (isPresent(expr.builtin)) {
|
if (isPresent(expr.builtin)) {
|
||||||
switch (expr.builtin) {
|
switch (expr.builtin) {
|
||||||
case o.BuiltinMethod.ConcatArray:
|
case o.BuiltinMethod.ConcatArray:
|
||||||
|
@ -324,7 +324,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visitReadPropExpr(ast: o.ReadPropExpr, ctx: _ExecutionContext): any {
|
visitReadPropExpr(ast: o.ReadPropExpr, ctx: _ExecutionContext): any {
|
||||||
var result;
|
var result: any /** TODO #9100 */;
|
||||||
var receiver = ast.receiver.visitExpression(this, ctx);
|
var receiver = ast.receiver.visitExpression(this, ctx);
|
||||||
if (isDynamicInstance(receiver)) {
|
if (isDynamicInstance(receiver)) {
|
||||||
var di = <DynamicInstance>receiver;
|
var di = <DynamicInstance>receiver;
|
||||||
|
@ -352,7 +352,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||||
}
|
}
|
||||||
visitLiteralMapExpr(ast: o.LiteralMapExpr, ctx: _ExecutionContext): any {
|
visitLiteralMapExpr(ast: o.LiteralMapExpr, ctx: _ExecutionContext): any {
|
||||||
var result = {};
|
var result = {};
|
||||||
ast.entries.forEach((entry) => result[<string>entry[0]] =
|
ast.entries.forEach((entry) => (result as any /** TODO #9100 */)[<string>entry[0]] =
|
||||||
(<o.Expression>entry[1]).visitExpression(this, ctx));
|
(<o.Expression>entry[1]).visitExpression(this, ctx));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -379,32 +379,32 @@ function _declareFn(varNames: string[], statements: o.Statement[], ctx: _Executi
|
||||||
case 0:
|
case 0:
|
||||||
return () => _executeFunctionStatements(varNames, [], statements, ctx, visitor);
|
return () => _executeFunctionStatements(varNames, [], statements, ctx, visitor);
|
||||||
case 1:
|
case 1:
|
||||||
return (d0) => _executeFunctionStatements(varNames, [d0], statements, ctx, visitor);
|
return (d0: any /** TODO #9100 */) => _executeFunctionStatements(varNames, [d0], statements, ctx, visitor);
|
||||||
case 2:
|
case 2:
|
||||||
return (d0, d1) => _executeFunctionStatements(varNames, [d0, d1], statements, ctx, visitor);
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */) => _executeFunctionStatements(varNames, [d0, d1], statements, ctx, visitor);
|
||||||
case 3:
|
case 3:
|
||||||
return (d0, d1, d2) =>
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */) =>
|
||||||
_executeFunctionStatements(varNames, [d0, d1, d2], statements, ctx, visitor);
|
_executeFunctionStatements(varNames, [d0, d1, d2], statements, ctx, visitor);
|
||||||
case 4:
|
case 4:
|
||||||
return (d0, d1, d2, d3) =>
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */, d3: any /** TODO #9100 */) =>
|
||||||
_executeFunctionStatements(varNames, [d0, d1, d2, d3], statements, ctx, visitor);
|
_executeFunctionStatements(varNames, [d0, d1, d2, d3], statements, ctx, visitor);
|
||||||
case 5:
|
case 5:
|
||||||
return (d0, d1, d2, d3, d4) => _executeFunctionStatements(varNames, [d0, d1, d2, d3, d4],
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */, d3: any /** TODO #9100 */, d4: any /** TODO #9100 */) => _executeFunctionStatements(varNames, [d0, d1, d2, d3, d4],
|
||||||
statements, ctx, visitor);
|
statements, ctx, visitor);
|
||||||
case 6:
|
case 6:
|
||||||
return (d0, d1, d2, d3, d4, d5) => _executeFunctionStatements(
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */, d3: any /** TODO #9100 */, d4: any /** TODO #9100 */, d5: any /** TODO #9100 */) => _executeFunctionStatements(
|
||||||
varNames, [d0, d1, d2, d3, d4, d5], statements, ctx, visitor);
|
varNames, [d0, d1, d2, d3, d4, d5], statements, ctx, visitor);
|
||||||
case 7:
|
case 7:
|
||||||
return (d0, d1, d2, d3, d4, d5, d6) => _executeFunctionStatements(
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */, d3: any /** TODO #9100 */, d4: any /** TODO #9100 */, d5: any /** TODO #9100 */, d6: any /** TODO #9100 */) => _executeFunctionStatements(
|
||||||
varNames, [d0, d1, d2, d3, d4, d5, d6], statements, ctx, visitor);
|
varNames, [d0, d1, d2, d3, d4, d5, d6], statements, ctx, visitor);
|
||||||
case 8:
|
case 8:
|
||||||
return (d0, d1, d2, d3, d4, d5, d6, d7) => _executeFunctionStatements(
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */, d3: any /** TODO #9100 */, d4: any /** TODO #9100 */, d5: any /** TODO #9100 */, d6: any /** TODO #9100 */, d7: any /** TODO #9100 */) => _executeFunctionStatements(
|
||||||
varNames, [d0, d1, d2, d3, d4, d5, d6, d7], statements, ctx, visitor);
|
varNames, [d0, d1, d2, d3, d4, d5, d6, d7], statements, ctx, visitor);
|
||||||
case 9:
|
case 9:
|
||||||
return (d0, d1, d2, d3, d4, d5, d6, d7, d8) => _executeFunctionStatements(
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */, d3: any /** TODO #9100 */, d4: any /** TODO #9100 */, d5: any /** TODO #9100 */, d6: any /** TODO #9100 */, d7: any /** TODO #9100 */, d8: any /** TODO #9100 */) => _executeFunctionStatements(
|
||||||
varNames, [d0, d1, d2, d3, d4, d5, d6, d7, d8], statements, ctx, visitor);
|
varNames, [d0, d1, d2, d3, d4, d5, d6, d7, d8], statements, ctx, visitor);
|
||||||
case 10:
|
case 10:
|
||||||
return (d0, d1, d2, d3, d4, d5, d6, d7, d8, d9) => _executeFunctionStatements(
|
return (d0: any /** TODO #9100 */, d1: any /** TODO #9100 */, d2: any /** TODO #9100 */, d3: any /** TODO #9100 */, d4: any /** TODO #9100 */, d5: any /** TODO #9100 */, d6: any /** TODO #9100 */, d7: any /** TODO #9100 */, d8: any /** TODO #9100 */, d9: any /** TODO #9100 */) => _executeFunctionStatements(
|
||||||
varNames, [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9], statements, ctx, visitor);
|
varNames, [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9], statements, ctx, visitor);
|
||||||
default:
|
default:
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
|
|
|
@ -22,7 +22,7 @@ class JitEmitterVisitor extends AbstractJsEmitterVisitor {
|
||||||
getArgs(): {[key: string]: any} {
|
getArgs(): {[key: string]: any} {
|
||||||
var result = {};
|
var result = {};
|
||||||
for (var i = 0; i < this._evalArgNames.length; i++) {
|
for (var i = 0; i < this._evalArgNames.length; i++) {
|
||||||
result[this._evalArgNames[i]] = this._evalArgValues[i];
|
(result as any /** TODO #9100 */)[this._evalArgNames[i]] = this._evalArgValues[i];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ export class TypeScriptEmitter implements OutputEmitter {
|
||||||
var converter = new _TsEmitterVisitor(moduleUrl);
|
var converter = new _TsEmitterVisitor(moduleUrl);
|
||||||
var ctx = EmitterVisitorContext.createRoot(exportedVars);
|
var ctx = EmitterVisitorContext.createRoot(exportedVars);
|
||||||
converter.visitAllStatements(stmts, ctx);
|
converter.visitAllStatements(stmts, ctx);
|
||||||
var srcParts = [];
|
var srcParts: any[] /** TODO #9100 */ = [];
|
||||||
converter.importsWithPrefixes.forEach((prefix, importedModuleUrl) => {
|
converter.importsWithPrefixes.forEach((prefix, importedModuleUrl) => {
|
||||||
// Note: can't write the real word for import as it screws up system.js auto detection...
|
// Note: can't write the real word for import as it screws up system.js auto detection...
|
||||||
srcParts.push(
|
srcParts.push(
|
||||||
|
@ -208,7 +208,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||||
}
|
}
|
||||||
|
|
||||||
visitBuiltintType(type: o.BuiltinType, ctx: EmitterVisitorContext): any {
|
visitBuiltintType(type: o.BuiltinType, ctx: EmitterVisitorContext): any {
|
||||||
var typeStr;
|
var typeStr: any /** TODO #9100 */;
|
||||||
switch (type.name) {
|
switch (type.name) {
|
||||||
case o.BuiltinTypeName.Bool:
|
case o.BuiltinTypeName.Bool:
|
||||||
typeStr = 'boolean';
|
typeStr = 'boolean';
|
||||||
|
@ -251,7 +251,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||||
}
|
}
|
||||||
|
|
||||||
getBuiltinMethodName(method: o.BuiltinMethod): string {
|
getBuiltinMethodName(method: o.BuiltinMethod): string {
|
||||||
var name;
|
var name: any /** TODO #9100 */;
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case o.BuiltinMethod.ConcatArray:
|
case o.BuiltinMethod.ConcatArray:
|
||||||
name = 'concat';
|
name = 'concat';
|
||||||
|
@ -270,7 +270,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||||
|
|
||||||
|
|
||||||
private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void {
|
private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void {
|
||||||
this.visitAllObjects((param) => {
|
this.visitAllObjects((param: any /** TODO #9100 */) => {
|
||||||
ctx.print(param.name);
|
ctx.print(param.name);
|
||||||
ctx.print(':');
|
ctx.print(':');
|
||||||
this.visitType(param.type, ctx);
|
this.visitType(param.type, ctx);
|
||||||
|
@ -293,7 +293,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||||
ctx.print(value.name);
|
ctx.print(value.name);
|
||||||
if (isPresent(typeParams) && typeParams.length > 0) {
|
if (isPresent(typeParams) && typeParams.length > 0) {
|
||||||
ctx.print(`<`);
|
ctx.print(`<`);
|
||||||
this.visitAllObjects((type) => type.visitType(this, ctx), typeParams, ctx, ',');
|
this.visitAllObjects((type: any /** TODO #9100 */) => type.visitType(this, ctx), typeParams, ctx, ',');
|
||||||
ctx.print(`>`);
|
ctx.print(`>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ export class ProviderElementContext {
|
||||||
var transformedProviders = resolvedProvider.providers.map((provider) => {
|
var transformedProviders = resolvedProvider.providers.map((provider) => {
|
||||||
var transformedUseValue = provider.useValue;
|
var transformedUseValue = provider.useValue;
|
||||||
var transformedUseExisting = provider.useExisting;
|
var transformedUseExisting = provider.useExisting;
|
||||||
var transformedDeps;
|
var transformedDeps: any /** TODO #9100 */;
|
||||||
if (isPresent(provider.useExisting)) {
|
if (isPresent(provider.useExisting)) {
|
||||||
var existingDiDep = this._getDependency(
|
var existingDiDep = this._getDependency(
|
||||||
resolvedProvider.providerType,
|
resolvedProvider.providerType,
|
||||||
|
|
|
@ -101,7 +101,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
||||||
this._templateParser.parse(compMeta, compMeta.template.template,
|
this._templateParser.parse(compMeta, compMeta.template.template,
|
||||||
normalizedViewDirMetas, pipes, compMeta.type.name);
|
normalizedViewDirMetas, pipes, compMeta.type.name);
|
||||||
|
|
||||||
var childPromises = [];
|
var childPromises: any[] /** TODO #9100 */ = [];
|
||||||
compiledTemplate.init(this._compileComponent(compMeta, parsedTemplate, styles,
|
compiledTemplate.init(this._compileComponent(compMeta, parsedTemplate, styles,
|
||||||
pipes, compilingComponentsPath, childPromises));
|
pipes, compilingComponentsPath, childPromises));
|
||||||
return PromiseWrapper.all(childPromises).then((_) => { return compiledTemplate; });
|
return PromiseWrapper.all(childPromises).then((_) => { return compiledTemplate; });
|
||||||
|
@ -140,7 +140,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
||||||
childPromises.push(this._compiledTemplateDone.get(childCacheKey));
|
childPromises.push(this._compiledTemplateDone.get(childCacheKey));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var factory;
|
var factory: any /** TODO #9100 */;
|
||||||
if (IS_DART || !this._genConfig.useJit) {
|
if (IS_DART || !this._genConfig.useJit) {
|
||||||
factory = interpretStatements(compileResult.statements, compileResult.viewFactoryVar,
|
factory = interpretStatements(compileResult.statements, compileResult.viewFactoryVar,
|
||||||
new InterpretiveAppViewInstanceFactory());
|
new InterpretiveAppViewInstanceFactory());
|
||||||
|
@ -161,7 +161,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
||||||
var promises = result.dependencies.map((dep) => this._loadStylesheetDep(dep));
|
var promises = result.dependencies.map((dep) => this._loadStylesheetDep(dep));
|
||||||
return PromiseWrapper.all(promises)
|
return PromiseWrapper.all(promises)
|
||||||
.then((cssTexts) => {
|
.then((cssTexts) => {
|
||||||
var nestedCompileResultPromises = [];
|
var nestedCompileResultPromises: any[] /** TODO #9100 */ = [];
|
||||||
for (var i = 0; i < result.dependencies.length; i++) {
|
for (var i = 0; i < result.dependencies.length; i++) {
|
||||||
var dep = result.dependencies[i];
|
var dep = result.dependencies[i];
|
||||||
var cssText = cssTexts[i];
|
var cssText = cssTexts[i];
|
||||||
|
@ -202,7 +202,7 @@ class CompiledTemplate {
|
||||||
viewFactory: Function = null;
|
viewFactory: Function = null;
|
||||||
proxyViewFactory: Function;
|
proxyViewFactory: Function;
|
||||||
constructor() {
|
constructor() {
|
||||||
this.proxyViewFactory = (viewUtils, childInjector, contextEl) =>
|
this.proxyViewFactory = (viewUtils: any /** TODO #9100 */, childInjector: any /** TODO #9100 */, contextEl: any /** TODO #9100 */) =>
|
||||||
this.viewFactory(viewUtils, childInjector, contextEl);
|
this.viewFactory(viewUtils, childInjector, contextEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry {
|
||||||
typeName.split(',').forEach(tag => this.schema[tag] = type);
|
typeName.split(',').forEach(tag => this.schema[tag] = type);
|
||||||
var superType = this.schema[typeParts[1]];
|
var superType = this.schema[typeParts[1]];
|
||||||
if (isPresent(superType)) {
|
if (isPresent(superType)) {
|
||||||
StringMapWrapper.forEach(superType, (v, k) => type[k] = v);
|
StringMapWrapper.forEach(superType, (v: any /** TODO #9100 */, k: any /** TODO #9100 */) => type[k] = v);
|
||||||
}
|
}
|
||||||
properties.forEach((property: string) => {
|
properties.forEach((property: string) => {
|
||||||
if (property == '') {
|
if (property == '') {
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class CssSelector {
|
||||||
|
|
||||||
static parse(selector: string): CssSelector[] {
|
static parse(selector: string): CssSelector[] {
|
||||||
var results: CssSelector[] = [];
|
var results: CssSelector[] = [];
|
||||||
var _addResult = (res: CssSelector[], cssSel) => {
|
var _addResult = (res: CssSelector[], cssSel: any /** TODO #9100 */) => {
|
||||||
if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) &&
|
if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) &&
|
||||||
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
||||||
cssSel.element = "*";
|
cssSel.element = "*";
|
||||||
|
@ -42,7 +42,7 @@ export class CssSelector {
|
||||||
};
|
};
|
||||||
var cssSelector = new CssSelector();
|
var cssSelector = new CssSelector();
|
||||||
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
||||||
var match;
|
var match: any /** TODO #9100 */;
|
||||||
var current = cssSelector;
|
var current = cssSelector;
|
||||||
var inNot = false;
|
var inNot = false;
|
||||||
while (isPresent(match = RegExpMatcherWrapper.next(matcher))) {
|
while (isPresent(match = RegExpMatcherWrapper.next(matcher))) {
|
||||||
|
@ -159,7 +159,7 @@ export class SelectorMatcher {
|
||||||
private _listContexts: SelectorListContext[] = [];
|
private _listContexts: SelectorListContext[] = [];
|
||||||
|
|
||||||
addSelectables(cssSelectors: CssSelector[], callbackCtxt?: any) {
|
addSelectables(cssSelectors: CssSelector[], callbackCtxt?: any) {
|
||||||
var listContext = null;
|
var listContext: any /** TODO #9100 */ = null;
|
||||||
if (cssSelectors.length > 1) {
|
if (cssSelectors.length > 1) {
|
||||||
listContext = new SelectorListContext(cssSelectors);
|
listContext = new SelectorListContext(cssSelectors);
|
||||||
this._listContexts.push(listContext);
|
this._listContexts.push(listContext);
|
||||||
|
@ -308,7 +308,7 @@ export class SelectorMatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_matchTerminal(map: Map<string, SelectorContext[]>, name, cssSelector: CssSelector,
|
_matchTerminal(map: Map<string, SelectorContext[]>, name: any /** TODO #9100 */, cssSelector: CssSelector,
|
||||||
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -322,7 +322,7 @@ export class SelectorMatcher {
|
||||||
if (isBlank(selectables)) {
|
if (isBlank(selectables)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var selectable;
|
var selectable: any /** TODO #9100 */;
|
||||||
var result = false;
|
var result = false;
|
||||||
for (var index = 0; index < selectables.length; index++) {
|
for (var index = 0; index < selectables.length; index++) {
|
||||||
selectable = selectables[index];
|
selectable = selectables[index];
|
||||||
|
@ -332,8 +332,8 @@ export class SelectorMatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_matchPartial(map: Map<string, SelectorMatcher>, name, cssSelector: CssSelector,
|
_matchPartial(map: Map<string, SelectorMatcher>, name: any /** TODO #9100 */, cssSelector: CssSelector,
|
||||||
matchedCallback /*: (c: CssSelector, a: any) => void*/): boolean {
|
matchedCallback: any /** TODO #9100 */ /*: (c: CssSelector, a: any) => void*/): boolean {
|
||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ export class ShadowCss {
|
||||||
private _insertPolyfillDirectivesInCssText(cssText: string): string {
|
private _insertPolyfillDirectivesInCssText(cssText: string): string {
|
||||||
// Difference with webcomponents.js: does not handle comments
|
// Difference with webcomponents.js: does not handle comments
|
||||||
return StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe,
|
return StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe,
|
||||||
function(m) { return m[1] + '{'; });
|
function(m: any /** TODO #9100 */) { return m[1] + '{'; });
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -195,7 +195,7 @@ export class ShadowCss {
|
||||||
**/
|
**/
|
||||||
private _insertPolyfillRulesInCssText(cssText: string): string {
|
private _insertPolyfillRulesInCssText(cssText: string): string {
|
||||||
// Difference with webcomponents.js: does not handle comments
|
// Difference with webcomponents.js: does not handle comments
|
||||||
return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) {
|
return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m: any /** TODO #9100 */) {
|
||||||
var rule = m[0];
|
var rule = m[0];
|
||||||
rule = StringWrapper.replace(rule, m[1], '');
|
rule = StringWrapper.replace(rule, m[1], '');
|
||||||
rule = StringWrapper.replace(rule, m[2], '');
|
rule = StringWrapper.replace(rule, m[2], '');
|
||||||
|
@ -241,7 +241,7 @@ export class ShadowCss {
|
||||||
**/
|
**/
|
||||||
private _extractUnscopedRulesFromCssText(cssText: string): string {
|
private _extractUnscopedRulesFromCssText(cssText: string): string {
|
||||||
// Difference with webcomponents.js: does not handle comments
|
// Difference with webcomponents.js: does not handle comments
|
||||||
var r = '', m;
|
var r = '', m: any /** TODO #9100 */;
|
||||||
var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText);
|
var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText);
|
||||||
while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
|
while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
|
||||||
var rule = m[0];
|
var rule = m[0];
|
||||||
|
@ -285,9 +285,9 @@ export class ShadowCss {
|
||||||
|
|
||||||
private _convertColonRule(cssText: string, regExp: RegExp, partReplacer: Function): string {
|
private _convertColonRule(cssText: string, regExp: RegExp, partReplacer: Function): string {
|
||||||
// p1 = :host, p2 = contents of (), p3 rest of rule
|
// p1 = :host, p2 = contents of (), p3 rest of rule
|
||||||
return StringWrapper.replaceAllMapped(cssText, regExp, function(m) {
|
return StringWrapper.replaceAllMapped(cssText, regExp, function(m: any /** TODO #9100 */) {
|
||||||
if (isPresent(m[2])) {
|
if (isPresent(m[2])) {
|
||||||
var parts = m[2].split(','), r = [];
|
var parts = m[2].split(','), r: any[] /** TODO #9100 */ = [];
|
||||||
for (var i = 0; i < parts.length; i++) {
|
for (var i = 0; i < parts.length; i++) {
|
||||||
var p = parts[i];
|
var p = parts[i];
|
||||||
if (isBlank(p)) break;
|
if (isBlank(p)) break;
|
||||||
|
@ -341,7 +341,7 @@ export class ShadowCss {
|
||||||
|
|
||||||
private _scopeSelector(selector: string, scopeSelector: string, hostSelector: string,
|
private _scopeSelector(selector: string, scopeSelector: string, hostSelector: string,
|
||||||
strict: boolean): string {
|
strict: boolean): string {
|
||||||
var r = [], parts = selector.split(',');
|
var r: any[] /** TODO #9100 */ = [], parts = selector.split(',');
|
||||||
for (var i = 0; i < parts.length; i++) {
|
for (var i = 0; i < parts.length; i++) {
|
||||||
var p = parts[i].trim();
|
var p = parts[i].trim();
|
||||||
var deepParts = StringWrapper.split(p, _shadowDeepSelectors);
|
var deepParts = StringWrapper.split(p, _shadowDeepSelectors);
|
||||||
|
@ -392,7 +392,7 @@ export class ShadowCss {
|
||||||
// e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
|
// e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
|
||||||
private _applyStrictSelectorScope(selector: string, scopeSelector: string): string {
|
private _applyStrictSelectorScope(selector: string, scopeSelector: string): string {
|
||||||
var isRe = /\[is=([^\]]*)\]/g;
|
var isRe = /\[is=([^\]]*)\]/g;
|
||||||
scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (m) => m[1]);
|
scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (m: any /** TODO #9100 */) => m[1]);
|
||||||
var splits = [' ', '>', '+', '~'], scoped = selector, attrName = '[' + scopeSelector + ']';
|
var splits = [' ', '>', '+', '~'], scoped = selector, attrName = '[' + scopeSelector + ']';
|
||||||
for (var i = 0; i < splits.length; i++) {
|
for (var i = 0; i < splits.length; i++) {
|
||||||
var sep = splits[i];
|
var sep = splits[i];
|
||||||
|
@ -454,7 +454,7 @@ var _colonHostContextRe = /:host-context/gim;
|
||||||
var _commentRe = /\/\*[\s\S]*?\*\//g;
|
var _commentRe = /\/\*[\s\S]*?\*\//g;
|
||||||
|
|
||||||
function stripComments(input:string):string {
|
function stripComments(input:string):string {
|
||||||
return StringWrapper.replaceAllMapped(input, _commentRe, (_) => '');
|
return StringWrapper.replaceAllMapped(input, _commentRe, (_: any /** TODO #9100 */) => '');
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
||||||
|
@ -470,7 +470,7 @@ export class CssRule {
|
||||||
export function processRules(input:string, ruleCallback:Function):string {
|
export function processRules(input:string, ruleCallback:Function):string {
|
||||||
var inputWithEscapedBlocks = escapeBlocks(input);
|
var inputWithEscapedBlocks = escapeBlocks(input);
|
||||||
var nextBlockIndex = 0;
|
var nextBlockIndex = 0;
|
||||||
return StringWrapper.replaceAllMapped(inputWithEscapedBlocks.escapedString, _ruleRe, function(m) {
|
return StringWrapper.replaceAllMapped(inputWithEscapedBlocks.escapedString, _ruleRe, function(m: any /** TODO #9100 */) {
|
||||||
var selector = m[2];
|
var selector = m[2];
|
||||||
var content = '';
|
var content = '';
|
||||||
var suffix = m[4];
|
var suffix = m[4];
|
||||||
|
@ -491,10 +491,10 @@ class StringWithEscapedBlocks {
|
||||||
|
|
||||||
function escapeBlocks(input:string):StringWithEscapedBlocks {
|
function escapeBlocks(input:string):StringWithEscapedBlocks {
|
||||||
var inputParts = StringWrapper.split(input, _curlyRe);
|
var inputParts = StringWrapper.split(input, _curlyRe);
|
||||||
var resultParts = [];
|
var resultParts: any[] /** TODO #9100 */ = [];
|
||||||
var escapedBlocks = [];
|
var escapedBlocks: any[] /** TODO #9100 */ = [];
|
||||||
var bracketCount = 0;
|
var bracketCount = 0;
|
||||||
var currentBlockParts = [];
|
var currentBlockParts: any[] /** TODO #9100 */ = [];
|
||||||
for (var partIndex = 0; partIndex<inputParts.length; partIndex++) {
|
for (var partIndex = 0; partIndex<inputParts.length; partIndex++) {
|
||||||
var part = inputParts[partIndex];
|
var part = inputParts[partIndex];
|
||||||
if (part == CLOSE_CURLY) {
|
if (part == CLOSE_CURLY) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ export class StyleCompiler {
|
||||||
shim: boolean): StylesCompileResult {
|
shim: boolean): StylesCompileResult {
|
||||||
var styleExpressions =
|
var styleExpressions =
|
||||||
plainStyles.map(plainStyle => o.literal(this._shimIfNeeded(plainStyle, shim)));
|
plainStyles.map(plainStyle => o.literal(this._shimIfNeeded(plainStyle, shim)));
|
||||||
var dependencies = [];
|
var dependencies: any[] /** TODO #9100 */ = [];
|
||||||
for (var i = 0; i < absUrls.length; i++) {
|
for (var i = 0; i < absUrls.length; i++) {
|
||||||
var identifier = new CompileIdentifierMetadata({name: getStylesVarName(null)});
|
var identifier = new CompileIdentifierMetadata({name: getStylesVarName(null)});
|
||||||
dependencies.push(new StylesCompileDependency(absUrls[i], shim, identifier));
|
dependencies.push(new StylesCompileDependency(absUrls[i], shim, identifier));
|
||||||
|
|
|
@ -20,8 +20,8 @@ export function isStyleUrlResolvable(url: string): boolean {
|
||||||
*/
|
*/
|
||||||
export function extractStyleUrls(resolver: UrlResolver, baseUrl: string,
|
export function extractStyleUrls(resolver: UrlResolver, baseUrl: string,
|
||||||
cssText: string): StyleWithImports {
|
cssText: string): StyleWithImports {
|
||||||
var foundUrls = [];
|
var foundUrls: any[] /** TODO #9100 */ = [];
|
||||||
var modifiedCssText = StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m) => {
|
var modifiedCssText = StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m: any /** TODO #9100 */) => {
|
||||||
var url = isPresent(m[1]) ? m[1] : m[2];
|
var url = isPresent(m[1]) ? m[1] : m[2];
|
||||||
if (!isStyleUrlResolvable(url)) {
|
if (!isStyleUrlResolvable(url)) {
|
||||||
// Do not attempt to resolve non-package absolute URLs with URI scheme
|
// Do not attempt to resolve non-package absolute URLs with URI scheme
|
||||||
|
|
|
@ -244,7 +244,7 @@ export interface TemplateAstVisitor {
|
||||||
*/
|
*/
|
||||||
export function templateVisitAll(visitor: TemplateAstVisitor, asts: TemplateAst[],
|
export function templateVisitAll(visitor: TemplateAstVisitor, asts: TemplateAst[],
|
||||||
context: any = null): any[] {
|
context: any = null): any[] {
|
||||||
var result = [];
|
var result: any[] /** TODO #9100 */ = [];
|
||||||
asts.forEach(ast => {
|
asts.forEach(ast => {
|
||||||
var astResult = ast.visit(visitor, context);
|
var astResult = ast.visit(visitor, context);
|
||||||
if (isPresent(astResult)) {
|
if (isPresent(astResult)) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ export class TemplateParser {
|
||||||
templateUrl: string): TemplateParseResult {
|
templateUrl: string): TemplateParseResult {
|
||||||
var htmlAstWithErrors = this._htmlParser.parse(template, templateUrl);
|
var htmlAstWithErrors = this._htmlParser.parse(template, templateUrl);
|
||||||
var errors:ParseError[] = htmlAstWithErrors.errors;
|
var errors:ParseError[] = htmlAstWithErrors.errors;
|
||||||
var result;
|
var result: any /** TODO #???? */;
|
||||||
if (htmlAstWithErrors.rootNodes.length > 0) {
|
if (htmlAstWithErrors.rootNodes.length > 0) {
|
||||||
var uniqDirectives = <CompileDirectiveMetadata[]>removeDuplicates(directives);
|
var uniqDirectives = <CompileDirectiveMetadata[]>removeDuplicates(directives);
|
||||||
var uniqPipes = <CompilePipeMetadata[]>removeDuplicates(pipes);
|
var uniqPipes = <CompilePipeMetadata[]>removeDuplicates(pipes);
|
||||||
|
@ -170,10 +170,10 @@ export class TemplateParser {
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_assertNoReferenceDuplicationOnTemplate(result:any[], errors:TemplateParseError[]):void {
|
_assertNoReferenceDuplicationOnTemplate(result:any[], errors:TemplateParseError[]):void {
|
||||||
const existingReferences = [];
|
const existingReferences: any[] /** TODO #???? */ = [];
|
||||||
result
|
result
|
||||||
.filter(element => !!element.references)
|
.filter(element => !!element.references)
|
||||||
.forEach(element => element.references.forEach(reference=> {
|
.forEach(element => element.references.forEach((reference: any /** TODO #???? */)=> {
|
||||||
const name = reference.name;
|
const name = reference.name;
|
||||||
if (existingReferences.indexOf(name) < 0) {
|
if (existingReferences.indexOf(name) < 0) {
|
||||||
existingReferences.push(name);
|
existingReferences.push(name);
|
||||||
|
@ -335,7 +335,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
var templateElementVars: VariableAst[] = [];
|
var templateElementVars: VariableAst[] = [];
|
||||||
|
|
||||||
var hasInlineTemplates = false;
|
var hasInlineTemplates = false;
|
||||||
var attrs = [];
|
var attrs: any[] /** TODO #???? */ = [];
|
||||||
var lcElName = splitNsName(nodeName.toLowerCase())[1];
|
var lcElName = splitNsName(nodeName.toLowerCase())[1];
|
||||||
var isTemplateElement = lcElName == TEMPLATE_ELEMENT;
|
var isTemplateElement = lcElName == TEMPLATE_ELEMENT;
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
CssSelector.parse(preparsedElement.projectAs)[0] :
|
CssSelector.parse(preparsedElement.projectAs)[0] :
|
||||||
elementCssSelector;
|
elementCssSelector;
|
||||||
var ngContentIndex = parent.findNgContentIndex(projectionSelector);
|
var ngContentIndex = parent.findNgContentIndex(projectionSelector);
|
||||||
var parsedElement;
|
var parsedElement: any /** TODO #???? */;
|
||||||
|
|
||||||
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
||||||
if (isPresent(element.children) && element.children.length > 0) {
|
if (isPresent(element.children) && element.children.length > 0) {
|
||||||
|
@ -434,7 +434,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
private _parseInlineTemplateBinding(attr: HtmlAttrAst, targetMatchableAttrs: string[][],
|
private _parseInlineTemplateBinding(attr: HtmlAttrAst, targetMatchableAttrs: string[][],
|
||||||
targetProps: BoundElementOrDirectiveProperty[],
|
targetProps: BoundElementOrDirectiveProperty[],
|
||||||
targetVars: VariableAst[]): boolean {
|
targetVars: VariableAst[]): boolean {
|
||||||
var templateBindingsSource = null;
|
var templateBindingsSource: any /** TODO #???? */ = null;
|
||||||
if (attr.name == TEMPLATE_ATTR) {
|
if (attr.name == TEMPLATE_ATTR) {
|
||||||
templateBindingsSource = attr.value;
|
templateBindingsSource = attr.value;
|
||||||
} else if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
} else if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
||||||
|
@ -667,7 +667,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
elOrDirRef.sourceSpan);
|
elOrDirRef.sourceSpan);
|
||||||
};
|
};
|
||||||
} else if (isBlank(component)) {
|
} else if (isBlank(component)) {
|
||||||
var refToken = null;
|
var refToken: any /** TODO #???? */ = null;
|
||||||
if (isTemplateElement) {
|
if (isTemplateElement) {
|
||||||
refToken = identifierToken(Identifiers.TemplateRef);
|
refToken = identifierToken(Identifiers.TemplateRef);
|
||||||
}
|
}
|
||||||
|
@ -744,8 +744,8 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
|
|
||||||
private _createElementPropertyAst(elementName: string, name: string, ast: AST,
|
private _createElementPropertyAst(elementName: string, name: string, ast: AST,
|
||||||
sourceSpan: ParseSourceSpan): BoundElementPropertyAst {
|
sourceSpan: ParseSourceSpan): BoundElementPropertyAst {
|
||||||
var unit = null;
|
var unit: any /** TODO #???? */ = null;
|
||||||
var bindingType;
|
var bindingType: any /** TODO #???? */;
|
||||||
var boundPropertyName: string;
|
var boundPropertyName: string;
|
||||||
var parts = name.split(PROPERTY_PARTS_SEPARATOR);
|
var parts = name.split(PROPERTY_PARTS_SEPARATOR);
|
||||||
let securityContext: SecurityContext;
|
let securityContext: SecurityContext;
|
||||||
|
@ -837,7 +837,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
|
||||||
var allDirectiveEvents = new Set<string>();
|
var allDirectiveEvents = new Set<string>();
|
||||||
directives.forEach(directive => {
|
directives.forEach(directive => {
|
||||||
StringMapWrapper.forEach(directive.directive.outputs,
|
StringMapWrapper.forEach(directive.directive.outputs,
|
||||||
(eventName: string, _) => { allDirectiveEvents.add(eventName); });
|
(eventName: string, _: any /** TODO #???? */) => { allDirectiveEvents.add(eventName); });
|
||||||
});
|
});
|
||||||
events.forEach(event => {
|
events.forEach(event => {
|
||||||
if (isPresent(event.target) || !SetWrapper.has(allDirectiveEvents, event.name)) {
|
if (isPresent(event.target) || !SetWrapper.has(allDirectiveEvents, event.name)) {
|
||||||
|
@ -897,7 +897,7 @@ class ElementContext {
|
||||||
static create(isTemplateElement: boolean, directives: DirectiveAst[],
|
static create(isTemplateElement: boolean, directives: DirectiveAst[],
|
||||||
providerContext: ProviderElementContext): ElementContext {
|
providerContext: ProviderElementContext): ElementContext {
|
||||||
var matcher = new SelectorMatcher();
|
var matcher = new SelectorMatcher();
|
||||||
var wildcardNgContentIndex = null;
|
var wildcardNgContentIndex: any /** TODO #???? */ = null;
|
||||||
var component = directives.find(directive => directive.directive.isComponent);
|
var component = directives.find(directive => directive.directive.isComponent);
|
||||||
if (isPresent(component)) {
|
if (isPresent(component)) {
|
||||||
var ngContentSelectors = component.directive.template.ngContentSelectors;
|
var ngContentSelectors = component.directive.template.ngContentSelectors;
|
||||||
|
@ -917,7 +917,7 @@ class ElementContext {
|
||||||
public providerContext: ProviderElementContext) {}
|
public providerContext: ProviderElementContext) {}
|
||||||
|
|
||||||
findNgContentIndex(selector: CssSelector): number {
|
findNgContentIndex(selector: CssSelector): number {
|
||||||
var ngContentIndices = [];
|
var ngContentIndices: any[] /** TODO #???? */ = [];
|
||||||
this._ngContentIndexMatcher.match(
|
this._ngContentIndexMatcher.match(
|
||||||
selector, (selector, ngContentIndex) => { ngContentIndices.push(ngContentIndex); });
|
selector, (selector, ngContentIndex) => { ngContentIndices.push(ngContentIndex); });
|
||||||
ListWrapper.sort(ngContentIndices);
|
ListWrapper.sort(ngContentIndices);
|
||||||
|
@ -963,7 +963,7 @@ export class PipeCollector extends RecursiveAstVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeDuplicates(items: CompileMetadataWithType[]): CompileMetadataWithType[] {
|
function removeDuplicates(items: CompileMetadataWithType[]): CompileMetadataWithType[] {
|
||||||
let res = [];
|
let res: any[] /** TODO #???? */ = [];
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
let hasMatch =
|
let hasMatch =
|
||||||
res.filter(r => r.type.name == item.type.name && r.type.moduleUrl == item.type.moduleUrl &&
|
res.filter(r => r.type.name == item.type.name && r.type.moduleUrl == item.type.moduleUrl &&
|
||||||
|
|
|
@ -15,9 +15,9 @@ const NG_NON_BINDABLE_ATTR = 'ngNonBindable';
|
||||||
const NG_PROJECT_AS = 'ngProjectAs';
|
const NG_PROJECT_AS = 'ngProjectAs';
|
||||||
|
|
||||||
export function preparseElement(ast: HtmlElementAst): PreparsedElement {
|
export function preparseElement(ast: HtmlElementAst): PreparsedElement {
|
||||||
var selectAttr = null;
|
var selectAttr: any /** TODO #9100 */ = null;
|
||||||
var hrefAttr = null;
|
var hrefAttr: any /** TODO #9100 */ = null;
|
||||||
var relAttr = null;
|
var relAttr: any /** TODO #9100 */ = null;
|
||||||
var nonBindable = false;
|
var nonBindable = false;
|
||||||
var projectAs: string = null;
|
var projectAs: string = null;
|
||||||
ast.attrs.forEach(attr => {
|
ast.attrs.forEach(attr => {
|
||||||
|
|
|
@ -105,7 +105,7 @@ export function getUrlScheme(url: string): string {
|
||||||
function _buildFromEncodedParts(opt_scheme?: string, opt_userInfo?: string, opt_domain?: string,
|
function _buildFromEncodedParts(opt_scheme?: string, opt_userInfo?: string, opt_domain?: string,
|
||||||
opt_port?: string, opt_path?: string, opt_queryData?: string,
|
opt_port?: string, opt_path?: string, opt_queryData?: string,
|
||||||
opt_fragment?: string): string {
|
opt_fragment?: string): string {
|
||||||
var out = [];
|
var out: any[] /** TODO #9100 */ = [];
|
||||||
|
|
||||||
if (isPresent(opt_scheme)) {
|
if (isPresent(opt_scheme)) {
|
||||||
out.push(opt_scheme + ':');
|
out.push(opt_scheme + ':');
|
||||||
|
|
|
@ -16,12 +16,12 @@ var DASH_CASE_REGEXP = /-([a-z])/g;
|
||||||
|
|
||||||
export function camelCaseToDashCase(input: string): string {
|
export function camelCaseToDashCase(input: string): string {
|
||||||
return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP,
|
return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP,
|
||||||
(m) => { return '-' + m[1].toLowerCase(); });
|
(m: any /** TODO #9100 */) => { return '-' + m[1].toLowerCase(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dashCaseToCamelCase(input: string): string {
|
export function dashCaseToCamelCase(input: string): string {
|
||||||
return StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP,
|
return StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP,
|
||||||
(m) => { return m[1].toUpperCase(); });
|
(m: any /** TODO #9100 */) => { return m[1].toUpperCase(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function splitAtColon(input: string, defaultValues: string[]): string[] {
|
export function splitAtColon(input: string, defaultValues: string[]): string[] {
|
||||||
|
@ -63,7 +63,7 @@ export class ValueTransformer implements ValueVisitor {
|
||||||
visitStringMap(map: {[key: string]: any}, context: any): any {
|
visitStringMap(map: {[key: string]: any}, context: any): any {
|
||||||
var result = {};
|
var result = {};
|
||||||
StringMapWrapper.forEach(map,
|
StringMapWrapper.forEach(map,
|
||||||
(value, key) => { result[key] = visitValue(value, this, context); });
|
(value: any /** TODO #9100 */, key: any /** TODO #9100 */) => { (result as any /** TODO #9100 */)[key] = visitValue(value, this, context); });
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
visitPrimitive(value: any, context: any): any { return value; }
|
visitPrimitive(value: any, context: any): any { return value; }
|
||||||
|
|
|
@ -167,9 +167,9 @@ export class CompileElement extends CompileNode {
|
||||||
queriesWithReads,
|
queriesWithReads,
|
||||||
queriesForProvider.map(query => new _QueryWithRead(query, resolvedProvider.token)));
|
queriesForProvider.map(query => new _QueryWithRead(query, resolvedProvider.token)));
|
||||||
});
|
});
|
||||||
StringMapWrapper.forEach(this.referenceTokens, (_, varName) => {
|
StringMapWrapper.forEach(this.referenceTokens, (_: any /** TODO #9100 */, varName: any /** TODO #9100 */) => {
|
||||||
var token = this.referenceTokens[varName];
|
var token = this.referenceTokens[varName];
|
||||||
var varValue;
|
var varValue: any /** TODO #9100 */;
|
||||||
if (isPresent(token)) {
|
if (isPresent(token)) {
|
||||||
varValue = this._instances.get(token);
|
varValue = this._instances.get(token);
|
||||||
} else {
|
} else {
|
||||||
|
@ -282,7 +282,7 @@ export class CompileElement extends CompileNode {
|
||||||
|
|
||||||
private _getLocalDependency(requestingProviderType: ProviderAstType,
|
private _getLocalDependency(requestingProviderType: ProviderAstType,
|
||||||
dep: CompileDiDependencyMetadata): o.Expression {
|
dep: CompileDiDependencyMetadata): o.Expression {
|
||||||
var result = null;
|
var result: any /** TODO #9100 */ = null;
|
||||||
// constructor content query
|
// constructor content query
|
||||||
if (isBlank(result) && isPresent(dep.query)) {
|
if (isBlank(result) && isPresent(dep.query)) {
|
||||||
result = this._addQuery(dep.query, null).queryList;
|
result = this._addQuery(dep.query, null).queryList;
|
||||||
|
@ -319,7 +319,7 @@ export class CompileElement extends CompileNode {
|
||||||
private _getDependency(requestingProviderType: ProviderAstType,
|
private _getDependency(requestingProviderType: ProviderAstType,
|
||||||
dep: CompileDiDependencyMetadata): o.Expression {
|
dep: CompileDiDependencyMetadata): o.Expression {
|
||||||
var currElement: CompileElement = this;
|
var currElement: CompileElement = this;
|
||||||
var result = null;
|
var result: any /** TODO #9100 */ = null;
|
||||||
if (dep.isValue) {
|
if (dep.isValue) {
|
||||||
result = o.literal(dep.value);
|
result = o.literal(dep.value);
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ export class CompileElement extends CompileNode {
|
||||||
function createInjectInternalCondition(nodeIndex: number, childNodeCount: number,
|
function createInjectInternalCondition(nodeIndex: number, childNodeCount: number,
|
||||||
provider: ProviderAst,
|
provider: ProviderAst,
|
||||||
providerExpr: o.Expression): o.Statement {
|
providerExpr: o.Expression): o.Statement {
|
||||||
var indexCondition;
|
var indexCondition: any /** TODO #9100 */;
|
||||||
if (childNodeCount > 0) {
|
if (childNodeCount > 0) {
|
||||||
indexCondition = o.literal(nodeIndex)
|
indexCondition = o.literal(nodeIndex)
|
||||||
.lowerEquals(InjectMethodVars.requestNodeIndex)
|
.lowerEquals(InjectMethodVars.requestNodeIndex)
|
||||||
|
@ -364,8 +364,8 @@ function createProviderProperty(propName: string, provider: ProviderAst,
|
||||||
providerValueExpressions: o.Expression[], isMulti: boolean,
|
providerValueExpressions: o.Expression[], isMulti: boolean,
|
||||||
isEager: boolean, compileElement: CompileElement): o.Expression {
|
isEager: boolean, compileElement: CompileElement): o.Expression {
|
||||||
var view = compileElement.view;
|
var view = compileElement.view;
|
||||||
var resolvedProviderValueExpr;
|
var resolvedProviderValueExpr: any /** TODO #9100 */;
|
||||||
var type;
|
var type: any /** TODO #9100 */;
|
||||||
if (isMulti) {
|
if (isMulti) {
|
||||||
resolvedProviderValueExpr = o.literalArr(providerValueExpressions);
|
resolvedProviderValueExpr = o.literalArr(providerValueExpressions);
|
||||||
type = new o.ArrayType(o.DYNAMIC_TYPE);
|
type = new o.ArrayType(o.DYNAMIC_TYPE);
|
||||||
|
@ -410,9 +410,9 @@ class _ValueOutputAstTransformer extends ValueTransformer {
|
||||||
return o.literalArr(arr.map(value => visitValue(value, this, context)));
|
return o.literalArr(arr.map(value => visitValue(value, this, context)));
|
||||||
}
|
}
|
||||||
visitStringMap(map: {[key: string]: any}, context: any): o.Expression {
|
visitStringMap(map: {[key: string]: any}, context: any): o.Expression {
|
||||||
var entries = [];
|
var entries: any[] /** TODO #9100 */ = [];
|
||||||
StringMapWrapper.forEach(
|
StringMapWrapper.forEach(
|
||||||
map, (value, key) => { entries.push([key, visitValue(value, this, context)]); });
|
map, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => { entries.push([key, visitValue(value, this, context)]); });
|
||||||
return o.literalMap(entries);
|
return o.literalMap(entries);
|
||||||
}
|
}
|
||||||
visitPrimitive(value: any, context: any): o.Expression { return o.literal(value); }
|
visitPrimitive(value: any, context: any): o.Expression { return o.literal(value); }
|
||||||
|
|
|
@ -57,7 +57,7 @@ export class CompileQuery {
|
||||||
return !this._values.values.some(value => value instanceof ViewQueryValues);
|
return !this._values.values.some(value => value instanceof ViewQueryValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
afterChildren(targetStaticMethod, targetDynamicMethod: CompileMethod) {
|
afterChildren(targetStaticMethod: any /** TODO #9100 */, targetDynamicMethod: CompileMethod) {
|
||||||
var values = createQueryValues(this._values);
|
var values = createQueryValues(this._values);
|
||||||
var updateStmts = [this.queryList.callMethod('reset', [o.literalArr(values)]).toStmt()];
|
var updateStmts = [this.queryList.callMethod('reset', [o.literalArr(values)]).toStmt()];
|
||||||
if (isPresent(this.ownerDirectiveExpression)) {
|
if (isPresent(this.ownerDirectiveExpression)) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ export class CompileEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
listenToRenderer() {
|
listenToRenderer() {
|
||||||
var listenExpr;
|
var listenExpr: any /** TODO #9100 */;
|
||||||
var eventListener = o.THIS_EXPR.callMethod(
|
var eventListener = o.THIS_EXPR.callMethod(
|
||||||
'eventHandler',
|
'eventHandler',
|
||||||
[o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
|
[o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
|
||||||
|
@ -139,7 +139,7 @@ export function collectEventListeners(hostEvents: BoundEventAst[], dirs: Directi
|
||||||
|
|
||||||
export function bindDirectiveOutputs(directiveAst: DirectiveAst, directiveInstance: o.Expression,
|
export function bindDirectiveOutputs(directiveAst: DirectiveAst, directiveInstance: o.Expression,
|
||||||
eventListeners: CompileEventListener[]) {
|
eventListeners: CompileEventListener[]) {
|
||||||
StringMapWrapper.forEach(directiveAst.directive.outputs, (eventName, observablePropName) => {
|
StringMapWrapper.forEach(directiveAst.directive.outputs, (eventName: any /** TODO #9100 */, observablePropName: any /** TODO #9100 */) => {
|
||||||
eventListeners.filter(listener => listener.eventName == eventName)
|
eventListeners.filter(listener => listener.eventName == eventName)
|
||||||
.forEach(
|
.forEach(
|
||||||
(listener) => { listener.listenToDirective(directiveInstance, observablePropName); });
|
(listener) => { listener.listenToDirective(directiveInstance, observablePropName); });
|
||||||
|
|
|
@ -29,7 +29,7 @@ export function convertCdExpressionToIr(
|
||||||
export function convertCdStatementToIr(nameResolver: NameResolver, implicitReceiver: o.Expression,
|
export function convertCdStatementToIr(nameResolver: NameResolver, implicitReceiver: o.Expression,
|
||||||
stmt: cdAst.AST): o.Statement[] {
|
stmt: cdAst.AST): o.Statement[] {
|
||||||
var visitor = new _AstToIrVisitor(nameResolver, implicitReceiver, null);
|
var visitor = new _AstToIrVisitor(nameResolver, implicitReceiver, null);
|
||||||
var statements = [];
|
var statements: any[] /** TODO #9100 */ = [];
|
||||||
flattenStatements(stmt.visit(visitor, _Mode.Statement), statements);
|
flattenStatements(stmt.visit(visitor, _Mode.Statement), statements);
|
||||||
return statements;
|
return statements;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
|
||||||
private _valueUnwrapper: o.ReadVarExpr) {}
|
private _valueUnwrapper: o.ReadVarExpr) {}
|
||||||
|
|
||||||
visitBinary(ast: cdAst.Binary, mode: _Mode): any {
|
visitBinary(ast: cdAst.Binary, mode: _Mode): any {
|
||||||
var op;
|
var op: any /** TODO #9100 */;
|
||||||
switch (ast.operation) {
|
switch (ast.operation) {
|
||||||
case '+':
|
case '+':
|
||||||
op = o.BinaryOperator.Plus;
|
op = o.BinaryOperator.Plus;
|
||||||
|
@ -171,7 +171,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
|
||||||
mode, this._nameResolver.createLiteralArray(this.visitAll(ast.expressions, mode)));
|
mode, this._nameResolver.createLiteralArray(this.visitAll(ast.expressions, mode)));
|
||||||
}
|
}
|
||||||
visitLiteralMap(ast: cdAst.LiteralMap, mode: _Mode): any {
|
visitLiteralMap(ast: cdAst.LiteralMap, mode: _Mode): any {
|
||||||
var parts = [];
|
var parts: any[] /** TODO #9100 */ = [];
|
||||||
for (var i = 0; i < ast.keys.length; i++) {
|
for (var i = 0; i < ast.keys.length; i++) {
|
||||||
parts.push([ast.keys[i], ast.values[i].visit(this, _Mode.Expression)]);
|
parts.push([ast.keys[i], ast.values[i].visit(this, _Mode.Expression)]);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
|
||||||
}
|
}
|
||||||
visitMethodCall(ast: cdAst.MethodCall, mode: _Mode): any {
|
visitMethodCall(ast: cdAst.MethodCall, mode: _Mode): any {
|
||||||
var args = this.visitAll(ast.args, _Mode.Expression);
|
var args = this.visitAll(ast.args, _Mode.Expression);
|
||||||
var result = null;
|
var result: any /** TODO #9100 */ = null;
|
||||||
var receiver = ast.receiver.visit(this, _Mode.Expression);
|
var receiver = ast.receiver.visit(this, _Mode.Expression);
|
||||||
if (receiver === IMPLICIT_RECEIVER) {
|
if (receiver === IMPLICIT_RECEIVER) {
|
||||||
var varExpr = this._nameResolver.getLocal(ast.name);
|
var varExpr = this._nameResolver.getLocal(ast.name);
|
||||||
|
@ -201,7 +201,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
|
||||||
return convertToStatementIfNeeded(mode, o.not(ast.expression.visit(this, _Mode.Expression)));
|
return convertToStatementIfNeeded(mode, o.not(ast.expression.visit(this, _Mode.Expression)));
|
||||||
}
|
}
|
||||||
visitPropertyRead(ast: cdAst.PropertyRead, mode: _Mode): any {
|
visitPropertyRead(ast: cdAst.PropertyRead, mode: _Mode): any {
|
||||||
var result = null;
|
var result: any /** TODO #9100 */ = null;
|
||||||
var receiver = ast.receiver.visit(this, _Mode.Expression);
|
var receiver = ast.receiver.visit(this, _Mode.Expression);
|
||||||
if (receiver === IMPLICIT_RECEIVER) {
|
if (receiver === IMPLICIT_RECEIVER) {
|
||||||
result = this._nameResolver.getLocal(ast.name);
|
result = this._nameResolver.getLocal(ast.name);
|
||||||
|
|
|
@ -97,7 +97,7 @@ function bindAndWriteToRenderer(boundProps: BoundElementPropertyAst[], context:
|
||||||
var renderMethod: string;
|
var renderMethod: string;
|
||||||
var oldRenderValue: o.Expression = sanitizedValue(boundProp, fieldExpr);
|
var oldRenderValue: o.Expression = sanitizedValue(boundProp, fieldExpr);
|
||||||
var renderValue: o.Expression = sanitizedValue(boundProp, currValExpr);
|
var renderValue: o.Expression = sanitizedValue(boundProp, currValExpr);
|
||||||
var updateStmts = [];
|
var updateStmts: any[] /** TODO #9100 */ = [];
|
||||||
switch (boundProp.type) {
|
switch (boundProp.type) {
|
||||||
case PropertyBindingType.Property:
|
case PropertyBindingType.Property:
|
||||||
if (view.genConfig.logBindingUpdate) {
|
if (view.genConfig.logBindingUpdate) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ export function createDiTokenExpression(token: CompileTokenMetadata): o.Expressi
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createFlatArray(expressions: o.Expression[]): o.Expression {
|
export function createFlatArray(expressions: o.Expression[]): o.Expression {
|
||||||
var lastNonArrayExpressions = [];
|
var lastNonArrayExpressions: any[] /** TODO #9100 */ = [];
|
||||||
var result: o.Expression = o.literalArr([]);
|
var result: o.Expression = o.literalArr([]);
|
||||||
for (var i = 0; i < expressions.length; i++) {
|
for (var i = 0; i < expressions.length; i++) {
|
||||||
var expr = expressions[i];
|
var expr = expressions[i];
|
||||||
|
|
|
@ -179,7 +179,7 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||||
|
|
||||||
visitElement(ast: ElementAst, parent: CompileElement): any {
|
visitElement(ast: ElementAst, parent: CompileElement): any {
|
||||||
var nodeIndex = this.view.nodes.length;
|
var nodeIndex = this.view.nodes.length;
|
||||||
var createRenderNodeExpr;
|
var createRenderNodeExpr: any /** TODO #9100 */;
|
||||||
var debugContextExpr = this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast);
|
var debugContextExpr = this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast);
|
||||||
if (nodeIndex === 0 && this.view.viewType === ViewType.HOST) {
|
if (nodeIndex === 0 && this.view.viewType === ViewType.HOST) {
|
||||||
createRenderNodeExpr = o.THIS_EXPR.callMethod(
|
createRenderNodeExpr = o.THIS_EXPR.callMethod(
|
||||||
|
@ -234,7 +234,7 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||||
compileElement.afterChildren(this.view.nodes.length - nodeIndex - 1);
|
compileElement.afterChildren(this.view.nodes.length - nodeIndex - 1);
|
||||||
|
|
||||||
if (isPresent(compViewExpr)) {
|
if (isPresent(compViewExpr)) {
|
||||||
var codeGenContentNodes;
|
var codeGenContentNodes: any /** TODO #9100 */;
|
||||||
if (this.view.component.type.isHost) {
|
if (this.view.component.type.isHost) {
|
||||||
codeGenContentNodes = ViewProperties.projectableNodes;
|
codeGenContentNodes = ViewProperties.projectableNodes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -304,9 +304,9 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||||
function _mergeHtmlAndDirectiveAttrs(declaredHtmlAttrs: {[key: string]: string},
|
function _mergeHtmlAndDirectiveAttrs(declaredHtmlAttrs: {[key: string]: string},
|
||||||
directives: CompileDirectiveMetadata[]): string[][] {
|
directives: CompileDirectiveMetadata[]): string[][] {
|
||||||
var result: {[key: string]: string} = {};
|
var result: {[key: string]: string} = {};
|
||||||
StringMapWrapper.forEach(declaredHtmlAttrs, (value, key) => { result[key] = value; });
|
StringMapWrapper.forEach(declaredHtmlAttrs, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => { result[key] = value; });
|
||||||
directives.forEach(directiveMeta => {
|
directives.forEach(directiveMeta => {
|
||||||
StringMapWrapper.forEach(directiveMeta.hostAttributes, (value, name) => {
|
StringMapWrapper.forEach(directiveMeta.hostAttributes, (value: any /** TODO #9100 */, name: any /** TODO #9100 */) => {
|
||||||
var prevValue = result[name];
|
var prevValue = result[name];
|
||||||
result[name] = isPresent(prevValue) ? mergeAttributeValue(name, prevValue, value) : value;
|
result[name] = isPresent(prevValue) ? mergeAttributeValue(name, prevValue, value) : value;
|
||||||
});
|
});
|
||||||
|
@ -329,12 +329,12 @@ function mergeAttributeValue(attrName: string, attrValue1: string, attrValue2: s
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapToKeyValueArray(data: {[key: string]: string}): string[][] {
|
function mapToKeyValueArray(data: {[key: string]: string}): string[][] {
|
||||||
var entryArray = [];
|
var entryArray: any[] /** TODO #9100 */ = [];
|
||||||
StringMapWrapper.forEach(data, (value, name) => { entryArray.push([name, value]); });
|
StringMapWrapper.forEach(data, (value: any /** TODO #9100 */, name: any /** TODO #9100 */) => { entryArray.push([name, value]); });
|
||||||
// We need to sort to get a defined output order
|
// We need to sort to get a defined output order
|
||||||
// for tests and for caching generated artifacts...
|
// for tests and for caching generated artifacts...
|
||||||
ListWrapper.sort(entryArray, (entry1, entry2) => StringWrapper.compare(entry1[0], entry2[0]));
|
ListWrapper.sort(entryArray, (entry1, entry2) => StringWrapper.compare(entry1[0], entry2[0]));
|
||||||
var keyValueArray = [];
|
var keyValueArray: any[] /** TODO #9100 */ = [];
|
||||||
entryArray.forEach((entry) => { keyValueArray.push([entry[0], entry[1]]); });
|
entryArray.forEach((entry) => { keyValueArray.push([entry[0], entry[1]]); });
|
||||||
return keyValueArray;
|
return keyValueArray;
|
||||||
}
|
}
|
||||||
|
@ -369,13 +369,13 @@ function createStaticNodeDebugInfo(node: CompileNode): o.Expression {
|
||||||
var compileElement = node instanceof CompileElement ? node : null;
|
var compileElement = node instanceof CompileElement ? node : null;
|
||||||
var providerTokens: o.Expression[] = [];
|
var providerTokens: o.Expression[] = [];
|
||||||
var componentToken: o.Expression = o.NULL_EXPR;
|
var componentToken: o.Expression = o.NULL_EXPR;
|
||||||
var varTokenEntries = [];
|
var varTokenEntries: any[] /** TODO #9100 */ = [];
|
||||||
if (isPresent(compileElement)) {
|
if (isPresent(compileElement)) {
|
||||||
providerTokens = compileElement.getProviderTokens();
|
providerTokens = compileElement.getProviderTokens();
|
||||||
if (isPresent(compileElement.component)) {
|
if (isPresent(compileElement.component)) {
|
||||||
componentToken = createDiTokenExpression(identifierToken(compileElement.component.type));
|
componentToken = createDiTokenExpression(identifierToken(compileElement.component.type));
|
||||||
}
|
}
|
||||||
StringMapWrapper.forEach(compileElement.referenceTokens, (token, varName) => {
|
StringMapWrapper.forEach(compileElement.referenceTokens, (token: any /** TODO #9100 */, varName: any /** TODO #9100 */) => {
|
||||||
varTokenEntries.push(
|
varTokenEntries.push(
|
||||||
[varName, isPresent(token) ? createDiTokenExpression(token) : o.NULL_EXPR]);
|
[varName, isPresent(token) ? createDiTokenExpression(token) : o.NULL_EXPR]);
|
||||||
});
|
});
|
||||||
|
@ -446,8 +446,8 @@ function createViewFactory(view: CompileView, viewClass: o.ClassStmt,
|
||||||
new o.FnParam(ViewConstructorVars.parentInjector.name, o.importType(Identifiers.Injector)),
|
new o.FnParam(ViewConstructorVars.parentInjector.name, o.importType(Identifiers.Injector)),
|
||||||
new o.FnParam(ViewConstructorVars.declarationEl.name, o.importType(Identifiers.AppElement))
|
new o.FnParam(ViewConstructorVars.declarationEl.name, o.importType(Identifiers.AppElement))
|
||||||
];
|
];
|
||||||
var initRenderCompTypeStmts = [];
|
var initRenderCompTypeStmts: any[] /** TODO #9100 */ = [];
|
||||||
var templateUrlInfo;
|
var templateUrlInfo: any /** TODO #9100 */;
|
||||||
if (view.component.template.templateUrl == view.component.type.moduleUrl) {
|
if (view.component.template.templateUrl == view.component.type.moduleUrl) {
|
||||||
templateUrlInfo =
|
templateUrlInfo =
|
||||||
`${view.component.type.moduleUrl} class ${view.component.type.name} - inline template`;
|
`${view.component.type.moduleUrl} class ${view.component.type.name} - inline template`;
|
||||||
|
@ -483,7 +483,7 @@ function createViewFactory(view: CompileView, viewClass: o.ClassStmt,
|
||||||
|
|
||||||
function generateCreateMethod(view: CompileView): o.Statement[] {
|
function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||||
var parentRenderNodeExpr: o.Expression = o.NULL_EXPR;
|
var parentRenderNodeExpr: o.Expression = o.NULL_EXPR;
|
||||||
var parentRenderNodeStmts = [];
|
var parentRenderNodeStmts: any[] /** TODO #9100 */ = [];
|
||||||
if (view.viewType === ViewType.COMPONENT) {
|
if (view.viewType === ViewType.COMPONENT) {
|
||||||
parentRenderNodeExpr = ViewProperties.renderer.callMethod(
|
parentRenderNodeExpr = ViewProperties.renderer.callMethod(
|
||||||
'createViewRoot', [o.THIS_EXPR.prop('declarationAppElement').prop('nativeElement')]);
|
'createViewRoot', [o.THIS_EXPR.prop('declarationAppElement').prop('nativeElement')]);
|
||||||
|
@ -513,7 +513,7 @@ function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateDetectChangesMethod(view: CompileView): o.Statement[] {
|
function generateDetectChangesMethod(view: CompileView): o.Statement[] {
|
||||||
var stmts = [];
|
var stmts: any[] /** TODO #9100 */ = [];
|
||||||
if (view.detectChangesInInputsMethod.isEmpty() && view.updateContentQueriesMethod.isEmpty() &&
|
if (view.detectChangesInInputsMethod.isEmpty() && view.updateContentQueriesMethod.isEmpty() &&
|
||||||
view.afterContentLifecycleCallbacksMethod.isEmpty() &&
|
view.afterContentLifecycleCallbacksMethod.isEmpty() &&
|
||||||
view.detectChangesRenderPropertiesMethod.isEmpty() &&
|
view.detectChangesRenderPropertiesMethod.isEmpty() &&
|
||||||
|
@ -538,7 +538,7 @@ function generateDetectChangesMethod(view: CompileView): o.Statement[] {
|
||||||
stmts.push(new o.IfStmt(o.not(DetectChangesVars.throwOnChange), afterViewStmts));
|
stmts.push(new o.IfStmt(o.not(DetectChangesVars.throwOnChange), afterViewStmts));
|
||||||
}
|
}
|
||||||
|
|
||||||
var varStmts = [];
|
var varStmts: any[] /** TODO #9100 */ = [];
|
||||||
var readVars = o.findReadVarNames(stmts);
|
var readVars = o.findReadVarNames(stmts);
|
||||||
if (SetWrapper.has(readVars, DetectChangesVars.changed.name)) {
|
if (SetWrapper.has(readVars, DetectChangesVars.changed.name)) {
|
||||||
varStmts.push(DetectChangesVars.changed.set(o.literal(true)).toDeclStmt(o.BOOL_TYPE));
|
varStmts.push(DetectChangesVars.changed.set(o.literal(true)).toDeclStmt(o.BOOL_TYPE));
|
||||||
|
|
|
@ -22,9 +22,9 @@ export class ViewCompiler {
|
||||||
|
|
||||||
compileComponent(component: CompileDirectiveMetadata, template: TemplateAst[],
|
compileComponent(component: CompileDirectiveMetadata, template: TemplateAst[],
|
||||||
styles: o.Expression, pipes: CompilePipeMetadata[]): ViewCompileResult {
|
styles: o.Expression, pipes: CompilePipeMetadata[]): ViewCompileResult {
|
||||||
var dependencies = [];
|
var dependencies: any[] /** TODO #9100 */ = [];
|
||||||
var compiledAnimations = this._animationCompiler.compileComponent(component);
|
var compiledAnimations = this._animationCompiler.compileComponent(component);
|
||||||
var statements = [];
|
var statements: any[] /** TODO #9100 */ = [];
|
||||||
compiledAnimations.map(entry => {
|
compiledAnimations.map(entry => {
|
||||||
statements.push(entry.statesMapStatement);
|
statements.push(entry.statesMapStatement);
|
||||||
statements.push(entry.fnStatement);
|
statements.push(entry.fnStatement);
|
||||||
|
|
|
@ -25,7 +25,7 @@ import {CompileMetadataResolver} from '../../src/metadata_resolver';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('RuntimeAnimationCompiler', () => {
|
describe('RuntimeAnimationCompiler', () => {
|
||||||
var resolver;
|
var resolver: any /** TODO #9100 */;
|
||||||
beforeEach(inject([CompileMetadataResolver], (res: CompileMetadataResolver) => {
|
beforeEach(inject([CompileMetadataResolver], (res: CompileMetadataResolver) => {
|
||||||
resolver = res;
|
resolver = res;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -52,7 +52,7 @@ export function main() {
|
||||||
describe('parseAnimationEntry', () => {
|
describe('parseAnimationEntry', () => {
|
||||||
var combineStyles = (styles: AnimationStylesAst): {[key: string]: string | number} => {
|
var combineStyles = (styles: AnimationStylesAst): {[key: string]: string | number} => {
|
||||||
var flatStyles: {[key: string]: string | number} = {};
|
var flatStyles: {[key: string]: string | number} = {};
|
||||||
styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val, prop) => { flatStyles[prop] = val; }));
|
styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val: any /** TODO #9100 */, prop: any /** TODO #9100 */) => { flatStyles[prop] = val; }));
|
||||||
return flatStyles;
|
return flatStyles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ export function main() {
|
||||||
|
|
||||||
var collectStepStyles = (step: AnimationStepAst): Array<{[key: string]: string | number}> => {
|
var collectStepStyles = (step: AnimationStepAst): Array<{[key: string]: string | number}> => {
|
||||||
var keyframes = step.keyframes;
|
var keyframes = step.keyframes;
|
||||||
var styles = [];
|
var styles: any[] /** TODO #9100 */ = [];
|
||||||
if (step.startingStyles.styles.length > 0) {
|
if (step.startingStyles.styles.length > 0) {
|
||||||
styles.push(combineStyles(step.startingStyles));
|
styles.push(combineStyles(step.startingStyles));
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ export function main() {
|
||||||
return styles;
|
return styles;
|
||||||
};
|
};
|
||||||
|
|
||||||
var resolver;
|
var resolver: any /** TODO #9100 */;
|
||||||
beforeEach(inject([CompileMetadataResolver], (res: CompileMetadataResolver) => {
|
beforeEach(inject([CompileMetadataResolver], (res: CompileMetadataResolver) => {
|
||||||
resolver = res;
|
resolver = res;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -20,12 +20,12 @@ import {
|
||||||
} from '@angular/compiler/src/css/lexer';
|
} from '@angular/compiler/src/css/lexer';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function tokenize(code, trackComments: boolean = false,
|
function tokenize(code: any /** TODO #9100 */, trackComments: boolean = false,
|
||||||
mode: CssLexerMode = CssLexerMode.ALL): CssToken[] {
|
mode: CssLexerMode = CssLexerMode.ALL): CssToken[] {
|
||||||
var scanner = new CssLexer().scan(code, trackComments);
|
var scanner = new CssLexer().scan(code, trackComments);
|
||||||
scanner.setMode(mode);
|
scanner.setMode(mode);
|
||||||
|
|
||||||
var tokens = [];
|
var tokens: any[] /** TODO #9100 */ = [];
|
||||||
var output = scanner.scan();
|
var output = scanner.scan();
|
||||||
while (output != null) {
|
while (output != null) {
|
||||||
var error = output.error;
|
var error = output.error;
|
||||||
|
@ -280,7 +280,7 @@ export function main() {
|
||||||
it('should throw an error if a selector is being parsed while in the wrong mode', () => {
|
it('should throw an error if a selector is being parsed while in the wrong mode', () => {
|
||||||
var cssCode = ".class > tag";
|
var cssCode = ".class > tag";
|
||||||
|
|
||||||
var capturedMessage;
|
var capturedMessage: any /** TODO #9100 */;
|
||||||
try {
|
try {
|
||||||
tokenize(cssCode, false, CssLexerMode.STYLE_BLOCK);
|
tokenize(cssCode, false, CssLexerMode.STYLE_BLOCK);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -304,7 +304,7 @@ export function main() {
|
||||||
describe('Attribute Mode', () => {
|
describe('Attribute Mode', () => {
|
||||||
it('should consider attribute selectors as valid input and throw when an invalid modifier is used',
|
it('should consider attribute selectors as valid input and throw when an invalid modifier is used',
|
||||||
() => {
|
() => {
|
||||||
function tokenizeAttr(modifier) {
|
function tokenizeAttr(modifier: any /** TODO #9100 */) {
|
||||||
var cssCode = "value" + modifier + "='something'";
|
var cssCode = "value" + modifier + "='something'";
|
||||||
return tokenize(cssCode, false, CssLexerMode.ATTRIBUTE_SELECTOR);
|
return tokenize(cssCode, false, CssLexerMode.ATTRIBUTE_SELECTOR);
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ export function main() {
|
||||||
|
|
||||||
describe('Media Query Mode', () => {
|
describe('Media Query Mode', () => {
|
||||||
it('should validate media queries with a reduced subset of valid characters', () => {
|
it('should validate media queries with a reduced subset of valid characters', () => {
|
||||||
function tokenizeQuery(code) { return tokenize(code, false, CssLexerMode.MEDIA_QUERY); }
|
function tokenizeQuery(code: any /** TODO #9100 */) { return tokenize(code, false, CssLexerMode.MEDIA_QUERY); }
|
||||||
|
|
||||||
// the reason why the numbers are so high is because MediaQueries keep
|
// the reason why the numbers are so high is because MediaQueries keep
|
||||||
// track of the whitespace values
|
// track of the whitespace values
|
||||||
|
@ -341,7 +341,7 @@ export function main() {
|
||||||
describe('Pseudo Selector Mode', () => {
|
describe('Pseudo Selector Mode', () => {
|
||||||
it('should validate pseudo selector identifiers with a reduced subset of valid characters',
|
it('should validate pseudo selector identifiers with a reduced subset of valid characters',
|
||||||
() => {
|
() => {
|
||||||
function tokenizePseudo(code) {
|
function tokenizePseudo(code: any /** TODO #9100 */) {
|
||||||
return tokenize(code, false, CssLexerMode.PSEUDO_SELECTOR);
|
return tokenize(code, false, CssLexerMode.PSEUDO_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ export function main() {
|
||||||
describe('Pseudo Selector Mode', () => {
|
describe('Pseudo Selector Mode', () => {
|
||||||
it('should validate pseudo selector identifiers with a reduced subset of valid characters',
|
it('should validate pseudo selector identifiers with a reduced subset of valid characters',
|
||||||
() => {
|
() => {
|
||||||
function tokenizePseudo(code) {
|
function tokenizePseudo(code: any /** TODO #9100 */) {
|
||||||
return tokenize(code, false, CssLexerMode.PSEUDO_SELECTOR);
|
return tokenize(code, false, CssLexerMode.PSEUDO_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ export function main() {
|
||||||
|
|
||||||
describe('Style Block Mode', () => {
|
describe('Style Block Mode', () => {
|
||||||
it('should style blocks with a reduced subset of valid characters', () => {
|
it('should style blocks with a reduced subset of valid characters', () => {
|
||||||
function tokenizeStyles(code) { return tokenize(code, false, CssLexerMode.STYLE_BLOCK); }
|
function tokenizeStyles(code: any /** TODO #9100 */) { return tokenize(code, false, CssLexerMode.STYLE_BLOCK); }
|
||||||
|
|
||||||
expect(tokenizeStyles(`
|
expect(tokenizeStyles(`
|
||||||
key: value;
|
key: value;
|
||||||
|
|
|
@ -33,7 +33,7 @@ import {
|
||||||
|
|
||||||
import {CssLexer} from '@angular/compiler/src/css/lexer';
|
import {CssLexer} from '@angular/compiler/src/css/lexer';
|
||||||
|
|
||||||
export function assertTokens(tokens, valuesArr) {
|
export function assertTokens(tokens: any /** TODO #9100 */, valuesArr: any /** TODO #9100 */) {
|
||||||
for (var i = 0; i < tokens.length; i++) {
|
for (var i = 0; i < tokens.length; i++) {
|
||||||
expect(tokens[i].strValue == valuesArr[i]);
|
expect(tokens[i].strValue == valuesArr[i]);
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,14 @@ export function assertTokens(tokens, valuesArr) {
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('CssParser', () => {
|
describe('CssParser', () => {
|
||||||
function parse(css): ParsedCssResult {
|
function parse(css: any /** TODO #9100 */): ParsedCssResult {
|
||||||
var lexer = new CssLexer();
|
var lexer = new CssLexer();
|
||||||
var scanner = lexer.scan(css);
|
var scanner = lexer.scan(css);
|
||||||
var parser = new CssParser(scanner, 'some-fake-file-name.css');
|
var parser = new CssParser(scanner, 'some-fake-file-name.css');
|
||||||
return parser.parse();
|
return parser.parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeAST(css): CssStyleSheetAST {
|
function makeAST(css: any /** TODO #9100 */): CssStyleSheetAST {
|
||||||
var output = parse(css);
|
var output = parse(css);
|
||||||
var errors = output.errors;
|
var errors = output.errors;
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ import {
|
||||||
|
|
||||||
import {CssLexer} from '@angular/compiler/src/css/lexer';
|
import {CssLexer} from '@angular/compiler/src/css/lexer';
|
||||||
|
|
||||||
function _assertTokens(tokens, valuesArr) {
|
function _assertTokens(tokens: any /** TODO #9100 */, valuesArr: any /** TODO #9100 */) {
|
||||||
for (var i = 0; i < tokens.length; i++) {
|
for (var i = 0; i < tokens.length; i++) {
|
||||||
expect(tokens[i].strValue == valuesArr[i]);
|
expect(tokens[i].strValue == valuesArr[i]);
|
||||||
}
|
}
|
||||||
|
@ -46,16 +46,16 @@ function _assertTokens(tokens, valuesArr) {
|
||||||
class MyVisitor implements CssASTVisitor {
|
class MyVisitor implements CssASTVisitor {
|
||||||
captures: {[key: string]: any[]} = {};
|
captures: {[key: string]: any[]} = {};
|
||||||
|
|
||||||
_capture(method, ast, context) {
|
_capture(method: any /** TODO #9100 */, ast: any /** TODO #9100 */, context: any /** TODO #9100 */) {
|
||||||
this.captures[method] = isPresent(this.captures[method]) ? this.captures[method] : [];
|
this.captures[method] = isPresent(this.captures[method]) ? this.captures[method] : [];
|
||||||
this.captures[method].push([ast, context]);
|
this.captures[method].push([ast, context]);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(ast: CssStyleSheetAST, context?: any) { ast.visit(this, context); }
|
constructor(ast: CssStyleSheetAST, context?: any) { ast.visit(this, context); }
|
||||||
|
|
||||||
visitCssValue(ast, context?: any): void { this._capture("visitCssValue", ast, context); }
|
visitCssValue(ast: any /** TODO #9100 */, context?: any): void { this._capture("visitCssValue", ast, context); }
|
||||||
|
|
||||||
visitInlineCssRule(ast, context?: any): void {
|
visitInlineCssRule(ast: any /** TODO #9100 */, context?: any): void {
|
||||||
this._capture("visitInlineCssRule", ast, context);
|
this._capture("visitInlineCssRule", ast, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ export function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('CSS parsing and visiting', () => {
|
describe('CSS parsing and visiting', () => {
|
||||||
var ast;
|
var ast: any /** TODO #9100 */;
|
||||||
var context = {};
|
var context = {};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -113,7 +113,7 @@ export function main() {
|
||||||
class DirectiveNoHooks {}
|
class DirectiveNoHooks {}
|
||||||
|
|
||||||
class DirectiveWithOnChangesMethod {
|
class DirectiveWithOnChangesMethod {
|
||||||
ngOnChanges(_) {}
|
ngOnChanges(_: any /** TODO #9100 */) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DirectiveWithOnInitMethod {
|
class DirectiveWithOnInitMethod {
|
||||||
|
|
|
@ -36,7 +36,7 @@ export function main() {
|
||||||
describe('inline template', () => {
|
describe('inline template', () => {
|
||||||
it('should store the template',
|
it('should store the template',
|
||||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||||
(async, normalizer: DirectiveNormalizer) => {
|
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
encapsulation: null,
|
encapsulation: null,
|
||||||
template: 'a',
|
template: 'a',
|
||||||
|
@ -53,7 +53,7 @@ export function main() {
|
||||||
|
|
||||||
it('should resolve styles on the annotation against the moduleUrl',
|
it('should resolve styles on the annotation against the moduleUrl',
|
||||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||||
(async, normalizer: DirectiveNormalizer) => {
|
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
encapsulation: null,
|
encapsulation: null,
|
||||||
template: '',
|
template: '',
|
||||||
|
@ -69,7 +69,7 @@ export function main() {
|
||||||
|
|
||||||
it('should resolve styles in the template against the moduleUrl',
|
it('should resolve styles in the template against the moduleUrl',
|
||||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||||
(async, normalizer: DirectiveNormalizer) => {
|
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
encapsulation: null,
|
encapsulation: null,
|
||||||
template: '<style>@import test.css</style>',
|
template: '<style>@import test.css</style>',
|
||||||
|
@ -85,7 +85,7 @@ export function main() {
|
||||||
|
|
||||||
it('should use ViewEncapsulation.Emulated by default',
|
it('should use ViewEncapsulation.Emulated by default',
|
||||||
inject([AsyncTestCompleter, DirectiveNormalizer],
|
inject([AsyncTestCompleter, DirectiveNormalizer],
|
||||||
(async, normalizer: DirectiveNormalizer) => {
|
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
encapsulation: null,
|
encapsulation: null,
|
||||||
template: '',
|
template: '',
|
||||||
|
@ -101,7 +101,7 @@ export function main() {
|
||||||
|
|
||||||
it('should use default encapsulation provided by CompilerConfig',
|
it('should use default encapsulation provided by CompilerConfig',
|
||||||
inject([AsyncTestCompleter, CompilerConfig , DirectiveNormalizer],
|
inject([AsyncTestCompleter, CompilerConfig , DirectiveNormalizer],
|
||||||
(async, config: CompilerConfig, normalizer: DirectiveNormalizer) => {
|
(async: any /** TODO #9100 */, config: CompilerConfig, normalizer: DirectiveNormalizer) => {
|
||||||
config.defaultEncapsulation = ViewEncapsulation.None;
|
config.defaultEncapsulation = ViewEncapsulation.None;
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
encapsulation: null,
|
encapsulation: null,
|
||||||
|
@ -121,7 +121,7 @@ export function main() {
|
||||||
|
|
||||||
it('should load a template from a url that is resolved against moduleUrl',
|
it('should load a template from a url that is resolved against moduleUrl',
|
||||||
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
|
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
|
||||||
(async, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
|
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
|
||||||
xhr.expect('package:some/module/sometplurl.html', 'a');
|
xhr.expect('package:some/module/sometplurl.html', 'a');
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
encapsulation: null,
|
encapsulation: null,
|
||||||
|
@ -141,7 +141,7 @@ export function main() {
|
||||||
|
|
||||||
it('should resolve styles on the annotation against the moduleUrl',
|
it('should resolve styles on the annotation against the moduleUrl',
|
||||||
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
|
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
|
||||||
(async, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
|
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
|
||||||
xhr.expect('package:some/module/tpl/sometplurl.html', '');
|
xhr.expect('package:some/module/tpl/sometplurl.html', '');
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
encapsulation: null,
|
encapsulation: null,
|
||||||
|
@ -159,7 +159,7 @@ export function main() {
|
||||||
|
|
||||||
it('should resolve styles in the template against the templateUrl',
|
it('should resolve styles in the template against the templateUrl',
|
||||||
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
|
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
|
||||||
(async, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
|
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
|
||||||
xhr.expect('package:some/module/tpl/sometplurl.html',
|
xhr.expect('package:some/module/tpl/sometplurl.html',
|
||||||
'<style>@import test.css</style>');
|
'<style>@import test.css</style>');
|
||||||
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
|
||||||
|
|
|
@ -27,22 +27,22 @@ class SomeChildDirective extends SomeDirective {
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', inputs: ['c']})
|
@Directive({selector: 'someDirective', inputs: ['c']})
|
||||||
class SomeDirectiveWithInputs {
|
class SomeDirectiveWithInputs {
|
||||||
@Input() a;
|
@Input() a: any /** TODO #9100 */;
|
||||||
@Input("renamed") b;
|
@Input("renamed") b: any /** TODO #9100 */;
|
||||||
c;
|
c: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', outputs: ['c']})
|
@Directive({selector: 'someDirective', outputs: ['c']})
|
||||||
class SomeDirectiveWithOutputs {
|
class SomeDirectiveWithOutputs {
|
||||||
@Output() a;
|
@Output() a: any /** TODO #9100 */;
|
||||||
@Output("renamed") b;
|
@Output("renamed") b: any /** TODO #9100 */;
|
||||||
c;
|
c: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', outputs: ['a']})
|
@Directive({selector: 'someDirective', outputs: ['a']})
|
||||||
class SomeDirectiveWithDuplicateOutputs {
|
class SomeDirectiveWithDuplicateOutputs {
|
||||||
@Output() a;
|
@Output() a: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', properties: ['a']})
|
@Directive({selector: 'someDirective', properties: ['a']})
|
||||||
|
@ -56,23 +56,23 @@ class SomeDirectiveWithEvents {
|
||||||
@Directive({selector: 'someDirective'})
|
@Directive({selector: 'someDirective'})
|
||||||
class SomeDirectiveWithSetterProps {
|
class SomeDirectiveWithSetterProps {
|
||||||
@Input("renamed")
|
@Input("renamed")
|
||||||
set a(value) {
|
set a(value: any /** TODO #9100 */) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective'})
|
@Directive({selector: 'someDirective'})
|
||||||
class SomeDirectiveWithGetterOutputs {
|
class SomeDirectiveWithGetterOutputs {
|
||||||
@Output("renamed")
|
@Output("renamed")
|
||||||
get a() {
|
get a(): any /** TODO #9100 */ {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', host: {'[c]': 'c'}})
|
@Directive({selector: 'someDirective', host: {'[c]': 'c'}})
|
||||||
class SomeDirectiveWithHostBindings {
|
class SomeDirectiveWithHostBindings {
|
||||||
@HostBinding() a;
|
@HostBinding() a: any /** TODO #9100 */;
|
||||||
@HostBinding("renamed") b;
|
@HostBinding("renamed") b: any /** TODO #9100 */;
|
||||||
c;
|
c: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', host: {'(c)': 'onC()'}})
|
@Directive({selector: 'someDirective', host: {'(c)': 'onC()'}})
|
||||||
|
@ -81,32 +81,32 @@ class SomeDirectiveWithHostListeners {
|
||||||
onA() {
|
onA() {
|
||||||
}
|
}
|
||||||
@HostListener('b', ['$event.value'])
|
@HostListener('b', ['$event.value'])
|
||||||
onB(value) {
|
onB(value: any /** TODO #9100 */) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', queries: {"cs": new ContentChildren("c")}})
|
@Directive({selector: 'someDirective', queries: {"cs": new ContentChildren("c")}})
|
||||||
class SomeDirectiveWithContentChildren {
|
class SomeDirectiveWithContentChildren {
|
||||||
@ContentChildren("a") as: any;
|
@ContentChildren("a") as: any;
|
||||||
c;
|
c: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', queries: {"cs": new ViewChildren("c")}})
|
@Directive({selector: 'someDirective', queries: {"cs": new ViewChildren("c")}})
|
||||||
class SomeDirectiveWithViewChildren {
|
class SomeDirectiveWithViewChildren {
|
||||||
@ViewChildren("a") as: any;
|
@ViewChildren("a") as: any;
|
||||||
c;
|
c: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', queries: {"c": new ContentChild("c")}})
|
@Directive({selector: 'someDirective', queries: {"c": new ContentChild("c")}})
|
||||||
class SomeDirectiveWithContentChild {
|
class SomeDirectiveWithContentChild {
|
||||||
@ContentChild("a") a: any;
|
@ContentChild("a") a: any;
|
||||||
c;
|
c: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: 'someDirective', queries: {"c": new ViewChild("c")}})
|
@Directive({selector: 'someDirective', queries: {"c": new ViewChild("c")}})
|
||||||
class SomeDirectiveWithViewChild {
|
class SomeDirectiveWithViewChild {
|
||||||
@ViewChild("a") a: any;
|
@ViewChild("a") a: any;
|
||||||
c;
|
c: any /** TODO #9100 */;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SomeDirectiveWithoutMetadata {}
|
class SomeDirectiveWithoutMetadata {}
|
||||||
|
|
|
@ -8,41 +8,41 @@ function lex(text: string): any[] {
|
||||||
return new Lexer().tokenize(text);
|
return new Lexer().tokenize(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectToken(token, index) {
|
function expectToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */) {
|
||||||
expect(token instanceof Token).toBe(true);
|
expect(token instanceof Token).toBe(true);
|
||||||
expect(token.index).toEqual(index);
|
expect(token.index).toEqual(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectCharacterToken(token, index, character) {
|
function expectCharacterToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, character: any /** TODO #9100 */) {
|
||||||
expect(character.length).toBe(1);
|
expect(character.length).toBe(1);
|
||||||
expectToken(token, index);
|
expectToken(token, index);
|
||||||
expect(token.isCharacter(StringWrapper.charCodeAt(character, 0))).toBe(true);
|
expect(token.isCharacter(StringWrapper.charCodeAt(character, 0))).toBe(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectOperatorToken(token, index, operator) {
|
function expectOperatorToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, operator: any /** TODO #9100 */) {
|
||||||
expectToken(token, index);
|
expectToken(token, index);
|
||||||
expect(token.isOperator(operator)).toBe(true);
|
expect(token.isOperator(operator)).toBe(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectNumberToken(token, index, n) {
|
function expectNumberToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, n: any /** TODO #9100 */) {
|
||||||
expectToken(token, index);
|
expectToken(token, index);
|
||||||
expect(token.isNumber()).toBe(true);
|
expect(token.isNumber()).toBe(true);
|
||||||
expect(token.toNumber()).toEqual(n);
|
expect(token.toNumber()).toEqual(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectStringToken(token, index, str) {
|
function expectStringToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, str: any /** TODO #9100 */) {
|
||||||
expectToken(token, index);
|
expectToken(token, index);
|
||||||
expect(token.isString()).toBe(true);
|
expect(token.isString()).toBe(true);
|
||||||
expect(token.toString()).toEqual(str);
|
expect(token.toString()).toEqual(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectIdentifierToken(token, index, identifier) {
|
function expectIdentifierToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, identifier: any /** TODO #9100 */) {
|
||||||
expectToken(token, index);
|
expectToken(token, index);
|
||||||
expect(token.isIdentifier()).toBe(true);
|
expect(token.isIdentifier()).toBe(true);
|
||||||
expect(token.toString()).toEqual(identifier);
|
expect(token.toString()).toEqual(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectKeywordToken(token, index, keyword) {
|
function expectKeywordToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, keyword: any /** TODO #9100 */) {
|
||||||
expectToken(token, index);
|
expectToken(token, index);
|
||||||
expect(token.isKeyword()).toBe(true);
|
expect(token.isKeyword()).toBe(true);
|
||||||
expect(token.toString()).toEqual(keyword);
|
expect(token.toString()).toEqual(keyword);
|
||||||
|
|
|
@ -8,23 +8,23 @@ import {BindingPipe, LiteralPrimitive, AST} from '@angular/compiler/src/expressi
|
||||||
export function main() {
|
export function main() {
|
||||||
function createParser() { return new Parser(new Lexer()); }
|
function createParser() { return new Parser(new Lexer()); }
|
||||||
|
|
||||||
function parseAction(text, location = null): any {
|
function parseAction(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
|
||||||
return createParser().parseAction(text, location);
|
return createParser().parseAction(text, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseBinding(text, location = null): any {
|
function parseBinding(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
|
||||||
return createParser().parseBinding(text, location);
|
return createParser().parseBinding(text, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTemplateBindings(text, location = null): any {
|
function parseTemplateBindings(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
|
||||||
return createParser().parseTemplateBindings(text, location).templateBindings;
|
return createParser().parseTemplateBindings(text, location).templateBindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseInterpolation(text, location = null): any {
|
function parseInterpolation(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
|
||||||
return createParser().parseInterpolation(text, location);
|
return createParser().parseInterpolation(text, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseSimpleBinding(text, location = null): any {
|
function parseSimpleBinding(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
|
||||||
return createParser().parseSimpleBinding(text, location);
|
return createParser().parseSimpleBinding(text, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ export function main() {
|
||||||
expect(unparse(ast)).toEqual(expected);
|
expect(unparse(ast)).toEqual(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectActionError(text) { return expect(() => parseAction(text)); }
|
function expectActionError(text: any /** TODO #9100 */) { return expect(() => parseAction(text)); }
|
||||||
|
|
||||||
function expectBindingError(text) { return expect(() => parseBinding(text)); }
|
function expectBindingError(text: any /** TODO #9100 */) { return expect(() => parseBinding(text)); }
|
||||||
|
|
||||||
describe("parser", () => {
|
describe("parser", () => {
|
||||||
describe("parseAction", () => {
|
describe("parseAction", () => {
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function main() {
|
||||||
let htmlParser = new HtmlParser();
|
let htmlParser = new HtmlParser();
|
||||||
|
|
||||||
let msgs = '';
|
let msgs = '';
|
||||||
StringMapWrapper.forEach(messages, (v, k) => msgs += `<msg id="${k}">${v}</msg>`);
|
StringMapWrapper.forEach(messages, (v: any /** TODO #9100 */, k: any /** TODO #9100 */) => msgs += `<msg id="${k}">${v}</msg>`);
|
||||||
let res = deserializeXmb(`<message-bundle>${msgs}</message-bundle>`, 'someUrl');
|
let res = deserializeXmb(`<message-bundle>${msgs}</message-bundle>`, 'someUrl');
|
||||||
|
|
||||||
return new I18nHtmlParser(htmlParser, parser, res.content, res.messages, implicitTags,
|
return new I18nHtmlParser(htmlParser, parser, res.content, res.messages, implicitTags,
|
||||||
|
|
|
@ -43,7 +43,7 @@ export function main() {
|
||||||
var injector: Injector;
|
var injector: Injector;
|
||||||
var sharedStylesHost: SharedStylesHost;
|
var sharedStylesHost: SharedStylesHost;
|
||||||
|
|
||||||
beforeEach(inject([Injector, SharedStylesHost], (_injector, _sharedStylesHost) => {
|
beforeEach(inject([Injector, SharedStylesHost], (_injector: any /** TODO #9100 */, _sharedStylesHost: any /** TODO #9100 */) => {
|
||||||
injector = _injector;
|
injector = _injector;
|
||||||
sharedStylesHost = _sharedStylesHost;
|
sharedStylesHost = _sharedStylesHost;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -26,7 +26,7 @@ import {
|
||||||
|
|
||||||
export function
|
export function
|
||||||
main() {
|
main() {
|
||||||
var outputDefs = [];
|
var outputDefs: any[] /** TODO #9100 */ = [];
|
||||||
outputDefs.push({
|
outputDefs.push({
|
||||||
'getExpressions': () => interpretStatements(codegenStmts, 'getExpressions',
|
'getExpressions': () => interpretStatements(codegenStmts, 'getExpressions',
|
||||||
new DynamicClassInstanceFactory()),
|
new DynamicClassInstanceFactory()),
|
||||||
|
@ -50,7 +50,7 @@ import {
|
||||||
describe('output emitter', () => {
|
describe('output emitter', () => {
|
||||||
outputDefs.forEach((outputDef) => {
|
outputDefs.forEach((outputDef) => {
|
||||||
describe(`${outputDef['name']}`, () => {
|
describe(`${outputDef['name']}`, () => {
|
||||||
var expressions;
|
var expressions: any /** TODO #9100 */;
|
||||||
beforeEach(() => { expressions = outputDef['getExpressions']()(); });
|
beforeEach(() => { expressions = outputDef['getExpressions']()(); });
|
||||||
|
|
||||||
it('should support literals', () => {
|
it('should support literals', () => {
|
||||||
|
@ -116,8 +116,8 @@ import {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('operators', () => {
|
describe('operators', () => {
|
||||||
var ops;
|
var ops: any /** TODO #9100 */;
|
||||||
var aObj, bObj;
|
var aObj: any /** TODO #9100 */, bObj: any /** TODO #9100 */;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
ops = expressions['operators'];
|
ops = expressions['operators'];
|
||||||
aObj = new Object();
|
aObj = new Object();
|
||||||
|
|
|
@ -10,7 +10,7 @@ import * as o from '@angular/compiler/src/output/output_ast';
|
||||||
export class ExternalClass {
|
export class ExternalClass {
|
||||||
changeable: any;
|
changeable: any;
|
||||||
constructor(public data: any) { this.changeable = data; }
|
constructor(public data: any) { this.changeable = data; }
|
||||||
someMethod(a) { return {'param': a, 'data': this.data}; }
|
someMethod(a: any /** TODO #9100 */) { return {'param': a, 'data': this.data}; }
|
||||||
}
|
}
|
||||||
|
|
||||||
var testDataIdentifier = new CompileIdentifierMetadata({
|
var testDataIdentifier = new CompileIdentifierMetadata({
|
||||||
|
@ -271,5 +271,5 @@ class _InterpretiveDynamicClass extends ExternalClass implements DynamicInstance
|
||||||
public getters: Map<string, Function>, public methods: Map<string, Function>) {
|
public getters: Map<string, Function>, public methods: Map<string, Function>) {
|
||||||
super(args[0]);
|
super(args[0]);
|
||||||
}
|
}
|
||||||
childMethod(a) { return this.methods.get('childMethod')(a); }
|
childMethod(a: any /** TODO #9100 */) { return this.methods.get('childMethod')(a); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,16 @@ import {isString, isPresent} from '../../src/facade/lang';
|
||||||
|
|
||||||
const SVG_PREFIX = ':svg:';
|
const SVG_PREFIX = ':svg:';
|
||||||
|
|
||||||
var document = typeof global['document'] == 'object' ? global['document'] : null;
|
var document = typeof (global as any /** TODO #???? */)['document'] == 'object' ? (global as any /** TODO #???? */)['document'] : null;
|
||||||
|
|
||||||
export function extractSchema(): Map<string, string[]> {
|
export function extractSchema(): Map<string, string[]> {
|
||||||
var SVGGraphicsElement = global['SVGGraphicsElement'];
|
var SVGGraphicsElement = (global as any /** TODO #???? */)['SVGGraphicsElement'];
|
||||||
var SVGAnimationElement = global['SVGAnimationElement'];
|
var SVGAnimationElement = (global as any /** TODO #???? */)['SVGAnimationElement'];
|
||||||
var SVGGeometryElement = global['SVGGeometryElement'];
|
var SVGGeometryElement = (global as any /** TODO #???? */)['SVGGeometryElement'];
|
||||||
var SVGComponentTransferFunctionElement = global['SVGComponentTransferFunctionElement'];
|
var SVGComponentTransferFunctionElement = (global as any /** TODO #???? */)['SVGComponentTransferFunctionElement'];
|
||||||
var SVGGradientElement = global['SVGGradientElement'];
|
var SVGGradientElement = (global as any /** TODO #???? */)['SVGGradientElement'];
|
||||||
var SVGTextContentElement = global['SVGTextContentElement'];
|
var SVGTextContentElement = (global as any /** TODO #???? */)['SVGTextContentElement'];
|
||||||
var SVGTextPositioningElement = global['SVGTextPositioningElement'];
|
var SVGTextPositioningElement = (global as any /** TODO #???? */)['SVGTextPositioningElement'];
|
||||||
if (!document || !SVGGraphicsElement) return null;
|
if (!document || !SVGGraphicsElement) return null;
|
||||||
var descMap: Map<string, string[]> = new Map();
|
var descMap: Map<string, string[]> = new Map();
|
||||||
var visited: {[name: string]: boolean} = {};
|
var visited: {[name: string]: boolean} = {};
|
||||||
|
@ -44,7 +44,7 @@ export function extractSchema(): Map<string, string[]> {
|
||||||
var keys = Object.getOwnPropertyNames(window).filter(
|
var keys = Object.getOwnPropertyNames(window).filter(
|
||||||
k => k.endsWith('Element') && (k.startsWith('HTML') || k.startsWith('SVG')));
|
k => k.endsWith('Element') && (k.startsWith('HTML') || k.startsWith('SVG')));
|
||||||
keys.sort();
|
keys.sort();
|
||||||
keys.forEach(name => extractRecursiveProperties(visited, descMap, window[name]));
|
keys.forEach(name => extractRecursiveProperties(visited, descMap, (window as any /** TODO #???? */)[name]));
|
||||||
|
|
||||||
return descMap;
|
return descMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {el} from '@angular/platform-browser/testing';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('SelectorMatcher', () => {
|
describe('SelectorMatcher', () => {
|
||||||
var matcher, selectableCollector, s1, s2, s3, s4;
|
var matcher: any /** TODO #9100 */, selectableCollector: any /** TODO #9100 */, s1: any /** TODO #9100 */, s2: any /** TODO #9100 */, s3: any /** TODO #9100 */, s4: any /** TODO #9100 */;
|
||||||
var matched: any[];
|
var matched: any[];
|
||||||
|
|
||||||
function reset() { matched = []; }
|
function reset() { matched = []; }
|
||||||
|
@ -14,7 +14,7 @@ export function main() {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
reset();
|
reset();
|
||||||
s1 = s2 = s3 = s4 = null;
|
s1 = s2 = s3 = s4 = null;
|
||||||
selectableCollector = (selector, context) => {
|
selectableCollector = (selector: any /** TODO #9100 */, context: any /** TODO #9100 */) => {
|
||||||
matched.push(selector);
|
matched.push(selector);
|
||||||
matched.push(context);
|
matched.push(context);
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,8 +186,8 @@ export function main() {
|
||||||
describe('processRules', () => {
|
describe('processRules', () => {
|
||||||
describe('parse rules', () => {
|
describe('parse rules', () => {
|
||||||
function captureRules(input: string): CssRule[] {
|
function captureRules(input: string): CssRule[] {
|
||||||
var result = [];
|
var result: any[] /** TODO #9100 */ = [];
|
||||||
processRules(input, (cssRule) => {
|
processRules(input, (cssRule: any /** TODO #9100 */) => {
|
||||||
result.push(cssRule);
|
result.push(cssRule);
|
||||||
return cssRule;
|
return cssRule;
|
||||||
});
|
});
|
||||||
|
@ -216,13 +216,13 @@ export function main() {
|
||||||
describe('modify rules', () => {
|
describe('modify rules', () => {
|
||||||
it('should allow to change the selector while preserving whitespaces', () => {
|
it('should allow to change the selector while preserving whitespaces', () => {
|
||||||
expect(processRules('@import a; b {c {d}} e {f}',
|
expect(processRules('@import a; b {c {d}} e {f}',
|
||||||
(cssRule) => new CssRule(cssRule.selector + '2', cssRule.content)))
|
(cssRule: any /** TODO #9100 */) => new CssRule(cssRule.selector + '2', cssRule.content)))
|
||||||
.toEqual('@import a2; b2 {c {d}} e2 {f}');
|
.toEqual('@import a2; b2 {c {d}} e2 {f}');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow to change the content', () => {
|
it('should allow to change the content', () => {
|
||||||
expect(processRules('a {b}',
|
expect(processRules('a {b}',
|
||||||
(cssRule) => new CssRule(cssRule.selector, cssRule.content + '2')))
|
(cssRule: any /** TODO #9100 */) => new CssRule(cssRule.selector, cssRule.content + '2')))
|
||||||
.toEqual('a {b2}');
|
.toEqual('a {b2}');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {UrlResolver} from '@angular/compiler/src/url_resolver';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('extractStyleUrls', () => {
|
describe('extractStyleUrls', () => {
|
||||||
var urlResolver;
|
var urlResolver: any /** TODO #9100 */;
|
||||||
|
|
||||||
beforeEach(() => { urlResolver = new UrlResolver(); });
|
beforeEach(() => { urlResolver = new UrlResolver(); });
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ var MOCK_SCHEMA_REGISTRY = [
|
||||||
let zeConsole = console;
|
let zeConsole = console;
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
var ngIf;
|
var ngIf: any /** TODO #9100 */;
|
||||||
var parse:
|
var parse:
|
||||||
(template: string, directives: CompileDirectiveMetadata[], pipes?: CompilePipeMetadata[]) =>
|
(template: string, directives: CompileDirectiveMetadata[], pipes?: CompilePipeMetadata[]) =>
|
||||||
TemplateAst[];
|
TemplateAst[];
|
||||||
|
@ -82,7 +82,7 @@ export function main() {
|
||||||
console = new ArrayConsole();
|
console = new ArrayConsole();
|
||||||
return [{provide: Console, useValue: console}];
|
return [{provide: Console, useValue: console}];
|
||||||
});
|
});
|
||||||
beforeEach(inject([TemplateParser], (parser) => {
|
beforeEach(inject([TemplateParser], (parser: any /** TODO #9100 */) => {
|
||||||
var component = CompileDirectiveMetadata.create({
|
var component = CompileDirectiveMetadata.create({
|
||||||
selector: 'root',
|
selector: 'root',
|
||||||
type: new CompileTypeMetadata({moduleUrl: someModuleUrl, name: 'Root'}),
|
type: new CompileTypeMetadata({moduleUrl: someModuleUrl, name: 'Root'}),
|
||||||
|
@ -518,10 +518,10 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('providers', () => {
|
describe('providers', () => {
|
||||||
var nextProviderId;
|
var nextProviderId: any /** TODO #9100 */;
|
||||||
|
|
||||||
function createToken(value: string): CompileTokenMetadata {
|
function createToken(value: string): CompileTokenMetadata {
|
||||||
var token;
|
var token: any /** TODO #9100 */;
|
||||||
if (value.startsWith('type:')) {
|
if (value.startsWith('type:')) {
|
||||||
token = new CompileTokenMetadata({
|
token = new CompileTokenMetadata({
|
||||||
identifier:
|
identifier:
|
||||||
|
@ -1071,7 +1071,7 @@ Reference "#a" is defined several times ("<div #a></div><div [ERROR ->]#a></div>
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('content projection', () => {
|
describe('content projection', () => {
|
||||||
var compCounter;
|
var compCounter: any /** TODO #9100 */;
|
||||||
beforeEach(() => { compCounter = 0; });
|
beforeEach(() => { compCounter = 0; });
|
||||||
|
|
||||||
function createComp(selector: string,
|
function createComp(selector: string,
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('preparseElement', () => {
|
describe('preparseElement', () => {
|
||||||
var htmlParser;
|
var htmlParser: any /** TODO #9100 */;
|
||||||
beforeEach(inject([HtmlParser], (_htmlParser: HtmlParser) => { htmlParser = _htmlParser; }));
|
beforeEach(inject([HtmlParser], (_htmlParser: HtmlParser) => { htmlParser = _htmlParser; }));
|
||||||
|
|
||||||
function preparse(html: string): PreparsedElement {
|
function preparse(html: string): PreparsedElement {
|
||||||
|
|
|
@ -192,7 +192,7 @@ class DirectiveListComp {
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('test component builder', function() {
|
describe('test component builder', function() {
|
||||||
it('should instantiate a component with valid DOM',
|
it('should instantiate a component with valid DOM',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(ChildComp).then((componentFixture) => {
|
tcb.createAsync(ChildComp).then((componentFixture) => {
|
||||||
componentFixture.detectChanges();
|
componentFixture.detectChanges();
|
||||||
|
@ -203,7 +203,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should allow changing members of the component',
|
it('should allow changing members of the component',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(MyIfComp).then((componentFixture) => {
|
tcb.createAsync(MyIfComp).then((componentFixture) => {
|
||||||
componentFixture.detectChanges();
|
componentFixture.detectChanges();
|
||||||
|
@ -218,7 +218,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should override a template',
|
it('should override a template',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.overrideTemplate(MockChildComp, '<span>Mock</span>')
|
tcb.overrideTemplate(MockChildComp, '<span>Mock</span>')
|
||||||
.createAsync(MockChildComp)
|
.createAsync(MockChildComp)
|
||||||
|
@ -231,7 +231,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should override a view',
|
it('should override a view',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.overrideView(ChildComp,
|
tcb.overrideView(ChildComp,
|
||||||
new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
|
new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
|
||||||
|
@ -245,7 +245,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should override component dependencies',
|
it('should override component dependencies',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.overrideDirective(ParentComp, ChildComp, MockChildComp)
|
tcb.overrideDirective(ParentComp, ChildComp, MockChildComp)
|
||||||
.createAsync(ParentComp)
|
.createAsync(ParentComp)
|
||||||
|
@ -258,7 +258,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should override items from a list',
|
it('should override items from a list',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.overrideDirective(DirectiveListComp, ListDir1, ListDir1Alt)
|
tcb.overrideDirective(DirectiveListComp, ListDir1, ListDir1Alt)
|
||||||
.createAsync(DirectiveListComp)
|
.createAsync(DirectiveListComp)
|
||||||
|
@ -271,7 +271,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("should override child component's dependencies",
|
it("should override child component's dependencies",
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
|
tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
|
||||||
.overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp)
|
.overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp)
|
||||||
|
@ -286,7 +286,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should override a provider',
|
it('should override a provider',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.overrideProviders(TestBindingsComp,
|
tcb.overrideProviders(TestBindingsComp,
|
||||||
[{provide: FancyService, useClass: MockFancyService}])
|
[{provide: FancyService, useClass: MockFancyService}])
|
||||||
|
@ -301,7 +301,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
it('should override a viewBinding',
|
it('should override a viewBinding',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.overrideViewProviders(TestViewBindingsComp,
|
tcb.overrideViewProviders(TestViewBindingsComp,
|
||||||
[{provide: FancyService, useClass: MockFancyService}])
|
[{provide: FancyService, useClass: MockFancyService}])
|
||||||
|
@ -318,7 +318,7 @@ export function main() {
|
||||||
describe('ComponentFixture', () => {
|
describe('ComponentFixture', () => {
|
||||||
it('should auto detect changes if autoDetectChanges is called',
|
it('should auto detect changes if autoDetectChanges is called',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AutoDetectComp)
|
tcb.createAsync(AutoDetectComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -338,7 +338,7 @@ export function main() {
|
||||||
it('should auto detect changes if ComponentFixtureAutoDetect is provided as true',
|
it('should auto detect changes if ComponentFixtureAutoDetect is provided as true',
|
||||||
withProviders(() => [{provide: ComponentFixtureAutoDetect, useValue: true}])
|
withProviders(() => [{provide: ComponentFixtureAutoDetect, useValue: true}])
|
||||||
.inject([TestComponentBuilder, AsyncTestCompleter],
|
.inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AutoDetectComp)
|
tcb.createAsync(AutoDetectComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -354,7 +354,7 @@ export function main() {
|
||||||
|
|
||||||
it('should signal through whenStable when the fixture is stable (autoDetectChanges)',
|
it('should signal through whenStable when the fixture is stable (autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AsyncComp).then((componentFixture) => {
|
tcb.createAsync(AsyncComp).then((componentFixture) => {
|
||||||
componentFixture.autoDetectChanges();
|
componentFixture.autoDetectChanges();
|
||||||
|
@ -377,7 +377,7 @@ export function main() {
|
||||||
|
|
||||||
it('should signal through isStable when the fixture is stable (no autoDetectChanges)',
|
it('should signal through isStable when the fixture is stable (no autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AsyncComp).then((componentFixture) => {
|
tcb.createAsync(AsyncComp).then((componentFixture) => {
|
||||||
componentFixture.detectChanges();
|
componentFixture.detectChanges();
|
||||||
|
@ -401,7 +401,7 @@ export function main() {
|
||||||
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
|
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
|
||||||
'(autoDetectChanges)',
|
'(autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AsyncTimeoutComp)
|
tcb.createAsync(AsyncTimeoutComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -426,7 +426,7 @@ export function main() {
|
||||||
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
|
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
|
||||||
'(no autoDetectChanges)',
|
'(no autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AsyncTimeoutComp)
|
tcb.createAsync(AsyncTimeoutComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -452,7 +452,7 @@ export function main() {
|
||||||
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
|
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
|
||||||
'(autoDetectChanges)',
|
'(autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(NestedAsyncTimeoutComp)
|
tcb.createAsync(NestedAsyncTimeoutComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -477,7 +477,7 @@ export function main() {
|
||||||
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
|
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
|
||||||
'(no autoDetectChanges)',
|
'(no autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(NestedAsyncTimeoutComp)
|
tcb.createAsync(NestedAsyncTimeoutComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -502,7 +502,7 @@ export function main() {
|
||||||
|
|
||||||
it('should stabilize after async task in change detection (autoDetectChanges)',
|
it('should stabilize after async task in change detection (autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AsyncChangeComp)
|
tcb.createAsync(AsyncChangeComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -523,7 +523,7 @@ export function main() {
|
||||||
|
|
||||||
it('should stabilize after async task in change detection(no autoDetectChanges)',
|
it('should stabilize after async task in change detection(no autoDetectChanges)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(AsyncChangeComp)
|
tcb.createAsync(AsyncChangeComp)
|
||||||
.then((componentFixture) => {
|
.then((componentFixture) => {
|
||||||
|
@ -554,7 +554,7 @@ export function main() {
|
||||||
|
|
||||||
it('calling autoDetectChanges raises an error', () => {
|
it('calling autoDetectChanges raises an error', () => {
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||||
async) => {
|
async: any /** TODO #9100 */) => {
|
||||||
tcb.createAsync(ChildComp).then((componentFixture) => {
|
tcb.createAsync(ChildComp).then((componentFixture) => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
componentFixture.autoDetectChanges();
|
componentFixture.autoDetectChanges();
|
||||||
|
@ -566,7 +566,7 @@ export function main() {
|
||||||
|
|
||||||
it('should instantiate a component with valid DOM',
|
it('should instantiate a component with valid DOM',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(ChildComp).then((componentFixture) => {
|
tcb.createAsync(ChildComp).then((componentFixture) => {
|
||||||
expect(componentFixture.ngZone).toBeNull();
|
expect(componentFixture.ngZone).toBeNull();
|
||||||
|
@ -578,7 +578,7 @@ export function main() {
|
||||||
|
|
||||||
it('should allow changing members of the component',
|
it('should allow changing members of the component',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter],
|
inject([TestComponentBuilder, AsyncTestCompleter],
|
||||||
(tcb: TestComponentBuilder, async) => {
|
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
|
|
||||||
tcb.createAsync(MyIfComp).then((componentFixture) => {
|
tcb.createAsync(MyIfComp).then((componentFixture) => {
|
||||||
componentFixture.detectChanges();
|
componentFixture.detectChanges();
|
||||||
|
@ -596,7 +596,7 @@ export function main() {
|
||||||
describe('createSync', () => {
|
describe('createSync', () => {
|
||||||
it('should create components',
|
it('should create components',
|
||||||
inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter],
|
inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter],
|
||||||
(cr: ComponentResolver, tcb: TestComponentBuilder, async) => {
|
(cr: ComponentResolver, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
|
||||||
cr.resolveComponent(MyIfComp).then((cmpFactory) => {
|
cr.resolveComponent(MyIfComp).then((cmpFactory) => {
|
||||||
let componentFixture = tcb.createSync(cmpFactory);
|
let componentFixture = tcb.createSync(cmpFactory);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function main() {
|
||||||
|
|
||||||
beforeEach(() => { xhr = new MockXHR(); });
|
beforeEach(() => { xhr = new MockXHR(); });
|
||||||
|
|
||||||
function expectResponse(request: Promise<string>, url: string, response: string, done = null) {
|
function expectResponse(request: Promise<string>, url: string, response: string, done: any /** TODO #9100 */ = null) {
|
||||||
function onResponse(text: string): string {
|
function onResponse(text: string): string {
|
||||||
if (response === null) {
|
if (response === null) {
|
||||||
throw `Unexpected response ${url} -> ${text}`;
|
throw `Unexpected response ${url} -> ${text}`;
|
||||||
|
@ -42,7 +42,7 @@ export function main() {
|
||||||
PromiseWrapper.then(request, onResponse, onError);
|
PromiseWrapper.then(request, onResponse, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should return a response from the definitions', inject([AsyncTestCompleter], (async) => {
|
it('should return a response from the definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var url = '/foo';
|
var url = '/foo';
|
||||||
var response = 'bar';
|
var response = 'bar';
|
||||||
xhr.when(url, response);
|
xhr.when(url, response);
|
||||||
|
@ -50,15 +50,15 @@ export function main() {
|
||||||
xhr.flush();
|
xhr.flush();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return an error from the definitions', inject([AsyncTestCompleter], (async) => {
|
it('should return an error from the definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var url = '/foo';
|
var url = '/foo';
|
||||||
var response = null;
|
var response: any /** TODO #9100 */ = null;
|
||||||
xhr.when(url, response);
|
xhr.when(url, response);
|
||||||
expectResponse(xhr.get(url), url, response, () => async.done());
|
expectResponse(xhr.get(url), url, response, () => async.done());
|
||||||
xhr.flush();
|
xhr.flush();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return a response from the expectations', inject([AsyncTestCompleter], (async) => {
|
it('should return a response from the expectations', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var url = '/foo';
|
var url = '/foo';
|
||||||
var response = 'bar';
|
var response = 'bar';
|
||||||
xhr.expect(url, response);
|
xhr.expect(url, response);
|
||||||
|
@ -66,9 +66,9 @@ export function main() {
|
||||||
xhr.flush();
|
xhr.flush();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return an error from the expectations', inject([AsyncTestCompleter], (async) => {
|
it('should return an error from the expectations', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var url = '/foo';
|
var url = '/foo';
|
||||||
var response = null;
|
var response: any /** TODO #9100 */ = null;
|
||||||
xhr.expect(url, response);
|
xhr.expect(url, response);
|
||||||
expectResponse(xhr.get(url), url, response, () => async.done());
|
expectResponse(xhr.get(url), url, response, () => async.done());
|
||||||
xhr.flush();
|
xhr.flush();
|
||||||
|
@ -83,7 +83,7 @@ export function main() {
|
||||||
expect(() => { xhr.flush(); }).toThrowError('Unexpected request /foo');
|
expect(() => { xhr.flush(); }).toThrowError('Unexpected request /foo');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return expectations before definitions', inject([AsyncTestCompleter], (async) => {
|
it('should return expectations before definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||||
var url = '/foo';
|
var url = '/foo';
|
||||||
xhr.when(url, 'when');
|
xhr.when(url, 'when');
|
||||||
xhr.expect(url, 'expect');
|
xhr.expect(url, 'expect');
|
||||||
|
|
|
@ -75,10 +75,10 @@ export class ComponentFixture<T> {
|
||||||
|
|
||||||
private _isStable: boolean = true;
|
private _isStable: boolean = true;
|
||||||
private _completer: PromiseCompleter<any> = null;
|
private _completer: PromiseCompleter<any> = null;
|
||||||
private _onUnstableSubscription = null;
|
private _onUnstableSubscription: any /** TODO #9100 */ = null;
|
||||||
private _onStableSubscription = null;
|
private _onStableSubscription: any /** TODO #9100 */ = null;
|
||||||
private _onMicrotaskEmptySubscription = null;
|
private _onMicrotaskEmptySubscription: any /** TODO #9100 */ = null;
|
||||||
private _onErrorSubscription = null;
|
private _onErrorSubscription: any /** TODO #9100 */ = null;
|
||||||
|
|
||||||
constructor(componentRef: ComponentRef<T>, ngZone: NgZone, autoDetect: boolean) {
|
constructor(componentRef: ComponentRef<T>, ngZone: NgZone, autoDetect: boolean) {
|
||||||
this.changeDetectorRef = componentRef.changeDetectorRef;
|
this.changeDetectorRef = componentRef.changeDetectorRef;
|
||||||
|
@ -368,8 +368,8 @@ export class TestComponentBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
createFakeAsync(rootComponentType: Type): ComponentFixture<any> {
|
createFakeAsync(rootComponentType: Type): ComponentFixture<any> {
|
||||||
let result;
|
let result: any /** TODO #9100 */;
|
||||||
let error;
|
let error: any /** TODO #9100 */;
|
||||||
PromiseWrapper.then(this.createAsync(rootComponentType), (_result) => { result = _result; },
|
PromiseWrapper.then(this.createAsync(rootComponentType), (_result) => { result = _result; },
|
||||||
(_error) => { error = _error; });
|
(_error) => { error = _error; });
|
||||||
tick();
|
tick();
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class MockViewResolver extends ViewResolver {
|
||||||
view = super.resolve(component);
|
view = super.resolve(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
var directives = [];
|
var directives: any[] /** TODO #9100 */ = [];
|
||||||
if (isPresent(view.directives)) {
|
if (isPresent(view.directives)) {
|
||||||
flattenArray(view.directives, directives);
|
flattenArray(view.directives, directives);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ export class MockXHR extends XHR {
|
||||||
verifyNoOutstandingExpectations() {
|
verifyNoOutstandingExpectations() {
|
||||||
if (this._expectations.length === 0) return;
|
if (this._expectations.length === 0) return;
|
||||||
|
|
||||||
var urls = [];
|
var urls: any[] /** TODO #9100 */ = [];
|
||||||
for (var i = 0; i < this._expectations.length; i++) {
|
for (var i = 0; i < this._expectations.length; i++) {
|
||||||
var expectation = this._expectations[i];
|
var expectation = this._expectations[i];
|
||||||
urls.push(expectation.url);
|
urls.push(expectation.url);
|
||||||
|
@ -96,7 +96,7 @@ class _PendingRequest {
|
||||||
url: string;
|
url: string;
|
||||||
completer: PromiseCompleter<string>;
|
completer: PromiseCompleter<string>;
|
||||||
|
|
||||||
constructor(url) {
|
constructor(url: any /** TODO #9100 */) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.completer = PromiseWrapper.completer();
|
this.completer = PromiseWrapper.completer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ export class ActiveAnimationPlayersMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
findAllPlayersByElement(element: any): AnimationPlayer[] {
|
findAllPlayersByElement(element: any): AnimationPlayer[] {
|
||||||
var players = [];
|
var players: any[] /** TODO #9100 */ = [];
|
||||||
StringMapWrapper.forEach(this._map.get(element), player => players.push(player));
|
StringMapWrapper.forEach(this._map.get(element), (player: any /** TODO #9100 */) => players.push(player));
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class AnimationGroupPlayer implements AnimationPlayer {
|
||||||
|
|
||||||
reset(): void { this._players.forEach(player => player.reset()); }
|
reset(): void { this._players.forEach(player => player.reset()); }
|
||||||
|
|
||||||
setPosition(p): void {
|
setPosition(p: any /** TODO #9100 */): void {
|
||||||
this._players.forEach(player => {
|
this._players.forEach(player => {
|
||||||
player.setPosition(p);
|
player.setPosition(p);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ export abstract class AnimationPlayer {
|
||||||
abstract finish(): void;
|
abstract finish(): void;
|
||||||
abstract destroy(): void;
|
abstract destroy(): void;
|
||||||
abstract reset(): void;
|
abstract reset(): void;
|
||||||
abstract setPosition(p): void;
|
abstract setPosition(p: any /** TODO #9100 */): void;
|
||||||
abstract getPosition(): number;
|
abstract getPosition(): number;
|
||||||
get parentPlayer(): AnimationPlayer { throw new BaseException('NOT IMPLEMENTED: Base Class'); }
|
get parentPlayer(): AnimationPlayer { throw new BaseException('NOT IMPLEMENTED: Base Class'); }
|
||||||
set parentPlayer(player: AnimationPlayer) { throw new BaseException('NOT IMPLEMENTED: Base Class'); }
|
set parentPlayer(player: AnimationPlayer) { throw new BaseException('NOT IMPLEMENTED: Base Class'); }
|
||||||
|
@ -17,7 +17,7 @@ export abstract class AnimationPlayer {
|
||||||
|
|
||||||
export class NoOpAnimationPlayer implements AnimationPlayer {
|
export class NoOpAnimationPlayer implements AnimationPlayer {
|
||||||
|
|
||||||
private _subscriptions = [];
|
private _subscriptions: any[] /** TODO #9100 */ = [];
|
||||||
public parentPlayer: AnimationPlayer = null;
|
public parentPlayer: AnimationPlayer = null;
|
||||||
constructor() {
|
constructor() {
|
||||||
scheduleMicroTask(() => this._onFinish());
|
scheduleMicroTask(() => this._onFinish());
|
||||||
|
@ -36,6 +36,6 @@ export class NoOpAnimationPlayer implements AnimationPlayer {
|
||||||
}
|
}
|
||||||
destroy(): void {}
|
destroy(): void {}
|
||||||
reset(): void {}
|
reset(): void {}
|
||||||
setPosition(p): void {}
|
setPosition(p: any /** TODO #9100 */): void {}
|
||||||
getPosition(): number { return 0; }
|
getPosition(): number { return 0; }
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue