chore: clang-reformat

This commit is contained in:
Misko Hevery 2016-05-01 22:50:37 -07:00
parent bb8976608d
commit 3e17c99f4e
108 changed files with 1120 additions and 1129 deletions

View File

@ -1569,7 +1569,6 @@ var firstTask = true;
gulp.on('task_start', (e) => {
if (firstTask) {
firstTask = false;

View File

@ -3,4 +3,3 @@ export * from './src/directives';
export * from './src/forms';
export * from './src/common_directives';
export * from './src/location';

View File

@ -7,7 +7,8 @@
* to read information
* from the form DOM elements.
*
* Forms providers are not included in default providers; you must import these providers explicitly.
* Forms providers are not included in default providers; you must import these providers
* explicitly.
*/
export {AbstractControl, Control, ControlGroup, ControlArray} from './forms/model';

View File

@ -12,10 +12,7 @@ import {
} from '@angular/core';
import {isPresent} from '../../../src/facade/lang';
import {ListWrapper} from '../../../src/facade/collection';
import {
NG_VALUE_ACCESSOR,
ControlValueAccessor
} from './control_value_accessor';
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor';
import {NgControl} from './ng_control';
export const RADIO_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ {

View File

@ -1,10 +1,4 @@
import {
Pipe,
Injectable,
ChangeDetectorRef,
OnDestroy,
WrappedValue
} from '@angular/core';
import {Pipe, Injectable, ChangeDetectorRef, OnDestroy, WrappedValue} from '@angular/core';
import {isBlank, isPresent, isPromise} from '../../src/facade/lang';
import {ObservableWrapper, Observable, EventEmitter} from '../../src/facade/async';

View File

@ -1,10 +1,5 @@
import {Injectable, PipeTransform, Pipe} from '@angular/core';
import {
isStringMap,
StringWrapper,
isPresent,
RegExpWrapper
} from '../../src/facade/lang';
import {isStringMap, StringWrapper, isPresent, RegExpWrapper} from '../../src/facade/lang';
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
var interpolationExp: RegExp = RegExpWrapper.create('#');

View File

@ -28,7 +28,8 @@ export function main() {
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
async.done();
@ -44,7 +45,8 @@ export function main() {
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello2');
async.done();
@ -60,19 +62,22 @@ export function main() {
.then((fixture) => {
fixture.debugElement.componentInstance.booleanCondition = false;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
fixture.debugElement.componentInstance.booleanCondition = true;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
fixture.debugElement.componentInstance.booleanCondition = false;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
@ -90,31 +95,36 @@ export function main() {
.then((fixture) => {
fixture.debugElement.componentInstance.booleanCondition = false;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
fixture.debugElement.componentInstance.booleanCondition = true;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
fixture.debugElement.componentInstance.nestedBooleanCondition = false;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
fixture.debugElement.componentInstance.nestedBooleanCondition = true;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
fixture.debugElement.componentInstance.booleanCondition = false;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
@ -135,21 +145,24 @@ export function main() {
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(3);
expect(getDOM().getText(fixture.debugElement.nativeElement))
.toEqual('helloNumberhelloStringhelloFunction');
fixture.debugElement.componentInstance.numberCondition = 0;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('helloString');
fixture.debugElement.componentInstance.numberCondition = 1;
fixture.debugElement.componentInstance.stringCondition = "bar";
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('helloNumber');
async.done();
@ -166,13 +179,17 @@ export function main() {
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(getDOM()
.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me')
.length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
fixture.debugElement.componentInstance.numberCondition = 2;
fixture.detectChanges();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(getDOM()
.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me')
.length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello');
@ -188,13 +205,13 @@ export function main() {
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
getDOM().addClass(getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'),
"foo");
getDOM().addClass(
getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'), "foo");
fixture.debugElement.componentInstance.numberCondition = 2;
fixture.detectChanges();
expect(
getDOM().hasClass(getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'),
expect(getDOM().hasClass(
getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'),
"foo"))
.toBe(true);
@ -212,7 +229,9 @@ export function main() {
.createAsync(TestComponent)
.then((fixture) => {
expect(() => fixture.detectChanges()).toThrowError();
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
expect(getDOM()
.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me')
.length)
.toEqual(0);
expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();

View File

@ -31,7 +31,8 @@ export function main() {
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('40px');
async.done();
@ -49,13 +50,15 @@ export function main() {
fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('40px');
expr = fixture.debugElement.componentInstance.expr;
expr['max-width'] = '30%';
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('30%');
async.done();
@ -71,12 +74,14 @@ export function main() {
.then((fixture) => {
fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('40px');
StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width');
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('');
async.done();
@ -92,16 +97,20 @@ export function main() {
.then((fixture) => {
fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('40px');
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
.toEqual('12px');
StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width');
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('');
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
.toEqual('12px');
async.done();
@ -117,17 +126,21 @@ export function main() {
.then((fixture) => {
fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('40px');
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
.toEqual('12px');
StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width');
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size'))
.toEqual('12px');
fixture.detectChanges();
expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
expect(
getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width'))
.toEqual('');
async.done();

View File

@ -10,11 +10,7 @@ import {
iit,
xit
} from '@angular/core/testing/testing_internal';
import {
fakeAsync,
tick,
flushMicrotasks
} from '@angular/core/testing';
import {fakeAsync, tick, flushMicrotasks} from '@angular/core/testing';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {TestComponentBuilder} from '@angular/compiler/testing';
import {ComponentFixture} from '@angular/compiler/testing';
@ -51,7 +47,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"login": new Control("loginValue")});
fixture.detectChanges();
@ -68,7 +66,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
expect(() => fixture.detectChanges())
.toThrowError(new RegExp(`ngFormModel expects a form. Please pass one in.`));
async.done();
@ -83,7 +83,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
var input = fixture.debugElement.query(By.css("input"));
@ -104,7 +106,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
var input = fixture.debugElement.query(By.css("input"));
@ -147,7 +151,9 @@ export function main() {
var t = `<div><input type="text" [ngFormControl]="form"></div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = control;
fixture.detectChanges();
@ -168,7 +174,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"login": new Control("oldValue")});
fixture.detectChanges();
@ -192,7 +200,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
@ -215,7 +225,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
@ -237,7 +249,9 @@ export function main() {
<input type="text" ngControl="text">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"text": new Control("old")});
fixture.detectChanges();
@ -259,7 +273,9 @@ export function main() {
<input ngControl="text">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"text": new Control("old")});
fixture.detectChanges();
@ -280,7 +296,9 @@ export function main() {
<textarea ngControl="text"></textarea>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"text": new Control('old')});
fixture.detectChanges();
@ -302,7 +320,9 @@ export function main() {
<input type="checkbox" ngControl="checkbox">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"checkbox": new Control(true)});
fixture.detectChanges();
@ -313,7 +333,8 @@ export function main() {
input.nativeElement.checked = false;
dispatchEvent(input.nativeElement, "change");
expect(fixture.debugElement.componentInstance.form.value).toEqual({"checkbox": false});
expect(fixture.debugElement.componentInstance.form.value)
.toEqual({"checkbox": false});
async.done();
});
}));
@ -324,7 +345,9 @@ export function main() {
<input type="number" ngControl="num">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"num": new Control(10)});
fixture.detectChanges();
@ -346,7 +369,9 @@ export function main() {
<input type="number" ngControl="num" required>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"num": new Control(10)});
fixture.detectChanges();
@ -375,7 +400,9 @@ export function main() {
<input type="number" ngControl="num" [(ngModel)]="data">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.debugElement.componentInstance.data = null;
fixture.detectChanges();
@ -394,7 +421,9 @@ export function main() {
<input type="radio" ngControl="foodFish" name="food">
</form>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = new ControlGroup({
"foodChicken": new Control(new RadioButtonState(false, 'chicken')),
"foodFish": new Control(new RadioButtonState(true, 'fish'))
@ -423,7 +452,9 @@ export function main() {
<option value="NYC"></option>
</select>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.detectChanges();
var select = fixture.debugElement.query(By.css("select"));
@ -444,7 +475,9 @@ export function main() {
</option>
</select>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
var testComp = fixture.debugElement.componentInstance;
testComp.list = [{"id": "0", "name": "SF"}, {"id": "1", "name": "NYC"}];
fixture.detectChanges();
@ -460,8 +493,8 @@ export function main() {
}));
it("with ngControl",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async) => {
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
var t = `<div [ngFormModel]="form">
<select ngControl="city">
<option value="SF"></option>
@ -469,7 +502,9 @@ export function main() {
</select>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"city": new Control("SF")});
fixture.detectChanges();
@ -484,7 +519,8 @@ export function main() {
select.nativeElement.value = "NYC";
dispatchEvent(select.nativeElement, "change");
expect(fixture.debugElement.componentInstance.form.value).toEqual({"city": 'NYC'});
expect(fixture.debugElement.componentInstance.form.value)
.toEqual({"city": 'NYC'});
expect(sfOption.nativeElement.selected).toBe(false);
async.done();
});
@ -499,8 +535,9 @@ export function main() {
</div>`;
var fixture;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((compFixture) => fixture =
compFixture);
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((compFixture) => fixture = compFixture);
tick();
fixture.debugElement.componentInstance.form =
@ -523,7 +560,9 @@ export function main() {
</select>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
var testComp = fixture.debugElement.componentInstance;
testComp.list = [{"name": "SF"}, {"name": "NYC"}, {"name": "Buffalo"}];
@ -555,7 +594,9 @@ export function main() {
</select>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
var testComp: MyComp8 = fixture.debugElement.componentInstance;
testComp.list = [{"name": "SF"}, {"name": "NYC"}];
@ -582,7 +623,9 @@ export function main() {
<option *ngFor="let c of list" [ngValue]="c">{{c}}</option>
</select>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
var testComp: MyComp8 = fixture.debugElement.componentInstance;
testComp.list = [{"name": "SF"}, {"name": "NYC"}];
@ -609,7 +652,9 @@ export function main() {
</select>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
var testComp = fixture.debugElement.componentInstance;
@ -639,7 +684,9 @@ export function main() {
</select>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
var testComp = fixture.debugElement.componentInstance;
@ -668,7 +715,9 @@ export function main() {
</select>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
var testComp = fixture.debugElement.componentInstance;
testComp.list = [{"name": "SF"}, {"name": "NYC"}, {"name": "NYC"}];
@ -694,7 +743,9 @@ export function main() {
<input type="text" ngControl="name" wrapped-value>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"name": new Control("aa")});
fixture.detectChanges();
@ -715,7 +766,9 @@ export function main() {
<my-input ngControl="name"></my-input>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form =
new ControlGroup({"name": new Control("aa")});
fixture.detectChanges();
@ -724,7 +777,8 @@ export function main() {
input.componentInstance.value = "!bb!";
ObservableWrapper.subscribe(input.componentInstance.onInput, (value) => {
expect(fixture.debugElement.componentInstance.form.value).toEqual({"name": "bb"});
expect(fixture.debugElement.componentInstance.form.value)
.toEqual({"name": "bb"});
async.done();
});
input.componentInstance.dispatchChangeEvent();
@ -745,7 +799,9 @@ export function main() {
<input type="text" ngControl="max" maxlength="3">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
@ -816,7 +872,9 @@ export function main() {
<input type="text" ngControl="login">
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
expect(form.valid).toEqual(true);
@ -878,7 +936,9 @@ export function main() {
</div>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
@ -899,7 +959,9 @@ export function main() {
</div>
</div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
var input = fixture.debugElement.query(By.css("input"));
@ -1002,7 +1064,9 @@ export function main() {
var t = `<form ngNoForm>
</form>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.name = null;
fixture.detectChanges();
@ -1151,17 +1215,21 @@ export function main() {
var t = `<div><input type="text" [ngFormControl]="form"></div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
var input = fixture.debugElement.query(By.css("input")).nativeElement;
expect(sortedClassList(input)).toEqual(['ng-invalid', 'ng-pristine', 'ng-untouched']);
expect(sortedClassList(input))
.toEqual(['ng-invalid', 'ng-pristine', 'ng-untouched']);
dispatchEvent(input, "blur");
fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
expect(sortedClassList(input))
.toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
input.value = "updatedValue";
dispatchEvent(input, "input");
@ -1178,17 +1246,21 @@ export function main() {
var t = `<form [ngFormModel]="form"><input type="text" ngControl="name"></form>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.form = form;
fixture.detectChanges();
var input = fixture.debugElement.query(By.css("input")).nativeElement;
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-untouched"]);
expect(sortedClassList(input))
.toEqual(["ng-invalid", "ng-pristine", "ng-untouched"]);
dispatchEvent(input, "blur");
fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
expect(sortedClassList(input))
.toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
input.value = "updatedValue";
dispatchEvent(input, "input");
@ -1203,17 +1275,21 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
var t = `<div><input [(ngModel)]="name" required></div>`;
tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => {
tcb.overrideTemplate(MyComp8, t)
.createAsync(MyComp8)
.then((fixture) => {
fixture.debugElement.componentInstance.name = "";
fixture.detectChanges();
var input = fixture.debugElement.query(By.css("input")).nativeElement;
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-untouched"]);
expect(sortedClassList(input))
.toEqual(["ng-invalid", "ng-pristine", "ng-untouched"]);
dispatchEvent(input, "blur");
fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
expect(sortedClassList(input))
.toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
input.value = "updatedValue";
dispatchEvent(input, "input");

View File

@ -9,12 +9,7 @@ import {
afterEach,
inject,
} from '@angular/core/testing/testing_internal';
import {
fakeAsync,
flushMicrotasks,
Log,
tick
} from '@angular/core/testing';
import {fakeAsync, flushMicrotasks, Log, tick} from '@angular/core/testing';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {ControlGroup, Control, ControlArray, Validators} from '@angular/common';
import {IS_DART, isPresent} from '../../src/facade/lang';

View File

@ -8,12 +8,7 @@ import {
beforeEach,
afterEach
} from '@angular/core/testing/testing_internal';
import {
fakeAsync,
flushMicrotasks,
Log,
tick
} from '@angular/core/testing';
import {fakeAsync, flushMicrotasks, Log, tick} from '@angular/core/testing';
import {ControlGroup, Control, Validators, AbstractControl, ControlArray} from '@angular/common';
import {PromiseWrapper} from '../../src/facade/promise';
import {EventEmitter, ObservableWrapper, TimerWrapper} from '../../src/facade/async';

View File

@ -10,6 +10,4 @@ export class SpyChangeDetectorRef extends SpyObject {
export class SpyNgControl extends SpyObject {}
export class SpyValueAccessor extends SpyObject {
writeValue: any;
}
export class SpyValueAccessor extends SpyObject { writeValue: any; }

View File

@ -1,16 +1,19 @@
import {__core_private__ as r, __core_private_types__ as t} from '@angular/core';
export var isDefaultChangeDetectionStrategy: typeof t.isDefaultChangeDetectionStrategy = r.isDefaultChangeDetectionStrategy;
export var isDefaultChangeDetectionStrategy: typeof t.isDefaultChangeDetectionStrategy =
r.isDefaultChangeDetectionStrategy;
export type ChangeDetectorState = t.ChangeDetectorState;
export var ChangeDetectorState: typeof t.ChangeDetectorState = r.ChangeDetectorState;
export var CHANGE_DETECTION_STRATEGY_VALUES: typeof t.CHANGE_DETECTION_STRATEGY_VALUES = r.CHANGE_DETECTION_STRATEGY_VALUES;
export var CHANGE_DETECTION_STRATEGY_VALUES: typeof t.CHANGE_DETECTION_STRATEGY_VALUES =
r.CHANGE_DETECTION_STRATEGY_VALUES;
export var constructDependencies: typeof t.constructDependencies = r.constructDependencies;
export type LifecycleHooks = t.LifecycleHooks;
export var LifecycleHooks: typeof t.LifecycleHooks = r.LifecycleHooks;
export var LIFECYCLE_HOOKS_VALUES: typeof t.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES;
export type ReflectorReader = t.ReflectorReader;
export var ReflectorReader: typeof t.ReflectorReader = r.ReflectorReader;
export var ReflectorComponentResolver: typeof t.ReflectorComponentResolver = r.ReflectorComponentResolver;
export var ReflectorComponentResolver: typeof t.ReflectorComponentResolver =
r.ReflectorComponentResolver;
export type AppElement = t.AppElement;
export var AppElement: typeof t.AppElement = r.AppElement;
export var AppView: typeof t.AppView = r.AppView;
@ -20,10 +23,12 @@ export type ViewType = t.ViewType;
export var ViewType: typeof t.ViewType = r.ViewType;
export var MAX_INTERPOLATION_VALUES: typeof t.MAX_INTERPOLATION_VALUES = r.MAX_INTERPOLATION_VALUES;
export var checkBinding: typeof t.checkBinding = r.checkBinding;
export var flattenNestedViewRenderNodes: typeof t.flattenNestedViewRenderNodes = r.flattenNestedViewRenderNodes;
export var flattenNestedViewRenderNodes: typeof t.flattenNestedViewRenderNodes =
r.flattenNestedViewRenderNodes;
export var interpolate: typeof t.interpolate = r.interpolate;
export var ViewUtils: typeof t.ViewUtils = r.ViewUtils;
export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES = r.VIEW_ENCAPSULATION_VALUES;
export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES =
r.VIEW_ENCAPSULATION_VALUES;
export var DebugContext: typeof t.DebugContext = r.DebugContext;
export var StaticNodeDebugInfo: typeof t.StaticNodeDebugInfo = r.StaticNodeDebugInfo;
export var devModeEqual: typeof t.devModeEqual = r.devModeEqual;
@ -49,4 +54,3 @@ export var pureProxy10: typeof t.pureProxy10 = r.pureProxy10;
export var castByValue: typeof t.castByValue = r.castByValue;
export type Console = t.Console;
export var Console: typeof t.Console = r.Console;

View File

@ -316,7 +316,9 @@ export class CompileTokenMetadata implements CompileMetadataWithIdentifier {
(isPresent(ak) && ak == token2.assetCacheKey);
}
get name(): string { return isPresent(this.value) ? sanitizeIdentifier(this.value) : this.identifier.name; }
get name(): string {
return isPresent(this.value) ? sanitizeIdentifier(this.value) : this.identifier.name;
}
}
export class CompileTokenMap<VALUE> {

View File

@ -1,10 +1,4 @@
import {
StringWrapper,
NumberWrapper,
isPresent,
isBlank,
serializeEnum
} from '../src/facade/lang';
import {StringWrapper, NumberWrapper, isPresent, isBlank, serializeEnum} from '../src/facade/lang';
import {ListWrapper} from '../src/facade/collection';
import {ParseLocation, ParseError, ParseSourceFile, ParseSourceSpan} from './parse_util';
import {getHtmlTagDefinition, HtmlTagContentType, NAMED_ENTITIES} from './html_tags';

View File

@ -84,20 +84,14 @@ var impEMPTY_ARRAY = EMPTY_ARRAY;
var impEMPTY_MAP = EMPTY_MAP;
export class Identifiers {
static ViewUtils = new CompileIdentifierMetadata({
name: 'ViewUtils',
moduleUrl: assetUrl('core', 'linker/view_utils'),
runtime: impViewUtils
});
static ViewUtils = new CompileIdentifierMetadata(
{name: 'ViewUtils', moduleUrl: assetUrl('core', 'linker/view_utils'), runtime: impViewUtils});
static AppView = new CompileIdentifierMetadata(
{name: 'AppView', moduleUrl: APP_VIEW_MODULE_URL, runtime: impAppView});
static DebugAppView = new CompileIdentifierMetadata(
{name: 'DebugAppView', moduleUrl: APP_VIEW_MODULE_URL, runtime: impDebugAppView});
static AppElement = new CompileIdentifierMetadata({
name: 'AppElement',
moduleUrl: assetUrl('core', 'linker/element'),
runtime: impAppElement
});
static AppElement = new CompileIdentifierMetadata(
{name: 'AppElement', moduleUrl: assetUrl('core', 'linker/element'), runtime: impAppElement});
static ElementRef = new CompileIdentifierMetadata({
name: 'ElementRef',
moduleUrl: assetUrl('core', 'linker/element_ref'),
@ -118,11 +112,8 @@ export class Identifiers {
moduleUrl: assetUrl('core', 'render/api'),
runtime: impRenderComponentType
});
static QueryList = new CompileIdentifierMetadata({
name: 'QueryList',
moduleUrl: assetUrl('core', 'linker/query_list'),
runtime: impQueryList
});
static QueryList = new CompileIdentifierMetadata(
{name: 'QueryList', moduleUrl: assetUrl('core', 'linker/query_list'), runtime: impQueryList});
static TemplateRef = new CompileIdentifierMetadata({
name: 'TemplateRef',
moduleUrl: assetUrl('core', 'linker/template_ref'),
@ -135,21 +126,15 @@ export class Identifiers {
});
static ValueUnwrapper = new CompileIdentifierMetadata(
{name: 'ValueUnwrapper', moduleUrl: CD_MODULE_URL, runtime: impValueUnwrapper});
static Injector = new CompileIdentifierMetadata({
name: 'Injector',
moduleUrl: assetUrl('core', 'di/injector'),
runtime: impInjector
});
static Injector = new CompileIdentifierMetadata(
{name: 'Injector', moduleUrl: assetUrl('core', 'di/injector'), runtime: impInjector});
static ViewEncapsulation = new CompileIdentifierMetadata({
name: 'ViewEncapsulation',
moduleUrl: assetUrl('core', 'metadata/view'),
runtime: impViewEncapsulation
});
static ViewType = new CompileIdentifierMetadata({
name: 'ViewType',
moduleUrl: assetUrl('core', 'linker/view_type'),
runtime: impViewType
});
static ViewType = new CompileIdentifierMetadata(
{name: 'ViewType', moduleUrl: assetUrl('core', 'linker/view_type'), runtime: impViewType});
static ChangeDetectionStrategy = new CompileIdentifierMetadata({
name: 'ChangeDetectionStrategy',
moduleUrl: CD_MODULE_URL,
@ -165,11 +150,8 @@ export class Identifiers {
moduleUrl: assetUrl('core', 'linker/debug_context'),
runtime: impDebugContext
});
static Renderer = new CompileIdentifierMetadata({
name: 'Renderer',
moduleUrl: assetUrl('core', 'render/api'),
runtime: impRenderer
});
static Renderer = new CompileIdentifierMetadata(
{name: 'Renderer', moduleUrl: assetUrl('core', 'render/api'), runtime: impRenderer});
static SimpleChange = new CompileIdentifierMetadata(
{name: 'SimpleChange', moduleUrl: CD_MODULE_URL, runtime: impSimpleChange});
static uninitialized = new CompileIdentifierMetadata(

View File

@ -1,11 +1,6 @@
import {Injectable, Provider, provide} from '@angular/core';
import {
StringWrapper,
RegExpWrapper,
isBlank,
isPresent
} from '../src/facade/lang';
import {StringWrapper, RegExpWrapper, isBlank, isPresent} from '../src/facade/lang';
import {
HtmlAstVisitor,

View File

@ -7,9 +7,12 @@ import {
HostMetadata,
SkipSelfMetadata,
Provider,
PLATFORM_DIRECTIVES, PLATFORM_PIPES,
PLATFORM_DIRECTIVES,
PLATFORM_PIPES,
reflector,
Injectable, Inject, Optional,
Injectable,
Inject,
Optional,
ViewMetadata,
NoAnnotationError,
QueryMetadata,
@ -17,10 +20,7 @@ import {
InjectMetadata,
ViewQueryMetadata
} from '@angular/core';
import {
constructDependencies,
LIFECYCLE_HOOKS_VALUES, ReflectorReader
} from '../core_private';
import {constructDependencies, LIFECYCLE_HOOKS_VALUES, ReflectorReader} from '../core_private';
import {
Type,
isBlank,

View File

@ -17,7 +17,8 @@ import {OutputEmitter} from './output/abstract_emitter';
import * as o from './output/output_ast';
import {
MODULE_SUFFIX, assetUrl,
MODULE_SUFFIX,
assetUrl,
} from './util';
var _COMPONENT_FACTORY_IDENTIFIER = new CompileIdentifierMetadata({

View File

@ -1,9 +1,4 @@
import {
isPresent,
isBlank,
isString,
StringWrapper
} from '../../src/facade/lang';
import {isPresent, isBlank, isString, StringWrapper} from '../../src/facade/lang';
import {BaseException} from '../../src/facade/exceptions';
import * as o from './output_ast';

View File

@ -1,8 +1,4 @@
import {
isPresent,
isBlank,
isArray
} from '../../src/facade/lang';
import {isPresent, isBlank, isArray} from '../../src/facade/lang';
import {BaseException} from '../../src/facade/exceptions';
import {CompileIdentifierMetadata} from '../compile_metadata';
import * as o from './output_ast';

View File

@ -1,9 +1,5 @@
import {reflector} from '@angular/core';
import {
isPresent,
IS_DART,
FunctionWrapper
} from '../../src/facade/lang';
import {isPresent, IS_DART, FunctionWrapper} from '../../src/facade/lang';
import {ObservableWrapper} from '../../src/facade/async';
import {BaseException, unimplemented} from '../../src/facade/exceptions';
import {ListWrapper} from '../../src/facade/collection';

View File

@ -1,9 +1,5 @@
import * as o from './output_ast';
import {
isPresent,
isBlank,
isArray
} from '../../src/facade/lang';
import {isPresent, isBlank, isArray} from '../../src/facade/lang';
import {BaseException} from '../../src/facade/exceptions';
import {CompileIdentifierMetadata} from '../compile_metadata';
import {

View File

@ -1,8 +1,6 @@
import {resolveForwardRef, Injectable, PipeMetadata, reflector} from '@angular/core';
import {
ReflectorReader
} from '../core_private';
import {ReflectorReader} from '../core_private';
import {Type, isPresent, stringify} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';

View File

@ -5,7 +5,8 @@ import {
AttrAst,
DirectiveAst,
ProviderAst,
ProviderAstType, ReferenceAst
ProviderAstType,
ReferenceAst
} from './template_ast';
import {
CompileTypeMetadata,

View File

@ -2,4 +2,3 @@ export class ElementSchemaRegistry {
hasProperty(tagName: string, propName: string): boolean { return true; }
getMappedPropName(propName: string): string { return propName; }
}

View File

@ -1,8 +1,5 @@
import {ViewEncapsulation, Injectable} from '@angular/core';
import {
CompileIdentifierMetadata,
CompileDirectiveMetadata
} from './compile_metadata';
import {CompileIdentifierMetadata, CompileDirectiveMetadata} from './compile_metadata';
import * as o from './output/output_ast';
import {ShadowCss} from './shadow_css';
import {UrlResolver} from './url_resolver';

View File

@ -4,10 +4,7 @@ import {ListWrapper} from '../../src/facade/collection';
import * as o from '../output/output_ast';
import {Identifiers} from '../identifiers';
import {
CompileQueryMetadata,
CompileTokenMap
} from '../compile_metadata';
import {CompileQueryMetadata, CompileTokenMap} from '../compile_metadata';
import {CompileView} from './compile_view';
import {CompileElement} from './compile_element';

View File

@ -20,7 +20,8 @@ import {
getViewFactoryName,
injectFromViewParentInjector,
createDiTokenExpression,
getPropertyInView, createPureProxy
getPropertyInView,
createPureProxy
} from './util';
import {CompilerConfig} from '../config';
import {CompileBinding} from './compile_binding';

View File

@ -5,9 +5,7 @@ import {
reflector,
} from '@angular/core';
import {
ReflectorReader
} from '../core_private';
import {ReflectorReader} from '../core_private';
import {Type, stringify, isBlank, isPresent} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';

View File

@ -13,8 +13,7 @@ export function getExpressions(): any {
export function emit() {
var emitter = new JavaScriptEmitter();
var emittedCode =
emitter.emitStatements(
assetUrl('compiler', 'output/output_emitter_codegen_untyped', 'test'),
emitter.emitStatements(assetUrl('compiler', 'output/output_emitter_codegen_untyped', 'test'),
codegenStmts, codegenExportsVars);
return emittedCode;
}

View File

@ -20,9 +20,12 @@ import {EventEmitter} from '@angular/core';
import {ViewType} from '@angular/core/src/linker/view_type';
import {BaseException} from '@angular/core';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {browserDetection} from '@angular/platform-browser/testing'
import {
browserDetection
} from '@angular/platform-browser/testing'
export function main() {
export function
main() {
var outputDefs = [];
outputDefs.push({
'getExpressions': () => interpretStatements(codegenStmts, 'getExpressions',

View File

@ -19,11 +19,8 @@ var testDataIdentifier = new CompileIdentifierMetadata({
runtime: ExternalClass
});
var eventEmitterIdentifier = new CompileIdentifierMetadata({
name: 'EventEmitter',
moduleUrl: assetUrl('core'),
runtime: EventEmitter
});
var eventEmitterIdentifier = new CompileIdentifierMetadata(
{name: 'EventEmitter', moduleUrl: assetUrl('core'), runtime: EventEmitter});
var enumIdentifier = new CompileIdentifierMetadata({
name: 'ViewType.HOST',
@ -31,11 +28,8 @@ var enumIdentifier = new CompileIdentifierMetadata({
runtime: ViewType.HOST
});
var baseExceptionIdentifier = new CompileIdentifierMetadata({
name: 'BaseException',
moduleUrl: assetUrl('core'),
runtime: BaseException
});
var baseExceptionIdentifier = new CompileIdentifierMetadata(
{name: 'BaseException', moduleUrl: assetUrl('core'), runtime: BaseException});
export var codegenExportsVars = [
'getExpressions',

View File

@ -16,17 +16,27 @@ import {
ComponentFixtureNoNgZone
} from '@angular/compiler/testing';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {Injectable, provide, Component, Input, ViewMetadata, ComponentResolver} from '@angular/core';
import {
Injectable,
provide,
Component,
Input,
ViewMetadata,
ComponentResolver
} from '@angular/core';
import {NgIf} from '@angular/common';
import {IS_DART} from '../src/facade/lang';
import {PromiseWrapper} from '../src/facade/promise';
import {dispatchEvent} from "@angular/platform-browser/testing";
import {withProviders} from "@angular/core/testing/test_injector"
import {
withProviders
} from "@angular/core/testing/test_injector"
@Component(
{selector: 'child-comp', template: `<span>Original {{childBinding}}</span>`, directives: []})
@Injectable()
class ChildComp {
@Component({
selector: 'child-comp',
template: `<span>Original {{childBinding}}</span>`,
directives: []
}) @Injectable() class ChildComp {
childBinding: string;
constructor() { this.childBinding = 'Child'; }
}

View File

@ -1,12 +1,5 @@
import {NgZone, NgZoneError} from './zone/ng_zone';
import {
Type,
isBlank,
isPresent,
assertionsEnabled,
lockMode,
isPromise
} from '../src/facade/lang';
import {Type, isBlank, isPresent, assertionsEnabled, lockMode, isPromise} from '../src/facade/lang';
import {Injector, Injectable} from './di';
import {PLATFORM_INITIALIZER, APP_INITIALIZER} from './application_tokens';
import {PromiseWrapper, ObservableWrapper} from '../src/facade/async';
@ -14,11 +7,7 @@ import {ListWrapper} from '../src/facade/collection';
import {TestabilityRegistry, Testability} from './testability/testability';
import {ComponentResolver} from './linker/component_resolver';
import {ComponentRef, ComponentFactory} from './linker/component_factory';
import {
BaseException,
ExceptionHandler,
unimplemented
} from '../src/facade/exceptions';
import {BaseException, ExceptionHandler, unimplemented} from '../src/facade/exceptions';
import {Console} from './console';
import {wtfLeave, wtfCreateScope, WtfScopeFn} from './profile/profile';
import {ChangeDetectorRef} from './change_detection/change_detector_ref';

View File

@ -1,8 +1,5 @@
import {looseIdentical, isPrimitive} from '../../src/facade/lang';
import {
isListLikeIterable,
areIterablesEqual
} from '../../src/facade/collection';
import {isListLikeIterable, areIterablesEqual} from '../../src/facade/collection';
export {looseIdentical} from '../../src/facade/lang';
export var uninitialized: Object = /*@ts2dart_const*/ new Object();

View File

@ -1,10 +1,5 @@
import {isPresent} from '../../src/facade/lang';
import {
Renderer,
RootRenderer,
RenderComponentType,
RenderDebugInfo
} from '../render/api';
import {Renderer, RootRenderer, RenderComponentType, RenderDebugInfo} from '../render/api';
import {
DebugNode,
DebugElement,

View File

@ -1,11 +1,4 @@
import {
normalizeBool,
Type,
isType,
isBlank,
isFunction,
stringify
} from '../../src/facade/lang';
import {normalizeBool, Type, isType, isBlank, isFunction, stringify} from '../../src/facade/lang';
import {BaseException} from '../../src/facade/exceptions';
/**

View File

@ -1,8 +1,4 @@
import {
isBlank,
isPresent,
looseIdentical
} from '../../src/facade/lang';
import {isBlank, isPresent, looseIdentical} from '../../src/facade/lang';
import {ListWrapper, StringMapWrapper} from '../../src/facade/collection';
import {BaseException} from '../../src/facade/exceptions';
import {AppElement} from './element';

View File

@ -1,11 +1,4 @@
import {
Type,
isPresent,
isFunction,
global,
stringify,
ConcreteType
} from '../../src/facade/lang';
import {Type, isPresent, isFunction, global, stringify, ConcreteType} from '../../src/facade/lang';
import {BaseException} from '../../src/facade/exceptions';
import {GetterFn, SetterFn, MethodFn} from './types';
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';

View File

@ -294,7 +294,8 @@ export function main() {
var childTestEls = fixture.debugElement.queryAll(By.css('child-comp'));
expect(childTestEls.length).toBe(1);
expect(getDOM().hasClass(childTestEls[0].nativeElement, 'child-comp-class')).toBe(true);
expect(getDOM().hasClass(childTestEls[0].nativeElement, 'child-comp-class'))
.toBe(true);
async.done();
});

View File

@ -1,14 +1,4 @@
import {
beforeEach,
ddescribe,
describe,
expect,
iit,
inject,
it,
xdescribe,
xit
} from '../testing';
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '../testing';
import {assertionsEnabled, IS_DART} from '../../router/src/facade/lang';

View File

@ -23,4 +23,6 @@ export function main() {
});
}
function identity(a) { return a; }
function identity(a) {
return a;
}

View File

@ -10,12 +10,7 @@ import {
it,
xit,
} from '@angular/core/testing/testing_internal';
import {
containsRegexp,
fakeAsync,
tick,
clearPendingTimers
} from '@angular/core/testing';
import {containsRegexp, fakeAsync, tick, clearPendingTimers} from '@angular/core/testing';
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
@ -163,14 +158,14 @@ function declareTests(isJit: boolean) {
.then((fixture) => {
fixture.debugElement.componentInstance.ctxProp = 'Initial aria label';
fixture.detectChanges();
expect(
getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement,
'aria-label'))
.toEqual('Initial aria label');
fixture.debugElement.componentInstance.ctxProp = 'Changed aria label';
fixture.detectChanges();
expect(
getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement,
'aria-label'))
.toEqual('Changed aria label');
async.done();
@ -187,12 +182,14 @@ function declareTests(isJit: boolean) {
fixture.debugElement.componentInstance.ctxProp = 'bar';
fixture.detectChanges();
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
expect(
getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
.toEqual('bar');
fixture.debugElement.componentInstance.ctxProp = null;
fixture.detectChanges();
expect(getDOM().hasAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
expect(
getDOM().hasAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
.toBeFalsy();
async.done();
@ -1087,7 +1084,8 @@ function declareTests(isJit: boolean) {
.then((fixture) => {
fixture.detectChanges();
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, "role"))
expect(
getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, "role"))
.toEqual("button");
async.done();
@ -1379,7 +1377,8 @@ function declareTests(isJit: boolean) {
}))
.createAsync(MyComp)
.then((fixture) => {
expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'script').length)
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'script').length)
.toEqual(0);
async.done();
});
@ -2531,7 +2530,8 @@ class DuplicateDir {
@Directive({selector: '[no-duplicate]'})
class OtherDuplicateDir {
constructor(elRef: ElementRef) {
getDOM().setText(elRef.nativeElement, getDOM().getText(elRef.nativeElement) + 'othernoduplicate');
getDOM().setText(elRef.nativeElement,
getDOM().getText(elRef.nativeElement) + 'othernoduplicate');
}
}

View File

@ -866,7 +866,9 @@ class NeedsViewChild implements AfterViewInit,
ngAfterViewInit() { this.logs.push(["init", isPresent(this.child) ? this.child.text : null]); }
ngAfterViewChecked() { this.logs.push(["check", isPresent(this.child) ? this.child.text : null]); }
ngAfterViewChecked() {
this.logs.push(["check", isPresent(this.child) ? this.child.text : null]);
}
}
@Directive({selector: '[dir]'})

View File

@ -10,13 +10,7 @@ import {
beforeEachProviders,
inject,
} from '@angular/core/testing/testing_internal';
import {
fakeAsync,
flushMicrotasks,
Log,
tick,
containsRegexp
} from '@angular/core/testing';
import {fakeAsync, flushMicrotasks, Log, tick, containsRegexp} from '@angular/core/testing';
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
import {isBlank} from '../../src/facade/lang';
import {

View File

@ -19,7 +19,9 @@ import {
HasGetterAndSetterDecorators
} from './reflector_common';
import {IS_DART} from '../../src/facade/lang';
import {browserDetection} from '@angular/platform-browser/testing'
import {
browserDetection
} from '@angular/platform-browser/testing'
class AType {
value;

View File

@ -1,13 +1,4 @@
import {
describe,
it,
iit,
ddescribe,
expect,
tick,
beforeEach,
containsRegexp
} from '../testing';
import {describe, it, iit, ddescribe, expect, tick, beforeEach, containsRegexp} from '../testing';
import {SpyObject} from '@angular/core/testing/testing_internal';
import {MapWrapper} from '../../platform-browser/src/facade/collection';

View File

@ -9,9 +9,7 @@ import {
xdescribe,
xit,
} from '@angular/core/testing/testing_internal';
import {
Log
} from '@angular/core/testing';
import {Log} from '@angular/core/testing';
import {
PromiseCompleter,

View File

@ -7,4 +7,3 @@ export function containsRegexp(input: string): RegExp {
return RegExpWrapper.create(
StringWrapper.replaceAllMapped(input, _ESCAPE_RE, (match) => `\\${match[0]}`));
}

View File

@ -2,13 +2,7 @@
* Public Test Library for unit testing Angular2 Applications. Uses the
* Jasmine framework.
*/
import {
inject,
async,
injectAsync,
TestInjector,
getTestInjector
} from './test_injector';
import {inject, async, injectAsync, TestInjector, getTestInjector} from './test_injector';
import {isPromise} from '../src/facade/lang';

View File

@ -9,7 +9,7 @@ class MyApp {
}
var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
var appInjector =
ReflectiveInjector.resolveAndCreate([BROWSER_APP_STATIC_PROVIDERS, appProviders], platform.injector);
var appInjector = ReflectiveInjector.resolveAndCreate([BROWSER_APP_STATIC_PROVIDERS, appProviders],
platform.injector);
coreLoadAndBootstrap(appInjector, MyApp);
// #enddocregion

View File

@ -1,11 +1,4 @@
import {
isJsObject,
global,
isPresent,
isBlank,
isArray,
getSymbolIterator
} from './lang';
import {isJsObject, global, isPresent, isBlank, isArray, getSymbolIterator} from './lang';
export var Map = global.Map;
export var Set = global.Set;

View File

@ -10,13 +10,7 @@ import {
} from '@angular/core/testing/testing_internal';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {browserDetection} from '@angular/platform-browser/testing';
import {
ObservableWrapper,
Observable,
Subject,
EventEmitter,
PromiseWrapper
} from '../src/async';
import {ObservableWrapper, Observable, Subject, EventEmitter, PromiseWrapper} from '../src/async';
export function main() {
describe('EventEmitter', () => {

View File

@ -96,10 +96,7 @@ var COMMON: string[] = [
'NgPluralCase'
];
var COMMON_TESTING: string[] = [
'MockLocationStrategy',
'SpyLocation'
];
var COMMON_TESTING: string[] = ['MockLocationStrategy', 'SpyLocation'];
var COMPILER: string[] = [
'ElementSchemaRegistry',
@ -406,19 +403,13 @@ var PLATFORM_BROWSER_DYNAMIC: string[] = [
'UrlChangeListener:dart'
];
var PLATFORM_BROWSER_DYNAMIC_TESTING: string[] = [
'TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS',
'TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS'
];
var PLATFORM_BROWSER_DYNAMIC_TESTING: string[] =
['TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS', 'TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS'];
var PLATFORM_SERVER: string[] = [
'Parse5DomAdapter'
];
var PLATFORM_SERVER: string[] = ['Parse5DomAdapter'];
var PLATFORM_SERVER_TESTING: string[] = [
'TEST_SERVER_APPLICATION_PROVIDERS',
'TEST_SERVER_PLATFORM_PROVIDERS'
];
var PLATFORM_SERVER_TESTING: string[] =
['TEST_SERVER_APPLICATION_PROVIDERS', 'TEST_SERVER_PLATFORM_PROVIDERS'];
var UPGRADE: string[] = [
'UpgradeAdapter',
@ -452,10 +443,7 @@ var HTTP: string[] = [
'XHRConnection'
];
var HTTP_TESTING: string[] = [
'MockBackend',
'MockConnection'
];
var HTTP_TESTING: string[] = ['MockBackend', 'MockConnection'];
var ROUTER: string[] = [
'AsyncRoute',
@ -480,8 +468,7 @@ var ROUTER: string[] = [
'RouterOutlet'
];
var ROUTER_TESTING: string[] = [
];
var ROUTER_TESTING: string[] = [];
var API = {

View File

@ -14,7 +14,8 @@ export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
/**
* An array of providers that should be passed into `application()` when bootstrapping a component.
*/
export const BROWSER_APP_DYNAMIC_PROVIDERS: Array<any /*Type | Provider | any[]*/> = /*@ts2dart_const*/ [
export const BROWSER_APP_DYNAMIC_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[
BROWSER_APP_COMMON_PROVIDERS,
COMPILER_PROVIDERS,
{provide: XHR, useClass: XHRImpl},

View File

@ -4,6 +4,7 @@ export type RenderDebugInfo = t.RenderDebugInfo;
export var RenderDebugInfo: typeof t.RenderDebugInfo = r.RenderDebugInfo;
export var wtfInit: typeof t.wtfInit = r.wtfInit;
export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities;
export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES = r.VIEW_ENCAPSULATION_VALUES;
export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES =
r.VIEW_ENCAPSULATION_VALUES;
export type DebugDomRootRenderer = t.DebugDomRootRenderer;
export var DebugDomRootRenderer: typeof t.DebugDomRootRenderer = r.DebugDomRootRenderer;

View File

@ -11,13 +11,9 @@ export namespace __platform_browser_private__ {
export type DomAdapter = dom_adapter.DomAdapter;
export var DomAdapter = dom_adapter.DomAdapter;
export function getDOM():DomAdapter{
return dom_adapter.getDOM();
}
export function getDOM(): DomAdapter { return dom_adapter.getDOM(); }
export function setDOM(adapter:DomAdapter){
return dom_adapter.setDOM(adapter);
}
export function setDOM(adapter: DomAdapter) { return dom_adapter.setDOM(adapter); }
export var setRootDomAdapter = dom_adapter.setRootDomAdapter;
@ -27,7 +23,7 @@ export namespace __platform_browser_private__ {
export type AnimationBuilder = animation_builder.AnimationBuilder;
export var AnimationBuilder = animation_builder.AnimationBuilder;
export type CssAnimationBuilder = css_animation_builder.CssAnimationBuilder
export type CssAnimationBuilder = css_animation_builder.CssAnimationBuilder;
export var CssAnimationBuilder = css_animation_builder.CssAnimationBuilder;
export type CssAnimationOptions = css_animation_options.CssAnimationOptions;

View File

@ -120,7 +120,8 @@ export class Animation {
* @param classes
*/
removeClasses(classes: string[]): void {
for (let i = 0, len = classes.length; i < len; i++) getDOM().removeClass(this.element, classes[i]);
for (let i = 0, len = classes.length; i < len; i++)
getDOM().removeClass(this.element, classes[i]);
}
/**
@ -128,8 +129,9 @@ export class Animation {
*/
addEvents(): void {
if (this.totalTime > 0) {
this.eventClearFunctions.push(getDOM().onAndCancel(
this.element, getDOM().getTransitionEnd(), (event: any) => this.handleAnimationEvent(event)));
this.eventClearFunctions.push(
getDOM().onAndCancel(this.element, getDOM().getTransitionEnd(),
(event: any) => this.handleAnimationEvent(event)));
} else {
this.handleAnimationCompleted();
}

View File

@ -14,7 +14,8 @@ export class BrowserDetails {
*/
doesElapsedTimeIncludesDelay(): void {
var div = getDOM().createElement('div');
getDOM().setAttribute(div, 'style', `position: absolute; top: -9999px; left: -9999px; width: 1px;
getDOM().setAttribute(div, 'style',
`position: absolute; top: -9999px; left: -9999px; width: 1px;
height: 1px; transition: all 1ms linear 1ms;`);
// Firefox requires that we wait for 2 frames for some reason
this.raf((timestamp: any) => {

View File

@ -28,7 +28,7 @@ import {
HAMMER_GESTURE_CONFIG,
HammerGestureConfig,
HammerGesturesPlugin
} from './dom/events/hammer_gestures'
} from './dom/events/hammer_gestures';
import {DomSharedStylesHost} from './dom/shared_styles_host';
import {AnimationBuilder} from './animate/animation_builder';
import {BrowserDetails} from './animate/browser_details';
@ -97,7 +97,8 @@ export {
} from '../src/dom/events/hammer_gestures'
export function initDomAdapter() {
export function
initDomAdapter() {
BrowserDomAdapter.makeCurrent();
wtfInit();
BrowserGetTestability.init();

View File

@ -1,4 +1,11 @@
import {DebugNode, getDebugNode, Provider, RootRenderer, NgZone, ApplicationRef} from '@angular/core';
import {
DebugNode,
getDebugNode,
Provider,
RootRenderer,
NgZone,
ApplicationRef
} from '@angular/core';
import {DebugDomRootRenderer} from '../../../core_private';
import {assertionsEnabled} from '../../facade/lang';
import {getDOM} from '../dom_adapter';

View File

@ -7,7 +7,7 @@ import {
RenderComponentType,
ViewEncapsulation
} from '@angular/core';
import {RenderDebugInfo} from '../../core_private'
import {RenderDebugInfo} from '../../core_private';
import {AnimationBuilder} from '../animate/animation_builder';
import {
isPresent,
@ -201,7 +201,8 @@ export class DomRenderer implements Renderer {
var dashCasedPropertyName = camelCaseToDashCase(propertyName);
if (getDOM().isCommentNode(renderElement)) {
var existingBindings = RegExpWrapper.firstMatch(
TEMPLATE_BINDINGS_EXP, StringWrapper.replaceAll(getDOM().getText(renderElement), /\n/g, ''));
TEMPLATE_BINDINGS_EXP,
StringWrapper.replaceAll(getDOM().getText(renderElement), /\n/g, ''));
var parsedBindings = Json.parse(existingBindings[1]);
parsedBindings[dashCasedPropertyName] = propertyValue;
getDOM().setText(renderElement, StringWrapper.replace(TEMPLATE_COMMENT_TEXT, '{}',

View File

@ -9,7 +9,11 @@ import {
} from '@angular/core';
import {Type, isPresent, isBlank} from './facade/lang';
import {BROWSER_APP_COMMON_PROVIDERS, BROWSER_PROVIDERS, BROWSER_PLATFORM_MARKER} from './browser_common';
import {
BROWSER_APP_COMMON_PROVIDERS,
BROWSER_PROVIDERS,
BROWSER_PLATFORM_MARKER
} from './browser_common';
export {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
export {BrowserPlatformLocation} from './browser/location/browser_platform_location';
export {
@ -45,8 +49,8 @@ export function bootstrapStatic(appComponentType: Type,
initReflector();
}
let appProviders =
isPresent(customProviders) ? [BROWSER_APP_STATIC_PROVIDERS, customProviders] : BROWSER_APP_STATIC_PROVIDERS;
let appProviders = isPresent(customProviders) ? [BROWSER_APP_STATIC_PROVIDERS, customProviders] :
BROWSER_APP_STATIC_PROVIDERS;
var appInjector =
ReflectiveInjector.resolveAndCreate(appProviders, browserStaticPlatform().injector);
return coreLoadAndBootstrap(appInjector, appComponentType);

View File

@ -4,10 +4,7 @@ import {
import {UrlChangeListener} from '@angular/common';
import {Injectable} from '@angular/core/src/di';
import {ROUTER_CHANNEL} from '../shared/messaging_api';
import {
ServiceMessageBrokerFactory,
ServiceMessageBroker
} from '../shared/service_message_broker';
import {ServiceMessageBrokerFactory, ServiceMessageBroker} from '../shared/service_message_broker';
import {PRIMITIVE, Serializer} from '../shared/serializer';
import {bind} from './bind';
import {LocationType} from '../shared/serialized_types';

View File

@ -34,7 +34,9 @@ import {
ClientMessageBrokerFactory,
ClientMessageBrokerFactory_
} from '../web_workers/shared/client_message_broker';
import {BrowserPlatformLocation} from '@angular/platform-browser/src/browser/location/browser_platform_location';
import {
BrowserPlatformLocation
} from '@angular/platform-browser/src/browser/location/browser_platform_location';
import {Serializer} from '../web_workers/shared/serializer';
import {ON_WEB_WORKER} from '../web_workers/shared/api';
import {RenderStore} from '../web_workers/shared/render_store';

View File

@ -12,10 +12,7 @@ import {
assertPlatform
} from '@angular/core';
export {
WORKER_APP_PLATFORM,
WORKER_APP_APPLICATION_COMMON
} from './webworker/worker_app_common';
export {WORKER_APP_PLATFORM, WORKER_APP_APPLICATION_COMMON} from './webworker/worker_app_common';
export {WORKER_APP_APPLICATION} from './webworker/worker_app';
export {
ClientMessageBroker,

View File

@ -216,7 +216,8 @@ export function main() {
it('should unregister change detectors when components are disposed',
inject([AsyncTestCompleter], (async) => {
var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
var app = ReflectiveInjector.resolveAndCreate([BROWSER_APP_DYNAMIC_PROVIDERS, testProviders],
var app =
ReflectiveInjector.resolveAndCreate([BROWSER_APP_DYNAMIC_PROVIDERS, testProviders],
platform.injector)
.get(ApplicationRef);
coreLoadAndBootstrap(app.injector, HelloRootCmp)

View File

@ -12,7 +12,10 @@ import {DomEventsPlugin} from '@angular/platform-browser/src/dom/events/dom_even
import {NgZone} from '@angular/core/src/zone/ng_zone';
import {ListWrapper, Map} from '../../../src/facade/collection';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {EventManager, EventManagerPlugin} from '@angular/platform-browser/src/dom/events/event_manager';
import {
EventManager,
EventManagerPlugin
} from '@angular/platform-browser/src/dom/events/event_manager';
import {el} from '../../../testing/browser_util';
export function main() {

View File

@ -8,7 +8,9 @@ import {
} from '@angular/core/testing/testing_internal';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {SpyMessageBroker} from './spies';
import {WebWorkerPlatformLocation} from '@angular/platform-browser/src/web_workers/worker/platform_location';
import {
WebWorkerPlatformLocation
} from '@angular/platform-browser/src/web_workers/worker/platform_location';
import {LocationType} from '@angular/platform-browser/src/web_workers/shared/serialized_types';
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
import {

View File

@ -89,8 +89,7 @@ export function main() {
uiRenderStore = new RenderStore();
var testUiInjector = new TestInjector();
testUiInjector.platformProviders = TEST_BROWSER_STATIC_PLATFORM_PROVIDERS;
testUiInjector.applicationProviders = TEST_BROWSER_STATIC_APPLICATION_PROVIDERS
;
testUiInjector.applicationProviders = TEST_BROWSER_STATIC_APPLICATION_PROVIDERS;
testUiInjector.addProviders([
Serializer,
provide(RenderStore, {useValue: uiRenderStore}),
@ -225,7 +224,8 @@ export function main() {
getRenderer(fixture.componentRef)
.invokeElementMethod(el.nativeElement, 'setAttribute', ['a', 'b']);
expect(getDOM().getAttribute(getRenderElement(el.nativeElement), 'a')).toEqual('b');
expect(getDOM().getAttribute(getRenderElement(el.nativeElement), 'a'))
.toEqual('b');
async.done();
});
}));

View File

@ -1,4 +1,6 @@
import {ClientMessageBroker} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
import {
ClientMessageBroker
} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
import {SpyObject, proxy} from '@angular/core/testing/testing_internal';

View File

@ -61,7 +61,4 @@ export const ADDITIONAL_TEST_BROWSER_PROVIDERS: Array<any /*Type | Provider | an
* Default application providers for testing without a compiler.
*/
export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[
BROWSER_APP_COMMON_PROVIDERS,
ADDITIONAL_TEST_BROWSER_PROVIDERS
];
/*@ts2dart_const*/[BROWSER_APP_COMMON_PROVIDERS, ADDITIONAL_TEST_BROWSER_PROVIDERS];

View File

@ -14,9 +14,7 @@ export class BrowserDetection {
static setup() { browserDetection = new BrowserDetection(null); }
constructor(ua: string) {
this._overrideUa = ua;
}
constructor(ua: string) { this._overrideUa = ua; }
get isFirefox(): boolean { return this._ua.indexOf('Firefox') > -1; }

View File

@ -5,4 +5,3 @@ export var SelectorMatcher: typeof _.SelectorMatcher = _.SelectorMatcher;
export type CssSelector = typeof _.CssSelector;
export var CssSelector: typeof _.CssSelector = _.CssSelector;

View File

@ -2,14 +2,7 @@ var parse5 = require('parse5/index');
import {ListWrapper, StringMapWrapper} from '../src/facade/collection';
import {DomAdapter, setRootDomAdapter} from '../platform_browser_private';
import {
isPresent,
isBlank,
global,
Type,
setValueOnPath,
DateWrapper
} from '../src/facade/lang';
import {isPresent, isBlank, global, Type, setValueOnPath, DateWrapper} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';
import {SelectorMatcher, CssSelector} from '../compiler_private';
import {XHR} from '@angular/compiler';

View File

@ -23,7 +23,10 @@ import {DOCUMENT} from '@angular/platform-browser';
import {getDOM} from '../platform_browser_private';
import {RootRenderer} from '@angular/core';
import {DomRootRenderer, DomRootRenderer_} from '../../platform-browser/src/dom/dom_renderer';
import {DomSharedStylesHost, SharedStylesHost} from '../../platform-browser/src/dom/shared_styles_host';
import {
DomSharedStylesHost,
SharedStylesHost
} from '../../platform-browser/src/dom/shared_styles_host';
import {
EventManager,
EVENT_MANAGER_PLUGINS,

View File

@ -34,7 +34,8 @@ export class RootCmp {
activatedCmp: any;
}
export function compile(tcb: TestComponentBuilder,
export function compile(
tcb: TestComponentBuilder,
template: string = "<router-outlet></router-outlet>"): Promise<ComponentFixture<RootCmp>> {
return tcb.overrideTemplate(RootCmp, ('<div>' + template + '</div>')).createAsync(RootCmp);
}

View File

@ -2,7 +2,12 @@ import {OnInit, provide, ReflectiveInjector, ComponentResolver} from '@angular/c
import {RouterOutlet} from './directives/router_outlet';
import {Type, isBlank, isPresent} from '@angular/facade/src/lang';
import {ListWrapper} from '@angular/facade/src/collection';
import {EventEmitter, Observable, PromiseWrapper, ObservableWrapper} from '@angular/facade/src/async';
import {
EventEmitter,
Observable,
PromiseWrapper,
ObservableWrapper
} from '@angular/facade/src/async';
import {StringMapWrapper} from '@angular/facade/src/collection';
import {BaseException} from '@angular/core';
import {RouterUrlSerializer} from './router_url_serializer';

View File

@ -1,7 +1,5 @@
import {ROUTER_PROVIDERS_COMMON} from './router_providers_common';
import {
BrowserPlatformLocation
} from '@angular/platform-browser';
import {BrowserPlatformLocation} from '@angular/platform-browser';
import {PlatformLocation} from '@angular/common';
export const ROUTER_PROVIDERS: any[] = /*@ts2dart_const*/[

View File

@ -1,6 +1,9 @@
import {PromiseWrapper} from '@angular/facade';
import {Component} from '@angular/core';
import {ServiceMessageBrokerFactory, PRIMITIVE} from '../../../../@angular/platform-browser/src/worker_app';
import {
ServiceMessageBrokerFactory,
PRIMITIVE
} from '../../../../@angular/platform-browser/src/worker_app';
const ECHO_CHANNEL = "ECHO";

View File

@ -1,5 +1,8 @@
import {Provider} from '@angular/core';
import {bootstrapApp, WORKER_APP_ROUTER} from '../../../../@angular/platform-browser/src/worker_app';
import {
bootstrapApp,
WORKER_APP_ROUTER
} from '../../../../@angular/platform-browser/src/worker_app';
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
import {App} from './index_common';

View File

@ -1,3 +1,6 @@
import {bootstrapRender, WORKER_RENDER_ROUTER} from '../../../../@angular/platform-browser/src/worker_render';
import {
bootstrapRender,
WORKER_RENDER_ROUTER
} from '../../../../@angular/platform-browser/src/worker_render';
bootstrapRender("loader.js", WORKER_RENDER_ROUTER);

View File

@ -1,12 +1,8 @@
import {Component} from '@angular/core';
import {bootstrap} from '@angular/platform-browser-dynamic';
@Component({
selector: 'hello-world',
template: 'hello world!!!'
})
@Component({selector: 'hello-world', template: 'hello world!!!'})
class HelloWorldComponent {
}
bootstrap(HelloWorldComponent);

View File

@ -3,6 +3,8 @@
set -e -o pipefail
cd `dirname $0`
gulp lint
gulp check-format
export NODE_PATH=$NODE_PATH:$(pwd)/dist/all
./build.sh;
$(npm bin)/tsc -p tools

View File

@ -31,7 +31,8 @@ if (globsIndex < 0) {
args = process.argv.slice(globsIndex + 1);
}
var specFiles = args.map(function(globstr) {
var specFiles =
args.map(function(globstr) {
return glob.sync(globstr, {
cwd: distAll,
ignore: [
@ -50,9 +51,8 @@ var specFiles = args.map(function(globstr) {
'payload_tests/**'
]
});
}).reduce(function(specFiles, paths) {
return specFiles.concat(paths);
}, []);
})
.reduce(function(specFiles, paths) { return specFiles.concat(paths); }, []);
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
@ -69,4 +69,3 @@ specFiles.forEach((file) => {
if (r.main) r.main();
});
jrunner.execute();

View File

@ -1,6 +1,13 @@
/// <reference path="../../typings/jasmine/jasmine.d.ts" />
import {describe, it, iit, expect, ddescribe, beforeEach} from '@angular/core/testing/testing_internal';
import {
describe,
it,
iit,
expect,
ddescribe,
beforeEach
} from '@angular/core/testing/testing_internal';
import {isBlank} from '@angular/facade/src/lang';
import {ListWrapper} from '@angular/facade/src/collection';

View File

@ -4,14 +4,17 @@ import {writeFileSync, mkdirSync, existsSync} from 'fs';
export * from './tsc_watch';
import 'reflect-metadata';
const OFFLINE_COMPILE = [
const OFFLINE_COMPILE =
[
'output/output_emitter_codegen_untyped',
'output/output_emitter_codegen_typed',
'offline_compiler_codegen_untyped',
'offline_compiler_codegen_typed'
]
function processOutputEmitterCodeGen():Promise<number> {
function
processOutputEmitterCodeGen():
Promise<number> {
return new Promise((resolve, reject) => {
var outDir = 'dist/all/@angular/compiler/test/';
var promises = [];
@ -20,24 +23,31 @@ function processOutputEmitterCodeGen():Promise<number> {
var codegen = require('../../all/@angular/compiler/test/' + file + '.js');
if (codegen.emit) {
console.log(` ${file} has changed, regenerating...`);
promises.push(Promise.resolve(codegen.emit()).then((code) => {
writeFileSync(outDir + file + '.ts', code);
}));
promises.push(
Promise.resolve(codegen.emit())
.then((code) => { writeFileSync(outDir + file + '.ts', code); }));
}
});
if (promises.length) {
Promise.all(promises).then(() => {
var args = ['--project', 'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json'];
Promise.all(promises)
.then(() => {
var args = [
'--project',
'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json'
];
console.log(' compiling changes: tsc ' + args.join(' '));
var tsc = spawn(TSC, args, {stdio: 'pipe'});
tsc.stdout.on('data', (data) => process.stdout.write(data));
tsc.stderr.on('data', (data) => process.stderr.write(data));
tsc.on('close', (code) => code ? reject('Tsc exited with: ' + code) : resolve(code));
}).catch(reportError);
tsc.on('close', (code) => code ? reject('Tsc exited with: ' + code) :
resolve(code));
})
.catch(reportError);
} else {
resolve(0);
}
}).catch(reportError);
})
.catch(reportError);
}
function md(dir: string, folders: string[]) {
@ -72,12 +82,9 @@ if (platform == 'node') {
start: 'File change detected. Starting incremental compilation...',
error: 'error',
complete: 'Compilation complete. Watching for file changes.',
onStartCmds: [
['node', 'node_modules/karma/bin/karma', 'start', '--no-auto-watch', 'karma-js.conf.js']
],
onChangeCmds: [
['node', 'node_modules/karma/bin/karma', 'run', 'karma-js.conf.js']
]
onStartCmds:
[['node', 'node_modules/karma/bin/karma', 'start', '--no-auto-watch', 'karma-js.conf.js']],
onChangeCmds: [['node', 'node_modules/karma/bin/karma', 'run', 'karma-js.conf.js']]
});
}

View File

@ -2,7 +2,9 @@ import {spawn} from 'child_process';
import {resolve} from 'url';
enum State {
idle, waiting, error
idle,
waiting,
error
}
export const TSC = 'node_modules/typescript/bin/tsc';
@ -19,10 +21,14 @@ export class TscWatch {
private triggered: Promise<number> = null;
private runOnce: boolean = false;
constructor({tsconfig, start, error, complete, onStartCmds=null, onChangeCmds=null}:
{tsconfig:string, error:string|RegExp, start:string, complete:string,
onStartCmds?:Array<string[]|Command>, onChangeCmds?:Array<string[]|Command>})
{
constructor({tsconfig, start, error, complete, onStartCmds = null, onChangeCmds = null}: {
tsconfig: string,
error: string | RegExp,
start: string,
complete: string,
onStartCmds?: Array<string[] | Command>,
onChangeCmds?: Array<string[] | Command>
}) {
console.log('Watching:', tsconfig, 'in', process.cwd());
this.tsconfig = tsconfig;
this.start = start;
@ -35,7 +41,8 @@ export class TscWatch {
watch() {
var args = [TSC, '--project', this.tsconfig];
if (!this.runOnce) args.push('--watch');
var tsc = this.runCmd(args, {}, (d) => this.consumeLine(d, false), (d) => this.consumeLine(d, true));
var tsc =
this.runCmd(args, {}, (d) => this.consumeLine(d, false), (d) => this.consumeLine(d, true));
if (this.runOnce) {
tsc.then(() => this.triggerCmds(), code => process.exit(code));
}
@ -43,9 +50,8 @@ export class TscWatch {
this.onStartCmds.forEach((cmd) => this.runCmd(cmd, () => null, () => null));
}
private runCmd(argsOrCmd: string[]|Command, env?,
stdOut = pipeStdOut, stdErr = pipeStdErr):Promise<number>
{
private runCmd(argsOrCmd: string[] | Command, env?, stdOut = pipeStdOut,
stdErr = pipeStdErr): Promise<number> {
if (typeof argsOrCmd == 'function') {
return (argsOrCmd as Command)(stdErr, stdOut);
} else if (argsOrCmd instanceof Array) {
@ -63,7 +69,8 @@ export class TscWatch {
code ? reject(code) : resolve(code);
});
process.on('exit', onExit);
}).catch(reportError);
})
.catch(reportError);
} else {
throw new Error('Expecting function or an array of strings...');
}
@ -92,7 +99,8 @@ export class TscWatch {
this.state = State.idle;
} else {
if (this.triggered) {
this.triggered.then(() => this.triggerCmds(), (e) => {console.log("Error while running commands....", e)});
this.triggered.then(() => this.triggerCmds(),
(e) => {console.log("Error while running commands....", e)});
} else {
this.triggerCmds();
}
@ -104,11 +112,9 @@ export class TscWatch {
triggerCmds() {
var cmdPromise: Promise<number> = Promise.resolve();
this.onChangeCmds.forEach((cmd:string[]|Command) => {
cmdPromise = cmdPromise.then(() => {
this.onChangeCmds.forEach((cmd: string[] | Command) => {cmdPromise = cmdPromise.then(() => {
return this.runCmd(<string[]>cmd);
})
});
})});
cmdPromise.then(() => this.triggered = null, (code) => {
if (this.runOnce) {
if (typeof code != 'number') {
@ -153,5 +159,9 @@ export function reportError(e) {
return Promise.reject(e);
}
function pipeStdOut(d) { process.stdout.write(d); }
function pipeStdErr(d) { process.stderr.write(d); }
function pipeStdOut(d) {
process.stdout.write(d);
}
function pipeStdErr(d) {
process.stderr.write(d);
}