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) => { gulp.on('task_start', (e) => {
if (firstTask) { if (firstTask) {
firstTask = false; firstTask = false;

View File

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

View File

@ -7,7 +7,8 @@
* to read information * to read information
* from the form DOM elements. * 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'; export {AbstractControl, Control, ControlGroup, ControlArray} from './forms/model';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,12 +8,7 @@ import {
beforeEach, beforeEach,
afterEach afterEach
} from '@angular/core/testing/testing_internal'; } from '@angular/core/testing/testing_internal';
import { import {fakeAsync, flushMicrotasks, Log, tick} from '@angular/core/testing';
fakeAsync,
flushMicrotasks,
Log,
tick
} from '@angular/core/testing';
import {ControlGroup, Control, Validators, AbstractControl, ControlArray} from '@angular/common'; import {ControlGroup, Control, Validators, AbstractControl, ControlArray} from '@angular/common';
import {PromiseWrapper} from '../../src/facade/promise'; import {PromiseWrapper} from '../../src/facade/promise';
import {EventEmitter, ObservableWrapper, TimerWrapper} from '../../src/facade/async'; 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 SpyNgControl extends SpyObject {}
export class SpyValueAccessor extends SpyObject { export class SpyValueAccessor extends SpyObject { writeValue: any; }
writeValue: any;
}

View File

@ -1,16 +1,19 @@
import {__core_private__ as r, __core_private_types__ as t} from '@angular/core'; 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 type ChangeDetectorState = t.ChangeDetectorState;
export var ChangeDetectorState: typeof t.ChangeDetectorState = r.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 var constructDependencies: typeof t.constructDependencies = r.constructDependencies;
export type LifecycleHooks = t.LifecycleHooks; export type LifecycleHooks = t.LifecycleHooks;
export var LifecycleHooks: typeof t.LifecycleHooks = r.LifecycleHooks; export var LifecycleHooks: typeof t.LifecycleHooks = r.LifecycleHooks;
export var LIFECYCLE_HOOKS_VALUES: typeof t.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES; export var LIFECYCLE_HOOKS_VALUES: typeof t.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES;
export type ReflectorReader = t.ReflectorReader; export type ReflectorReader = t.ReflectorReader;
export var ReflectorReader: typeof t.ReflectorReader = r.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 type AppElement = t.AppElement;
export var AppElement: typeof t.AppElement = r.AppElement; export var AppElement: typeof t.AppElement = r.AppElement;
export var AppView: typeof t.AppView = r.AppView; 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 ViewType: typeof t.ViewType = r.ViewType;
export var MAX_INTERPOLATION_VALUES: typeof t.MAX_INTERPOLATION_VALUES = r.MAX_INTERPOLATION_VALUES; export var MAX_INTERPOLATION_VALUES: typeof t.MAX_INTERPOLATION_VALUES = r.MAX_INTERPOLATION_VALUES;
export var checkBinding: typeof t.checkBinding = r.checkBinding; 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 interpolate: typeof t.interpolate = r.interpolate;
export var ViewUtils: typeof t.ViewUtils = r.ViewUtils; 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 DebugContext: typeof t.DebugContext = r.DebugContext;
export var StaticNodeDebugInfo: typeof t.StaticNodeDebugInfo = r.StaticNodeDebugInfo; export var StaticNodeDebugInfo: typeof t.StaticNodeDebugInfo = r.StaticNodeDebugInfo;
export var devModeEqual: typeof t.devModeEqual = r.devModeEqual; 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 var castByValue: typeof t.castByValue = r.castByValue;
export type Console = t.Console; export type Console = t.Console;
export var Console: typeof t.Console = r.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); (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> { export class CompileTokenMap<VALUE> {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,5 @@
import {ViewEncapsulation, Injectable} from '@angular/core'; import {ViewEncapsulation, Injectable} from '@angular/core';
import { import {CompileIdentifierMetadata, CompileDirectiveMetadata} from './compile_metadata';
CompileIdentifierMetadata,
CompileDirectiveMetadata
} from './compile_metadata';
import * as o from './output/output_ast'; import * as o from './output/output_ast';
import {ShadowCss} from './shadow_css'; import {ShadowCss} from './shadow_css';
import {UrlResolver} from './url_resolver'; 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 * as o from '../output/output_ast';
import {Identifiers} from '../identifiers'; import {Identifiers} from '../identifiers';
import { import {CompileQueryMetadata, CompileTokenMap} from '../compile_metadata';
CompileQueryMetadata,
CompileTokenMap
} from '../compile_metadata';
import {CompileView} from './compile_view'; import {CompileView} from './compile_view';
import {CompileElement} from './compile_element'; import {CompileElement} from './compile_element';

View File

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

View File

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

View File

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

View File

@ -20,9 +20,12 @@ import {EventEmitter} from '@angular/core';
import {ViewType} from '@angular/core/src/linker/view_type'; import {ViewType} from '@angular/core/src/linker/view_type';
import {BaseException} from '@angular/core'; import {BaseException} from '@angular/core';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; 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 = []; var outputDefs = [];
outputDefs.push({ outputDefs.push({
'getExpressions': () => interpretStatements(codegenStmts, 'getExpressions', 'getExpressions': () => interpretStatements(codegenStmts, 'getExpressions',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -294,7 +294,8 @@ export function main() {
var childTestEls = fixture.debugElement.queryAll(By.css('child-comp')); var childTestEls = fixture.debugElement.queryAll(By.css('child-comp'));
expect(childTestEls.length).toBe(1); 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(); async.done();
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -96,10 +96,7 @@ var COMMON: string[] = [
'NgPluralCase' 'NgPluralCase'
]; ];
var COMMON_TESTING: string[] = [ var COMMON_TESTING: string[] = ['MockLocationStrategy', 'SpyLocation'];
'MockLocationStrategy',
'SpyLocation'
];
var COMPILER: string[] = [ var COMPILER: string[] = [
'ElementSchemaRegistry', 'ElementSchemaRegistry',
@ -406,19 +403,13 @@ var PLATFORM_BROWSER_DYNAMIC: string[] = [
'UrlChangeListener:dart' 'UrlChangeListener:dart'
]; ];
var PLATFORM_BROWSER_DYNAMIC_TESTING: string[] = [ var PLATFORM_BROWSER_DYNAMIC_TESTING: string[] =
'TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS', ['TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS', 'TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS'];
'TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS'
];
var PLATFORM_SERVER: string[] = [ var PLATFORM_SERVER: string[] = ['Parse5DomAdapter'];
'Parse5DomAdapter'
];
var PLATFORM_SERVER_TESTING: string[] = [ var PLATFORM_SERVER_TESTING: string[] =
'TEST_SERVER_APPLICATION_PROVIDERS', ['TEST_SERVER_APPLICATION_PROVIDERS', 'TEST_SERVER_PLATFORM_PROVIDERS'];
'TEST_SERVER_PLATFORM_PROVIDERS'
];
var UPGRADE: string[] = [ var UPGRADE: string[] = [
'UpgradeAdapter', 'UpgradeAdapter',
@ -452,10 +443,7 @@ var HTTP: string[] = [
'XHRConnection' 'XHRConnection'
]; ];
var HTTP_TESTING: string[] = [ var HTTP_TESTING: string[] = ['MockBackend', 'MockConnection'];
'MockBackend',
'MockConnection'
];
var ROUTER: string[] = [ var ROUTER: string[] = [
'AsyncRoute', 'AsyncRoute',
@ -480,8 +468,7 @@ var ROUTER: string[] = [
'RouterOutlet' 'RouterOutlet'
]; ];
var ROUTER_TESTING: string[] = [ var ROUTER_TESTING: string[] = [];
];
var API = { 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. * 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, BROWSER_APP_COMMON_PROVIDERS,
COMPILER_PROVIDERS, COMPILER_PROVIDERS,
{provide: XHR, useClass: XHRImpl}, {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 RenderDebugInfo: typeof t.RenderDebugInfo = r.RenderDebugInfo;
export var wtfInit: typeof t.wtfInit = r.wtfInit; export var wtfInit: typeof t.wtfInit = r.wtfInit;
export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities; 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 type DebugDomRootRenderer = t.DebugDomRootRenderer;
export var DebugDomRootRenderer: typeof t.DebugDomRootRenderer = r.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 type DomAdapter = dom_adapter.DomAdapter;
export var DomAdapter = dom_adapter.DomAdapter; export var DomAdapter = dom_adapter.DomAdapter;
export function getDOM():DomAdapter{ export function getDOM(): DomAdapter { return dom_adapter.getDOM(); }
return dom_adapter.getDOM();
}
export function setDOM(adapter:DomAdapter){ export function setDOM(adapter: DomAdapter) { return dom_adapter.setDOM(adapter); }
return dom_adapter.setDOM(adapter);
}
export var setRootDomAdapter = dom_adapter.setRootDomAdapter; export var setRootDomAdapter = dom_adapter.setRootDomAdapter;
@ -27,7 +23,7 @@ export namespace __platform_browser_private__ {
export type AnimationBuilder = animation_builder.AnimationBuilder; export type AnimationBuilder = animation_builder.AnimationBuilder;
export var 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 var CssAnimationBuilder = css_animation_builder.CssAnimationBuilder;
export type CssAnimationOptions = css_animation_options.CssAnimationOptions; export type CssAnimationOptions = css_animation_options.CssAnimationOptions;

View File

@ -120,7 +120,8 @@ export class Animation {
* @param classes * @param classes
*/ */
removeClasses(classes: string[]): void { 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 { addEvents(): void {
if (this.totalTime > 0) { if (this.totalTime > 0) {
this.eventClearFunctions.push(getDOM().onAndCancel( this.eventClearFunctions.push(
this.element, getDOM().getTransitionEnd(), (event: any) => this.handleAnimationEvent(event))); getDOM().onAndCancel(this.element, getDOM().getTransitionEnd(),
(event: any) => this.handleAnimationEvent(event)));
} else { } else {
this.handleAnimationCompleted(); this.handleAnimationCompleted();
} }

View File

@ -14,7 +14,8 @@ export class BrowserDetails {
*/ */
doesElapsedTimeIncludesDelay(): void { doesElapsedTimeIncludesDelay(): void {
var div = getDOM().createElement('div'); 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;`); height: 1px; transition: all 1ms linear 1ms;`);
// Firefox requires that we wait for 2 frames for some reason // Firefox requires that we wait for 2 frames for some reason
this.raf((timestamp: any) => { this.raf((timestamp: any) => {

View File

@ -28,7 +28,7 @@ import {
HAMMER_GESTURE_CONFIG, HAMMER_GESTURE_CONFIG,
HammerGestureConfig, HammerGestureConfig,
HammerGesturesPlugin HammerGesturesPlugin
} from './dom/events/hammer_gestures' } from './dom/events/hammer_gestures';
import {DomSharedStylesHost} from './dom/shared_styles_host'; import {DomSharedStylesHost} from './dom/shared_styles_host';
import {AnimationBuilder} from './animate/animation_builder'; import {AnimationBuilder} from './animate/animation_builder';
import {BrowserDetails} from './animate/browser_details'; import {BrowserDetails} from './animate/browser_details';
@ -97,7 +97,8 @@ export {
} from '../src/dom/events/hammer_gestures' } from '../src/dom/events/hammer_gestures'
export function initDomAdapter() { export function
initDomAdapter() {
BrowserDomAdapter.makeCurrent(); BrowserDomAdapter.makeCurrent();
wtfInit(); wtfInit();
BrowserGetTestability.init(); 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 {DebugDomRootRenderer} from '../../../core_private';
import {assertionsEnabled} from '../../facade/lang'; import {assertionsEnabled} from '../../facade/lang';
import {getDOM} from '../dom_adapter'; import {getDOM} from '../dom_adapter';

View File

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

View File

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

View File

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

View File

@ -34,7 +34,9 @@ import {
ClientMessageBrokerFactory, ClientMessageBrokerFactory,
ClientMessageBrokerFactory_ ClientMessageBrokerFactory_
} from '../web_workers/shared/client_message_broker'; } 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 {Serializer} from '../web_workers/shared/serializer';
import {ON_WEB_WORKER} from '../web_workers/shared/api'; import {ON_WEB_WORKER} from '../web_workers/shared/api';
import {RenderStore} from '../web_workers/shared/render_store'; import {RenderStore} from '../web_workers/shared/render_store';

View File

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

View File

@ -216,7 +216,8 @@ export function main() {
it('should unregister change detectors when components are disposed', it('should unregister change detectors when components are disposed',
inject([AsyncTestCompleter], (async) => { inject([AsyncTestCompleter], (async) => {
var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS)); 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) platform.injector)
.get(ApplicationRef); .get(ApplicationRef);
coreLoadAndBootstrap(app.injector, HelloRootCmp) 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 {NgZone} from '@angular/core/src/zone/ng_zone';
import {ListWrapper, Map} from '../../../src/facade/collection'; import {ListWrapper, Map} from '../../../src/facade/collection';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {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'; import {el} from '../../../testing/browser_util';
export function main() { export function main() {

View File

@ -8,7 +8,9 @@ import {
} from '@angular/core/testing/testing_internal'; } from '@angular/core/testing/testing_internal';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {SpyMessageBroker} from './spies'; 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 {LocationType} from '@angular/platform-browser/src/web_workers/shared/serialized_types';
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus'; import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
import { import {

View File

@ -89,8 +89,7 @@ export function main() {
uiRenderStore = new RenderStore(); uiRenderStore = new RenderStore();
var testUiInjector = new TestInjector(); var testUiInjector = new TestInjector();
testUiInjector.platformProviders = TEST_BROWSER_STATIC_PLATFORM_PROVIDERS; testUiInjector.platformProviders = TEST_BROWSER_STATIC_PLATFORM_PROVIDERS;
testUiInjector.applicationProviders = TEST_BROWSER_STATIC_APPLICATION_PROVIDERS testUiInjector.applicationProviders = TEST_BROWSER_STATIC_APPLICATION_PROVIDERS;
;
testUiInjector.addProviders([ testUiInjector.addProviders([
Serializer, Serializer,
provide(RenderStore, {useValue: uiRenderStore}), provide(RenderStore, {useValue: uiRenderStore}),
@ -225,7 +224,8 @@ export function main() {
getRenderer(fixture.componentRef) getRenderer(fixture.componentRef)
.invokeElementMethod(el.nativeElement, 'setAttribute', ['a', 'b']); .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(); 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'; 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. * Default application providers for testing without a compiler.
*/ */
export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = export const TEST_BROWSER_STATIC_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
/*@ts2dart_const*/[ /*@ts2dart_const*/[BROWSER_APP_COMMON_PROVIDERS, ADDITIONAL_TEST_BROWSER_PROVIDERS];
BROWSER_APP_COMMON_PROVIDERS,
ADDITIONAL_TEST_BROWSER_PROVIDERS
];

View File

@ -14,9 +14,7 @@ export class BrowserDetection {
static setup() { browserDetection = new BrowserDetection(null); } static setup() { browserDetection = new BrowserDetection(null); }
constructor(ua: string) { constructor(ua: string) { this._overrideUa = ua; }
this._overrideUa = ua;
}
get isFirefox(): boolean { return this._ua.indexOf('Firefox') > -1; } 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 type CssSelector = typeof _.CssSelector;
export var CssSelector: typeof _.CssSelector = _.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 {ListWrapper, StringMapWrapper} from '../src/facade/collection';
import {DomAdapter, setRootDomAdapter} from '../platform_browser_private'; import {DomAdapter, setRootDomAdapter} from '../platform_browser_private';
import { import {isPresent, isBlank, global, Type, setValueOnPath, DateWrapper} from '../src/facade/lang';
isPresent,
isBlank,
global,
Type,
setValueOnPath,
DateWrapper
} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions'; import {BaseException} from '../src/facade/exceptions';
import {SelectorMatcher, CssSelector} from '../compiler_private'; import {SelectorMatcher, CssSelector} from '../compiler_private';
import {XHR} from '@angular/compiler'; import {XHR} from '@angular/compiler';

View File

@ -23,7 +23,10 @@ import {DOCUMENT} from '@angular/platform-browser';
import {getDOM} from '../platform_browser_private'; import {getDOM} from '../platform_browser_private';
import {RootRenderer} from '@angular/core'; import {RootRenderer} from '@angular/core';
import {DomRootRenderer, DomRootRenderer_} from '../../platform-browser/src/dom/dom_renderer'; 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 { import {
EventManager, EventManager,
EVENT_MANAGER_PLUGINS, EVENT_MANAGER_PLUGINS,

View File

@ -34,7 +34,8 @@ export class RootCmp {
activatedCmp: any; activatedCmp: any;
} }
export function compile(tcb: TestComponentBuilder, export function compile(
tcb: TestComponentBuilder,
template: string = "<router-outlet></router-outlet>"): Promise<ComponentFixture<RootCmp>> { template: string = "<router-outlet></router-outlet>"): Promise<ComponentFixture<RootCmp>> {
return tcb.overrideTemplate(RootCmp, ('<div>' + template + '</div>')).createAsync(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 {RouterOutlet} from './directives/router_outlet';
import {Type, isBlank, isPresent} from '@angular/facade/src/lang'; import {Type, isBlank, isPresent} from '@angular/facade/src/lang';
import {ListWrapper} from '@angular/facade/src/collection'; 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 {StringMapWrapper} from '@angular/facade/src/collection';
import {BaseException} from '@angular/core'; import {BaseException} from '@angular/core';
import {RouterUrlSerializer} from './router_url_serializer'; import {RouterUrlSerializer} from './router_url_serializer';

View File

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

View File

@ -1,6 +1,9 @@
import {PromiseWrapper} from '@angular/facade'; import {PromiseWrapper} from '@angular/facade';
import {Component} from '@angular/core'; 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"; const ECHO_CHANNEL = "ECHO";

View File

@ -1,5 +1,8 @@
import {Provider} from '@angular/core'; 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 {HashLocationStrategy, LocationStrategy} from '@angular/common';
import {App} from './index_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); bootstrapRender("loader.js", WORKER_RENDER_ROUTER);

View File

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

View File

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

View File

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

View File

@ -1,6 +1,13 @@
/// <reference path="../../typings/jasmine/jasmine.d.ts" /> /// <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 {isBlank} from '@angular/facade/src/lang';
import {ListWrapper} from '@angular/facade/src/collection'; import {ListWrapper} from '@angular/facade/src/collection';

View File

@ -4,14 +4,17 @@ import {writeFileSync, mkdirSync, existsSync} from 'fs';
export * from './tsc_watch'; export * from './tsc_watch';
import 'reflect-metadata'; import 'reflect-metadata';
const OFFLINE_COMPILE = [ const OFFLINE_COMPILE =
[
'output/output_emitter_codegen_untyped', 'output/output_emitter_codegen_untyped',
'output/output_emitter_codegen_typed', 'output/output_emitter_codegen_typed',
'offline_compiler_codegen_untyped', 'offline_compiler_codegen_untyped',
'offline_compiler_codegen_typed' 'offline_compiler_codegen_typed'
] ]
function processOutputEmitterCodeGen():Promise<number> { function
processOutputEmitterCodeGen():
Promise<number> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var outDir = 'dist/all/@angular/compiler/test/'; var outDir = 'dist/all/@angular/compiler/test/';
var promises = []; var promises = [];
@ -20,24 +23,31 @@ function processOutputEmitterCodeGen():Promise<number> {
var codegen = require('../../all/@angular/compiler/test/' + file + '.js'); var codegen = require('../../all/@angular/compiler/test/' + file + '.js');
if (codegen.emit) { if (codegen.emit) {
console.log(` ${file} has changed, regenerating...`); console.log(` ${file} has changed, regenerating...`);
promises.push(Promise.resolve(codegen.emit()).then((code) => { promises.push(
writeFileSync(outDir + file + '.ts', code); Promise.resolve(codegen.emit())
})); .then((code) => { writeFileSync(outDir + file + '.ts', code); }));
} }
}); });
if (promises.length) { if (promises.length) {
Promise.all(promises).then(() => { Promise.all(promises)
var args = ['--project', 'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json']; .then(() => {
var args = [
'--project',
'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json'
];
console.log(' compiling changes: tsc ' + args.join(' ')); console.log(' compiling changes: tsc ' + args.join(' '));
var tsc = spawn(TSC, args, {stdio: 'pipe'}); var tsc = spawn(TSC, args, {stdio: 'pipe'});
tsc.stdout.on('data', (data) => process.stdout.write(data)); tsc.stdout.on('data', (data) => process.stdout.write(data));
tsc.stderr.on('data', (data) => process.stderr.write(data)); tsc.stderr.on('data', (data) => process.stderr.write(data));
tsc.on('close', (code) => code ? reject('Tsc exited with: ' + code) : resolve(code)); tsc.on('close', (code) => code ? reject('Tsc exited with: ' + code) :
}).catch(reportError); resolve(code));
})
.catch(reportError);
} else { } else {
resolve(0); resolve(0);
} }
}).catch(reportError); })
.catch(reportError);
} }
function md(dir: string, folders: string[]) { function md(dir: string, folders: string[]) {
@ -72,12 +82,9 @@ if (platform == 'node') {
start: 'File change detected. Starting incremental compilation...', start: 'File change detected. Starting incremental compilation...',
error: 'error', error: 'error',
complete: 'Compilation complete. Watching for file changes.', complete: 'Compilation complete. Watching for file changes.',
onStartCmds: [ onStartCmds:
['node', 'node_modules/karma/bin/karma', 'start', '--no-auto-watch', 'karma-js.conf.js'] [['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']]
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'; import {resolve} from 'url';
enum State { enum State {
idle, waiting, error idle,
waiting,
error
} }
export const TSC = 'node_modules/typescript/bin/tsc'; export const TSC = 'node_modules/typescript/bin/tsc';
@ -19,10 +21,14 @@ export class TscWatch {
private triggered: Promise<number> = null; private triggered: Promise<number> = null;
private runOnce: boolean = false; private runOnce: boolean = false;
constructor({tsconfig, start, error, complete, onStartCmds=null, onChangeCmds=null}: constructor({tsconfig, start, error, complete, onStartCmds = null, onChangeCmds = null}: {
{tsconfig:string, error:string|RegExp, start:string, complete:string, tsconfig: string,
onStartCmds?:Array<string[]|Command>, onChangeCmds?:Array<string[]|Command>}) error: string | RegExp,
{ start: string,
complete: string,
onStartCmds?: Array<string[] | Command>,
onChangeCmds?: Array<string[] | Command>
}) {
console.log('Watching:', tsconfig, 'in', process.cwd()); console.log('Watching:', tsconfig, 'in', process.cwd());
this.tsconfig = tsconfig; this.tsconfig = tsconfig;
this.start = start; this.start = start;
@ -35,7 +41,8 @@ export class TscWatch {
watch() { watch() {
var args = [TSC, '--project', this.tsconfig]; var args = [TSC, '--project', this.tsconfig];
if (!this.runOnce) args.push('--watch'); 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) { if (this.runOnce) {
tsc.then(() => this.triggerCmds(), code => process.exit(code)); tsc.then(() => this.triggerCmds(), code => process.exit(code));
} }
@ -43,9 +50,8 @@ export class TscWatch {
this.onStartCmds.forEach((cmd) => this.runCmd(cmd, () => null, () => null)); this.onStartCmds.forEach((cmd) => this.runCmd(cmd, () => null, () => null));
} }
private runCmd(argsOrCmd: string[]|Command, env?, private runCmd(argsOrCmd: string[] | Command, env?, stdOut = pipeStdOut,
stdOut = pipeStdOut, stdErr = pipeStdErr):Promise<number> stdErr = pipeStdErr): Promise<number> {
{
if (typeof argsOrCmd == 'function') { if (typeof argsOrCmd == 'function') {
return (argsOrCmd as Command)(stdErr, stdOut); return (argsOrCmd as Command)(stdErr, stdOut);
} else if (argsOrCmd instanceof Array) { } else if (argsOrCmd instanceof Array) {
@ -63,7 +69,8 @@ export class TscWatch {
code ? reject(code) : resolve(code); code ? reject(code) : resolve(code);
}); });
process.on('exit', onExit); process.on('exit', onExit);
}).catch(reportError); })
.catch(reportError);
} else { } else {
throw new Error('Expecting function or an array of strings...'); throw new Error('Expecting function or an array of strings...');
} }
@ -92,7 +99,8 @@ export class TscWatch {
this.state = State.idle; this.state = State.idle;
} else { } else {
if (this.triggered) { 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 { } else {
this.triggerCmds(); this.triggerCmds();
} }
@ -104,11 +112,9 @@ export class TscWatch {
triggerCmds() { triggerCmds() {
var cmdPromise: Promise<number> = Promise.resolve(); var cmdPromise: Promise<number> = Promise.resolve();
this.onChangeCmds.forEach((cmd:string[]|Command) => { this.onChangeCmds.forEach((cmd: string[] | Command) => {cmdPromise = cmdPromise.then(() => {
cmdPromise = cmdPromise.then(() => {
return this.runCmd(<string[]>cmd); return this.runCmd(<string[]>cmd);
}) })});
});
cmdPromise.then(() => this.triggered = null, (code) => { cmdPromise.then(() => this.triggered = null, (code) => {
if (this.runOnce) { if (this.runOnce) {
if (typeof code != 'number') { if (typeof code != 'number') {
@ -153,5 +159,9 @@ export function reportError(e) {
return Promise.reject(e); return Promise.reject(e);
} }
function pipeStdOut(d) { process.stdout.write(d); } function pipeStdOut(d) {
function pipeStdErr(d) { process.stderr.write(d); } process.stdout.write(d);
}
function pipeStdErr(d) {
process.stderr.write(d);
}