From 686457890d38fe978e4977ed443b975c2ca5c3eb Mon Sep 17 00:00:00 2001
From: Julie Ralph
Date: Sat, 31 Oct 2015 09:50:19 -0700
Subject: [PATCH] chore(test): rename RootTestComponent to ComponentFixture
BREAKING CHANGE:
Before:
```
testComponentBuilder.createAsync(MyComponent).then(root: RootTestComponent => {
}
```
After:
```
testComponentBuilder.createAsync(MyComponent).then(fixture: ComponentFixture => {
}
```
Closes #4711
---
.../src/testing/test_component_builder.ts | 14 +-
.../test/core/debug/debug_element_spec.ts | 54 +-
.../debug/debug_element_view_listener_spec.ts | 15 +-
.../test/core/directives/ng_class_spec.ts | 242 ++++----
.../test/core/directives/ng_for_spec.ts | 209 +++----
.../test/core/directives/ng_if_spec.ts | 149 ++---
.../test/core/directives/ng_style_spec.ts | 70 +--
.../test/core/directives/ng_switch_spec.ts | 90 +--
.../test/core/directives/non_bindable_spec.ts | 20 +-
.../test/core/forms/integration_spec.ts | 418 +++++++-------
.../linker/dynamic_component_loader_spec.ts | 6 +-
.../test/core/linker/integration_spec.ts | 517 +++++++++---------
.../linker/projection_integration_spec.ts | 6 +-
.../core/linker/query_integration_spec.ts | 8 +-
.../test/core/pipes/json_pipe_spec.ts | 12 +-
.../test/core/pipes/slice_pipe_spec.ts | 12 +-
.../router/integration/lifecycle_hook_spec.ts | 66 +--
.../router/integration/navigation_spec.ts | 67 +--
.../integration/router_integration_spec.ts | 40 +-
.../router/integration/router_link_spec.ts | 70 +--
.../testing/test_component_builder_spec.ts | 54 +-
.../test/testing/testing_public_spec.ts | 54 +-
.../worker/renderer_integration_spec.ts | 30 +-
modules/angular2/testing.ts | 2 +-
modules/angular2_material/test/button_spec.ts | 24 +-
25 files changed, 1128 insertions(+), 1121 deletions(-)
diff --git a/modules/angular2/src/testing/test_component_builder.ts b/modules/angular2/src/testing/test_component_builder.ts
index 3c2c6aac34..b37b541090 100644
--- a/modules/angular2/src/testing/test_component_builder.ts
+++ b/modules/angular2/src/testing/test_component_builder.ts
@@ -22,14 +22,14 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {DebugElement, DebugElement_} from 'angular2/src/core/debug/debug_element';
-export abstract class RootTestComponent {
+export abstract class ComponentFixture {
debugElement: DebugElement;
abstract detectChanges(): void;
abstract destroy(): void;
}
-export class RootTestComponent_ extends RootTestComponent {
+export class ComponentFixture_ extends ComponentFixture {
/** @internal */
_componentRef: ComponentRef;
/** @internal */
@@ -53,7 +53,7 @@ export class RootTestComponent_ extends RootTestComponent {
var _nextRootElementId = 0;
/**
- * Builds a RootTestComponent for use in component level tests.
+ * Builds a ComponentFixture for use in component level tests.
*/
@Injectable()
export class TestComponentBuilder {
@@ -186,11 +186,11 @@ export class TestComponentBuilder {
}
/**
- * Builds and returns a RootTestComponent.
+ * Builds and returns a ComponentFixture.
*
- * @return {Promise}
+ * @return {Promise}
*/
- createAsync(rootComponentType: Type): Promise {
+ createAsync(rootComponentType: Type): Promise {
var mockDirectiveResolver = this._injector.get(DirectiveResolver);
var mockViewResolver = this._injector.get(ViewResolver);
this._viewOverrides.forEach((view, type) => mockViewResolver.setView(type, view));
@@ -220,6 +220,6 @@ export class TestComponentBuilder {
return this._injector.get(DynamicComponentLoader)
.loadAsRoot(rootComponentType, `#${rootElId}`, this._injector)
- .then((componentRef) => { return new RootTestComponent_(componentRef); });
+ .then((componentRef) => { return new ComponentFixture_(componentRef); });
}
}
diff --git a/modules/angular2/test/core/debug/debug_element_spec.ts b/modules/angular2/test/core/debug/debug_element_spec.ts
index cc69f725a4..e20f928fe3 100644
--- a/modules/angular2/test/core/debug/debug_element_spec.ts
+++ b/modules/angular2/test/core/debug/debug_element_spec.ts
@@ -137,14 +137,14 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
- var childEls = rootTestComponent.debugElement.children;
+ var childEls = componentFixture.debugElement.children;
// The root is a lone component, and has no children in the light dom.
expect(childEls.length).toEqual(0);
- var rootCompChildren = rootTestComponent.debugElement.componentViewChildren;
+ var rootCompChildren = componentFixture.debugElement.componentViewChildren;
// The root component has 4 elements in its shadow view.
expect(rootCompChildren.length).toEqual(4);
expect(DOM.hasClass(rootCompChildren[0].nativeElement, 'parent')).toBe(true);
@@ -185,10 +185,10 @@ export function main() {
it('should list child elements within viewports',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.createAsync(UsingFor).then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ tcb.createAsync(UsingFor).then((componentFixture) => {
+ componentFixture.detectChanges();
- var childEls = rootTestComponent.debugElement.componentViewChildren;
+ var childEls = componentFixture.debugElement.componentViewChildren;
// TODO should this count include the element?
expect(childEls.length).toEqual(5);
@@ -203,10 +203,10 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
- var childTestEls = rootTestComponent.debugElement.queryAll(By.directive(MessageDir));
+ var childTestEls = componentFixture.debugElement.queryAll(By.directive(MessageDir));
expect(childTestEls.length).toBe(4);
expect(DOM.hasClass(childTestEls[0].nativeElement, 'parent')).toBe(true);
@@ -221,10 +221,10 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
- var parentEl = rootTestComponent.debugElement.componentViewChildren[0];
+ var parentEl = componentFixture.debugElement.componentViewChildren[0];
var childTestEls = parentEl.queryAll(By.directive(MessageDir), Scope.light);
@@ -239,11 +239,11 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
var childTestEls =
- rootTestComponent.debugElement.queryAll(By.directive(MessageDir), Scope.view);
+ componentFixture.debugElement.queryAll(By.directive(MessageDir), Scope.view);
expect(childTestEls.length).toBe(2);
expect(DOM.hasClass(childTestEls[0].nativeElement, 'parent')).toBe(true);
@@ -257,10 +257,10 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
- expect(rootTestComponent.debugElement.componentViewChildren[0].inject(Logger).log)
+ expect(componentFixture.debugElement.componentViewChildren[0].inject(Logger).log)
.toEqual(['parent', 'nestedparent', 'child', 'nestedchild']);
async.done();
@@ -271,19 +271,19 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.createAsync(EventsComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
- expect(rootTestComponent.debugElement.componentInstance.clicked).toBe(false);
- expect(rootTestComponent.debugElement.componentInstance.customed).toBe(false);
+ expect(componentFixture.debugElement.componentInstance.clicked).toBe(false);
+ expect(componentFixture.debugElement.componentInstance.customed).toBe(false);
- rootTestComponent.debugElement.componentViewChildren[0].triggerEventHandler(
+ componentFixture.debugElement.componentViewChildren[0].triggerEventHandler(
'click', {});
- expect(rootTestComponent.debugElement.componentInstance.clicked).toBe(true);
+ expect(componentFixture.debugElement.componentInstance.clicked).toBe(true);
- rootTestComponent.debugElement.componentViewChildren[1].triggerEventHandler(
+ componentFixture.debugElement.componentViewChildren[1].triggerEventHandler(
'myevent', {});
- expect(rootTestComponent.debugElement.componentInstance.customed).toBe(true);
+ expect(componentFixture.debugElement.componentInstance.customed).toBe(true);
async.done();
});
diff --git a/modules/angular2/test/core/debug/debug_element_view_listener_spec.ts b/modules/angular2/test/core/debug/debug_element_view_listener_spec.ts
index 40eae01435..f06d879827 100644
--- a/modules/angular2/test/core/debug/debug_element_view_listener_spec.ts
+++ b/modules/angular2/test/core/debug/debug_element_view_listener_spec.ts
@@ -34,8 +34,8 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(MyComp, '
')
.createAsync(MyComp)
- .then((rootTestComponent) => {
- expect(inspectNativeElement(rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ expect(inspectNativeElement(componentFixture.debugElement.nativeElement)
.componentInstance)
.toBeAnInstanceOf(MyComp);
@@ -47,10 +47,9 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(MyComp, '')
.createAsync(MyComp)
- .then((rootTestComponent) => {
- rootTestComponent.destroy();
- expect(inspectNativeElement(rootTestComponent.debugElement.nativeElement))
- .toBe(null);
+ .then((componentFixture) => {
+ componentFixture.destroy();
+ expect(inspectNativeElement(componentFixture.debugElement.nativeElement)).toBe(null);
async.done();
});
@@ -62,8 +61,8 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(MyComp, '')
.createAsync(MyComp)
- .then((rootTestComponent) => {
- expect(global['ng']['probe'](rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ expect(global['ng']['probe'](componentFixture.debugElement.nativeElement)
.componentInstance)
.toBeAnInstanceOf(MyComp);
diff --git a/modules/angular2/test/core/directives/ng_class_spec.ts b/modules/angular2/test/core/directives/ng_class_spec.ts
index 9474ec268e..75c74f96fb 100644
--- a/modules/angular2/test/core/directives/ng_class_spec.ts
+++ b/modules/angular2/test/core/directives/ng_class_spec.ts
@@ -1,5 +1,5 @@
import {
- RootTestComponent,
+ ComponentFixture,
AsyncTestCompleter,
TestComponentBuilder,
beforeEach,
@@ -19,9 +19,9 @@ import {Component, View, NgFor, provide} from 'angular2/angular2';
import {NgClass} from 'angular2/src/core/directives/ng_class';
import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/linker/view_pool';
-function detectChangesAndCheck(rootTC: RootTestComponent, classes: string, elIndex: number = 0) {
- rootTC.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[elIndex].nativeElement.className)
+function detectChangesAndCheck(fixture: ComponentFixture, classes: string, elIndex: number = 0) {
+ fixture.detectChanges();
+ expect(fixture.debugElement.componentViewChildren[elIndex].nativeElement.className)
.toEqual(classes);
}
@@ -36,12 +36,12 @@ export function main() {
var template = '
';
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [['0']];
- rootTC.detectChanges();
- rootTC.debugElement.componentInstance.items = [['1']];
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [['0']];
+ fixture.detectChanges();
+ fixture.debugElement.componentInstance.items = [['1']];
- detectChangesAndCheck(rootTC, '1', 1);
+ detectChangesAndCheck(fixture, '1', 1);
async.done();
});
@@ -57,8 +57,8 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
async.done();
});
}));
@@ -70,8 +70,8 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo-bar fooBar');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo-bar fooBar');
async.done();
});
}));
@@ -82,11 +82,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.condition = false;
- detectChangesAndCheck(rootTC, 'bar');
+ fixture.debugElement.componentInstance.condition = false;
+ detectChangesAndCheck(fixture, 'bar');
async.done();
});
@@ -98,17 +98,17 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'bar', true);
- detectChangesAndCheck(rootTC, 'foo bar');
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'bar', true);
+ detectChangesAndCheck(fixture, 'foo bar');
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'baz', true);
- detectChangesAndCheck(rootTC, 'foo bar baz');
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'baz', true);
+ detectChangesAndCheck(fixture, 'foo bar baz');
- StringMapWrapper.delete(rootTC.debugElement.componentInstance.objExpr, 'bar');
- detectChangesAndCheck(rootTC, 'foo baz');
+ StringMapWrapper.delete(fixture.debugElement.componentInstance.objExpr, 'bar');
+ detectChangesAndCheck(fixture, 'foo baz');
async.done();
});
@@ -120,14 +120,14 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.objExpr = {foo: true, bar: true};
- detectChangesAndCheck(rootTC, 'foo bar');
+ fixture.debugElement.componentInstance.objExpr = {foo: true, bar: true};
+ detectChangesAndCheck(fixture, 'foo bar');
- rootTC.debugElement.componentInstance.objExpr = {baz: true};
- detectChangesAndCheck(rootTC, 'baz');
+ fixture.debugElement.componentInstance.objExpr = {baz: true};
+ detectChangesAndCheck(fixture, 'baz');
async.done();
});
@@ -139,14 +139,14 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.objExpr = null;
- detectChangesAndCheck(rootTC, '');
+ fixture.debugElement.componentInstance.objExpr = null;
+ detectChangesAndCheck(fixture, '');
- rootTC.debugElement.componentInstance.objExpr = {'foo': false, 'bar': true};
- detectChangesAndCheck(rootTC, 'bar');
+ fixture.debugElement.componentInstance.objExpr = {'foo': false, 'bar': true};
+ detectChangesAndCheck(fixture, 'bar');
async.done();
});
@@ -161,8 +161,8 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo bar foo-bar fooBar');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo bar foo-bar fooBar');
async.done();
});
}));
@@ -173,18 +173,18 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- var arrExpr: string[] = rootTC.debugElement.componentInstance.arrExpr;
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ var arrExpr: string[] = fixture.debugElement.componentInstance.arrExpr;
+ detectChangesAndCheck(fixture, 'foo');
arrExpr.push('bar');
- detectChangesAndCheck(rootTC, 'foo bar');
+ detectChangesAndCheck(fixture, 'foo bar');
arrExpr[1] = 'baz';
- detectChangesAndCheck(rootTC, 'foo baz');
+ detectChangesAndCheck(fixture, 'foo baz');
- ListWrapper.remove(rootTC.debugElement.componentInstance.arrExpr, 'baz');
- detectChangesAndCheck(rootTC, 'foo');
+ ListWrapper.remove(fixture.debugElement.componentInstance.arrExpr, 'baz');
+ detectChangesAndCheck(fixture, 'foo');
async.done();
});
@@ -196,11 +196,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.arrExpr = ['bar'];
- detectChangesAndCheck(rootTC, 'bar');
+ fixture.debugElement.componentInstance.arrExpr = ['bar'];
+ detectChangesAndCheck(fixture, 'bar');
async.done();
});
@@ -212,11 +212,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.arrExpr = ['bar'];
- detectChangesAndCheck(rootTC, 'foo bar');
+ fixture.debugElement.componentInstance.arrExpr = ['bar'];
+ detectChangesAndCheck(fixture, 'foo bar');
async.done();
});
@@ -228,10 +228,10 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.arrExpr = ['', ' '];
- detectChangesAndCheck(rootTC, 'foo');
+ fixture.debugElement.componentInstance.arrExpr = ['', ' '];
+ detectChangesAndCheck(fixture, 'foo');
async.done();
});
@@ -243,10 +243,10 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.arrExpr = [' bar '];
- detectChangesAndCheck(rootTC, 'foo bar');
+ fixture.debugElement.componentInstance.arrExpr = [' bar '];
+ detectChangesAndCheck(fixture, 'foo bar');
async.done();
});
@@ -261,16 +261,16 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
+ .then((fixture) => {
var setExpr = new Set();
setExpr.add('bar');
- rootTC.debugElement.componentInstance.setExpr = setExpr;
- detectChangesAndCheck(rootTC, 'bar');
+ fixture.debugElement.componentInstance.setExpr = setExpr;
+ detectChangesAndCheck(fixture, 'bar');
setExpr = new Set();
setExpr.add('baz');
- rootTC.debugElement.componentInstance.setExpr = setExpr;
- detectChangesAndCheck(rootTC, 'baz');
+ fixture.debugElement.componentInstance.setExpr = setExpr;
+ detectChangesAndCheck(fixture, 'baz');
async.done();
});
@@ -284,8 +284,8 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo bar foo-bar fooBar');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo bar foo-bar fooBar');
async.done();
});
}));
@@ -296,15 +296,15 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.strExpr = 'foo bar';
- detectChangesAndCheck(rootTC, 'foo bar');
+ fixture.debugElement.componentInstance.strExpr = 'foo bar';
+ detectChangesAndCheck(fixture, 'foo bar');
- rootTC.debugElement.componentInstance.strExpr = 'baz';
- detectChangesAndCheck(rootTC, 'baz');
+ fixture.debugElement.componentInstance.strExpr = 'baz';
+ detectChangesAndCheck(fixture, 'baz');
async.done();
});
@@ -316,11 +316,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.strExpr = null;
- detectChangesAndCheck(rootTC, '');
+ fixture.debugElement.componentInstance.strExpr = null;
+ detectChangesAndCheck(fixture, '');
async.done();
});
@@ -332,11 +332,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'foo');
- rootTC.debugElement.componentInstance.strExpr = null;
- detectChangesAndCheck(rootTC, 'foo');
+ fixture.debugElement.componentInstance.strExpr = null;
+ detectChangesAndCheck(fixture, 'foo');
async.done();
});
@@ -348,9 +348,9 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.strExpr = '';
- detectChangesAndCheck(rootTC, 'foo');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.strExpr = '';
+ detectChangesAndCheck(fixture, 'foo');
async.done();
});
@@ -366,15 +366,15 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'bar', true);
- detectChangesAndCheck(rootTC, 'init foo bar');
+ .then((fixture) => {
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'bar', true);
+ detectChangesAndCheck(fixture, 'init foo bar');
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'foo', false);
- detectChangesAndCheck(rootTC, 'init bar');
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'foo', false);
+ detectChangesAndCheck(fixture, 'init bar');
- rootTC.debugElement.componentInstance.objExpr = null;
- detectChangesAndCheck(rootTC, 'init foo');
+ fixture.debugElement.componentInstance.objExpr = null;
+ detectChangesAndCheck(fixture, 'init foo');
async.done();
});
@@ -386,15 +386,15 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'bar', true);
- detectChangesAndCheck(rootTC, `init foo bar`);
+ .then((fixture) => {
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'bar', true);
+ detectChangesAndCheck(fixture, `init foo bar`);
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'foo', false);
- detectChangesAndCheck(rootTC, `init bar`);
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'foo', false);
+ detectChangesAndCheck(fixture, `init bar`);
- rootTC.debugElement.componentInstance.objExpr = null;
- detectChangesAndCheck(rootTC, `init foo`);
+ fixture.debugElement.componentInstance.objExpr = null;
+ detectChangesAndCheck(fixture, `init foo`);
async.done();
});
@@ -406,15 +406,15 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'bar', true);
- detectChangesAndCheck(rootTC, `init foo bar`);
+ .then((fixture) => {
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'bar', true);
+ detectChangesAndCheck(fixture, `init foo bar`);
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'foo', false);
- detectChangesAndCheck(rootTC, `init bar`);
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'foo', false);
+ detectChangesAndCheck(fixture, `init bar`);
- rootTC.debugElement.componentInstance.objExpr = null;
- detectChangesAndCheck(rootTC, `init foo`);
+ fixture.debugElement.componentInstance.objExpr = null;
+ detectChangesAndCheck(fixture, `init foo`);
async.done();
});
@@ -427,17 +427,17 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'init foo baz');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'init foo baz');
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'bar', true);
- detectChangesAndCheck(rootTC, 'init foo baz bar');
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'bar', true);
+ detectChangesAndCheck(fixture, 'init foo baz bar');
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'foo', false);
- detectChangesAndCheck(rootTC, 'init baz bar');
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'foo', false);
+ detectChangesAndCheck(fixture, 'init baz bar');
- rootTC.debugElement.componentInstance.condition = false;
- detectChangesAndCheck(rootTC, 'init bar');
+ fixture.debugElement.componentInstance.condition = false;
+ detectChangesAndCheck(fixture, 'init bar');
async.done();
});
@@ -449,17 +449,17 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- detectChangesAndCheck(rootTC, 'init foo');
+ .then((fixture) => {
+ detectChangesAndCheck(fixture, 'init foo');
- StringMapWrapper.set(rootTC.debugElement.componentInstance.objExpr, 'bar', true);
- detectChangesAndCheck(rootTC, 'init foo bar');
+ StringMapWrapper.set(fixture.debugElement.componentInstance.objExpr, 'bar', true);
+ detectChangesAndCheck(fixture, 'init foo bar');
- rootTC.debugElement.componentInstance.strExpr = 'baz';
- detectChangesAndCheck(rootTC, 'init bar baz foo');
+ fixture.debugElement.componentInstance.strExpr = 'baz';
+ detectChangesAndCheck(fixture, 'init bar baz foo');
- rootTC.debugElement.componentInstance.objExpr = null;
- detectChangesAndCheck(rootTC, 'init baz');
+ fixture.debugElement.componentInstance.objExpr = null;
+ detectChangesAndCheck(fixture, 'init baz');
async.done();
});
diff --git a/modules/angular2/test/core/directives/ng_for_spec.ts b/modules/angular2/test/core/directives/ng_for_spec.ts
index 950496c2e2..fba09d3126 100644
--- a/modules/angular2/test/core/directives/ng_for_spec.ts
+++ b/modules/angular2/test/core/directives/ng_for_spec.ts
@@ -29,9 +29,9 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('1;2;');
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('1;2;');
async.done();
});
}));
@@ -40,13 +40,13 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- (rootTC.debugElement.componentInstance.items).push(3);
- rootTC.detectChanges();
+ (fixture.debugElement.componentInstance.items).push(3);
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('1;2;3;');
+ expect(fixture.debugElement.nativeElement).toHaveText('1;2;3;');
async.done();
});
}));
@@ -55,13 +55,13 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- ListWrapper.removeAt(rootTC.debugElement.componentInstance.items, 1);
- rootTC.detectChanges();
+ ListWrapper.removeAt(fixture.debugElement.componentInstance.items, 1);
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('1;');
+ expect(fixture.debugElement.nativeElement).toHaveText('1;');
async.done();
});
}));
@@ -70,14 +70,14 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- ListWrapper.removeAt(rootTC.debugElement.componentInstance.items, 0);
- (rootTC.debugElement.componentInstance.items).push(1);
- rootTC.detectChanges();
+ ListWrapper.removeAt(fixture.debugElement.componentInstance.items, 0);
+ (fixture.debugElement.componentInstance.items).push(1);
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('2;1;');
+ expect(fixture.debugElement.nativeElement).toHaveText('2;1;');
async.done();
});
}));
@@ -86,14 +86,14 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [0, 1, 2, 3, 4, 5];
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [0, 1, 2, 3, 4, 5];
+ fixture.detectChanges();
- rootTC.debugElement.componentInstance.items = [6, 2, 7, 0, 4, 8];
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.items = [6, 2, 7, 0, 4, 8];
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('6;2;7;0;4;8;');
+ expect(fixture.debugElement.nativeElement).toHaveText('6;2;7;0;4;8;');
async.done();
});
}));
@@ -104,25 +104,26 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
+ .then((fixture) => {
// INIT
- rootTC.debugElement.componentInstance.items = [{'name': 'misko'}, {'name': 'shyam'}];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('misko;shyam;');
+ fixture.debugElement.componentInstance.items =
+ [{'name': 'misko'}, {'name': 'shyam'}];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('misko;shyam;');
// GROW
- (rootTC.debugElement.componentInstance.items).push({'name': 'adam'});
- rootTC.detectChanges();
+ (fixture.debugElement.componentInstance.items).push({'name': 'adam'});
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('misko;shyam;adam;');
+ expect(fixture.debugElement.nativeElement).toHaveText('misko;shyam;adam;');
// SHRINK
- ListWrapper.removeAt(rootTC.debugElement.componentInstance.items, 2);
- ListWrapper.removeAt(rootTC.debugElement.componentInstance.items, 0);
- rootTC.detectChanges();
+ ListWrapper.removeAt(fixture.debugElement.componentInstance.items, 2);
+ ListWrapper.removeAt(fixture.debugElement.componentInstance.items, 0);
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('shyam;');
+ expect(fixture.debugElement.nativeElement).toHaveText('shyam;');
async.done();
});
}));
@@ -132,9 +133,9 @@ export function main() {
var template = '';
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
}));
@@ -143,17 +144,17 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('1;2;');
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('1;2;');
- rootTC.debugElement.componentInstance.items = null;
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ fixture.debugElement.componentInstance.items = null;
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('');
- rootTC.debugElement.componentInstance.items = [1, 2, 3];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('1;2;3;');
+ fixture.debugElement.componentInstance.items = [1, 2, 3];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('1;2;3;');
async.done();
});
}));
@@ -162,12 +163,12 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('1;2;');
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('1;2;');
- rootTC.debugElement.componentInstance.items = 'whaaa';
- expect(() => rootTC.detectChanges()).toThrowError();
+ fixture.debugElement.componentInstance.items = 'whaaa';
+ expect(() => fixture.detectChanges()).toThrowError();
async.done();
});
}));
@@ -176,11 +177,11 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideTemplate(TestComponent, TEMPLATE)
.createAsync(TestComponent)
- .then((rootTC) => {
+ .then((fixture) => {
var a = new Foo();
- rootTC.debugElement.componentInstance.items = [a, a];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('foo;foo;');
+ fixture.debugElement.componentInstance.items = [a, a];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('foo;foo;');
async.done();
});
}));
@@ -197,16 +198,16 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [['a', 'b'], ['c']];
- rootTC.detectChanges();
- rootTC.detectChanges();
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('a-2;b-2;|c-1;|');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [['a', 'b'], ['c']];
+ fixture.detectChanges();
+ fixture.detectChanges();
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('a-2;b-2;|c-1;|');
- rootTC.debugElement.componentInstance.items = [['e'], ['f', 'g']];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('e-1;|f-2;g-2;|');
+ fixture.debugElement.componentInstance.items = [['e'], ['f', 'g']];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('e-1;|f-2;g-2;|');
async.done();
});
@@ -221,14 +222,14 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [['a', 'b'], ['c']];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('a-2;b-2;c-1;');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [['a', 'b'], ['c']];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('a-2;b-2;c-1;');
- rootTC.debugElement.componentInstance.items = [['e'], ['f', 'g']];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('e-1;f-2;g-2;');
+ fixture.debugElement.componentInstance.items = [['e'], ['f', 'g']];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('e-1;f-2;g-2;');
async.done();
});
}));
@@ -240,14 +241,14 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('0123456789');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('0123456789');
- rootTC.debugElement.componentInstance.items = [1, 2, 6, 7, 4, 3, 5, 8, 9, 0];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('0123456789');
+ fixture.debugElement.componentInstance.items = [1, 2, 6, 7, 4, 3, 5, 8, 9, 0];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('0123456789');
async.done();
});
}));
@@ -259,14 +260,14 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [0, 1, 2];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('falsefalsetrue');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [0, 1, 2];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('falsefalsetrue');
- rootTC.debugElement.componentInstance.items = [2, 1];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('falsetrue');
+ fixture.debugElement.componentInstance.items = [2, 1];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('falsetrue');
async.done();
});
}));
@@ -278,14 +279,14 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [0, 1, 2];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('truefalsetrue');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [0, 1, 2];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('truefalsetrue');
- rootTC.debugElement.componentInstance.items = [2, 1];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('truefalse');
+ fixture.debugElement.componentInstance.items = [2, 1];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('truefalse');
async.done();
});
}));
@@ -297,14 +298,14 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.items = [0, 1, 2, 3];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('falsetruefalsetrue');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.items = [0, 1, 2, 3];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('falsetruefalsetrue');
- rootTC.debugElement.componentInstance.items = [2, 1];
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('falsetrue');
+ fixture.debugElement.componentInstance.items = [2, 1];
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('falsetrue');
async.done();
});
}));
@@ -318,10 +319,10 @@ export function main() {
ComponentUsingTestComponent,
'{{i}}: {{item}}; ')
.createAsync(ComponentUsingTestComponent)
- .then((rootTC) => {
- var testComponent = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var testComponent = fixture.debugElement.componentViewChildren[0];
testComponent.componentInstance.items = ['a', 'b', 'c'];
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(testComponent.nativeElement).toHaveText('0: a;1: b;2: c;');
async.done();
diff --git a/modules/angular2/test/core/directives/ng_if_spec.ts b/modules/angular2/test/core/directives/ng_if_spec.ts
index f54716b7f4..e2fa702c80 100644
--- a/modules/angular2/test/core/directives/ng_if_spec.ts
+++ b/modules/angular2/test/core/directives/ng_if_spec.ts
@@ -26,11 +26,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
async.done();
});
}));
@@ -42,11 +42,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('hello2');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello2');
async.done();
});
}));
@@ -57,24 +57,24 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.booleanCondition = false;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.booleanCondition = false;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ expect(fixture.debugElement.nativeElement).toHaveText('');
- rootTC.debugElement.componentInstance.booleanCondition = true;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.booleanCondition = true;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
- rootTC.debugElement.componentInstance.booleanCondition = false;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.booleanCondition = false;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
@@ -87,36 +87,36 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.booleanCondition = false;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.booleanCondition = false;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ expect(fixture.debugElement.nativeElement).toHaveText('');
- rootTC.debugElement.componentInstance.booleanCondition = true;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.booleanCondition = true;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
- rootTC.debugElement.componentInstance.nestedBooleanCondition = false;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.nestedBooleanCondition = false;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ expect(fixture.debugElement.nativeElement).toHaveText('');
- rootTC.debugElement.componentInstance.nestedBooleanCondition = true;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.nestedBooleanCondition = true;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
- rootTC.debugElement.componentInstance.booleanCondition = false;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.booleanCondition = false;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
@@ -133,25 +133,25 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(3);
- expect(DOM.getText(rootTC.debugElement.nativeElement))
+ expect(DOM.getText(fixture.debugElement.nativeElement))
.toEqual('helloNumberhelloStringhelloFunction');
- rootTC.debugElement.componentInstance.numberCondition = 0;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.numberCondition = 0;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('helloString');
+ expect(fixture.debugElement.nativeElement).toHaveText('helloString');
- rootTC.debugElement.componentInstance.numberCondition = 1;
- rootTC.debugElement.componentInstance.stringCondition = "bar";
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.numberCondition = 1;
+ fixture.debugElement.componentInstance.stringCondition = "bar";
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('helloNumber');
+ expect(fixture.debugElement.nativeElement).toHaveText('helloNumber');
async.done();
});
}));
@@ -164,17 +164,17 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
- rootTC.debugElement.componentInstance.numberCondition = 2;
- rootTC.detectChanges();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ fixture.debugElement.componentInstance.numberCondition = 2;
+ fixture.detectChanges();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
async.done();
});
@@ -186,15 +186,16 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- DOM.addClass(DOM.querySelector(rootTC.debugElement.nativeElement, 'copy-me'),
+ .then((fixture) => {
+ fixture.detectChanges();
+ DOM.addClass(DOM.querySelector(fixture.debugElement.nativeElement, 'copy-me'),
"foo");
- rootTC.debugElement.componentInstance.numberCondition = 2;
- rootTC.detectChanges();
- expect(DOM.hasClass(
- DOM.querySelector(rootTC.debugElement.nativeElement, 'copy-me'), "foo"))
+ fixture.debugElement.componentInstance.numberCondition = 2;
+ fixture.detectChanges();
+ expect(
+ DOM.hasClass(DOM.querySelector(fixture.debugElement.nativeElement, 'copy-me'),
+ "foo"))
.toBe(true);
async.done();
@@ -209,11 +210,11 @@ export function main() {
tcb.overrideTemplate(TestComponent, html)
.createAsync(TestComponent)
- .then((rootTC) => {
- expect(() => rootTC.detectChanges()).toThrowError();
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'copy-me').length)
+ .then((fixture) => {
+ expect(() => fixture.detectChanges()).toThrowError();
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(0);
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
}));
diff --git a/modules/angular2/test/core/directives/ng_style_spec.ts b/modules/angular2/test/core/directives/ng_style_spec.ts
index e9d49055d8..0530a4d788 100644
--- a/modules/angular2/test/core/directives/ng_style_spec.ts
+++ b/modules/angular2/test/core/directives/ng_style_spec.ts
@@ -30,9 +30,9 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('40px');
@@ -46,19 +46,19 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
+ .then((fixture) => {
var expr: Map;
- rootTC.debugElement.componentInstance.expr = {'max-width': '40px'};
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('40px');
- expr = rootTC.debugElement.componentInstance.expr;
+ expr = fixture.debugElement.componentInstance.expr;
expr['max-width'] = '30%';
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('30%');
@@ -72,16 +72,16 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.expr = {'max-width': '40px'};
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('40px');
- StringMapWrapper.delete(rootTC.debugElement.componentInstance.expr, 'max-width');
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width');
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('');
@@ -95,22 +95,22 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.expr = {'max-width': '40px'};
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('40px');
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'font-size'))
.toEqual('12px');
- StringMapWrapper.delete(rootTC.debugElement.componentInstance.expr, 'max-width');
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width');
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('');
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'font-size'))
.toEqual('12px');
@@ -124,23 +124,23 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.expr = {'max-width': '40px'};
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.expr = {'max-width': '40px'};
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('40px');
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'font-size'))
.toEqual('12px');
- StringMapWrapper.delete(rootTC.debugElement.componentInstance.expr, 'max-width');
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width');
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'font-size'))
.toEqual('12px');
- rootTC.detectChanges();
- expect(DOM.getStyle(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ fixture.detectChanges();
+ expect(DOM.getStyle(fixture.debugElement.componentViewChildren[0].nativeElement,
'max-width'))
.toEqual('');
diff --git a/modules/angular2/test/core/directives/ng_switch_spec.ts b/modules/angular2/test/core/directives/ng_switch_spec.ts
index 9326fbcece..4f1246f904 100644
--- a/modules/angular2/test/core/directives/ng_switch_spec.ts
+++ b/modules/angular2/test/core/directives/ng_switch_spec.ts
@@ -29,17 +29,17 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('');
- rootTC.debugElement.componentInstance.switchValue = 'a';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when a');
+ fixture.debugElement.componentInstance.switchValue = 'a';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when a');
- rootTC.debugElement.componentInstance.switchValue = 'b';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when b');
+ fixture.debugElement.componentInstance.switchValue = 'b';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when b');
async.done();
});
@@ -55,17 +55,17 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when default');
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when default');
- rootTC.debugElement.componentInstance.switchValue = 'a';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when a');
+ fixture.debugElement.componentInstance.switchValue = 'a';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when a');
- rootTC.debugElement.componentInstance.switchValue = 'b';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when default');
+ fixture.debugElement.componentInstance.switchValue = 'b';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when default');
async.done();
});
@@ -85,18 +85,18 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement)
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement)
.toHaveText('when default1;when default2;');
- rootTC.debugElement.componentInstance.switchValue = 'a';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when a1;when a2;');
+ fixture.debugElement.componentInstance.switchValue = 'a';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when a1;when a2;');
- rootTC.debugElement.componentInstance.switchValue = 'b';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when b1;when b2;');
+ fixture.debugElement.componentInstance.switchValue = 'b';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when b1;when b2;');
async.done();
});
@@ -115,28 +115,28 @@ export function main() {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.when1 = 'a';
- rootTC.debugElement.componentInstance.when2 = 'b';
- rootTC.debugElement.componentInstance.switchValue = 'a';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when 1;');
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.when1 = 'a';
+ fixture.debugElement.componentInstance.when2 = 'b';
+ fixture.debugElement.componentInstance.switchValue = 'a';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when 1;');
- rootTC.debugElement.componentInstance.switchValue = 'b';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when 2;');
+ fixture.debugElement.componentInstance.switchValue = 'b';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when 2;');
- rootTC.debugElement.componentInstance.switchValue = 'c';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when default;');
+ fixture.debugElement.componentInstance.switchValue = 'c';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when default;');
- rootTC.debugElement.componentInstance.when1 = 'c';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when 1;');
+ fixture.debugElement.componentInstance.when1 = 'c';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when 1;');
- rootTC.debugElement.componentInstance.when1 = 'd';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('when default;');
+ fixture.debugElement.componentInstance.when1 = 'd';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('when default;');
async.done();
});
diff --git a/modules/angular2/test/core/directives/non_bindable_spec.ts b/modules/angular2/test/core/directives/non_bindable_spec.ts
index e711a8ba50..b2102b3ebd 100644
--- a/modules/angular2/test/core/directives/non_bindable_spec.ts
+++ b/modules/angular2/test/core/directives/non_bindable_spec.ts
@@ -22,9 +22,9 @@ export function main() {
var template = '{{text}}{{text}}
';
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('foo{{text}}');
+ .then((fixture) => {
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('foo{{text}}');
async.done();
});
}));
@@ -34,12 +34,12 @@ export function main() {
var template = '{{text}}
';
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- // We must use DOM.querySelector instead of rootTC.query here
+ // We must use DOM.querySelector instead of fixture.query here
// since the elements inside are not compiled.
- var span = DOM.querySelector(rootTC.debugElement.nativeElement, '#child');
+ var span = DOM.querySelector(fixture.debugElement.nativeElement, '#child');
expect(DOM.hasClass(span, 'compiled')).toBeFalsy();
async.done();
});
@@ -50,9 +50,9 @@ export function main() {
var template = '{{text}}
';
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
- .then((rootTC) => {
- rootTC.detectChanges();
- var span = DOM.querySelector(rootTC.debugElement.nativeElement, '#child');
+ .then((fixture) => {
+ fixture.detectChanges();
+ var span = DOM.querySelector(fixture.debugElement.nativeElement, '#child');
expect(DOM.hasClass(span, 'compiled')).toBeTruthy();
async.done();
});
diff --git a/modules/angular2/test/core/forms/integration_spec.ts b/modules/angular2/test/core/forms/integration_spec.ts
index ee2bf07164..490348b7ea 100644
--- a/modules/angular2/test/core/forms/integration_spec.ts
+++ b/modules/angular2/test/core/forms/integration_spec.ts
@@ -1,6 +1,6 @@
import {Component, Directive, View, Output, EventEmitter} from 'angular2/angular2';
import {
- RootTestComponent,
+ ComponentFixture,
afterEach,
AsyncTestCompleter,
TestComponentBuilder,
@@ -51,12 +51,12 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"login": new Control("loginValue")});
- rootTC.detectChanges();
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("loginValue");
async.done();
});
@@ -70,10 +70,10 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
+ var input = fixture.debugElement.query(By.css("input"));
input.nativeElement.value = "updatedValue";
dispatchEvent(input.nativeElement, "change");
@@ -90,22 +90,22 @@ export function main() {
{{name}}
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.form = new ControlGroup({});
- rootTC.debugElement.componentInstance.name = 'old';
+ fixture.debugElement.componentInstance.form = new ControlGroup({});
+ fixture.debugElement.componentInstance.name = 'old';
tick();
- var form = rootTC.debugElement.query(By.css("form"));
+ var form = fixture.debugElement.query(By.css("form"));
dispatchEvent(form.nativeElement, "submit");
tick();
- expect(rootTC.debugElement.componentInstance.name).toEqual('updated');
+ expect(fixture.debugElement.componentInstance.name).toEqual('updated');
})));
it("should work with single controls",
@@ -114,11 +114,11 @@ export function main() {
var t = `
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = control;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = control;
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("loginValue");
input.nativeElement.value = "updatedValue";
@@ -135,16 +135,16 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"login": new Control("oldValue")});
- rootTC.detectChanges();
+ fixture.detectChanges();
- rootTC.debugElement.componentInstance.form =
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"login": new Control("newValue")});
- rootTC.detectChanges();
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("newValue");
async.done();
});
@@ -159,15 +159,15 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
login.updateValue("newValue");
- rootTC.detectChanges();
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("newValue");
async.done();
});
@@ -182,11 +182,11 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
- var loginEl = rootTC.debugElement.query(By.css("input"));
+ var loginEl = fixture.debugElement.query(By.css("input"));
expect(login.touched).toBe(false);
dispatchEvent(loginEl.nativeElement, "blur");
@@ -204,18 +204,18 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"text": new Control("old")});
- rootTC.detectChanges();
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("old");
input.nativeElement.value = "new";
dispatchEvent(input.nativeElement, "input");
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"text": "new"});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"text": "new"});
async.done();
});
}));
@@ -226,17 +226,17 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"text": new Control("old")});
- rootTC.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ fixture.detectChanges();
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("old");
input.nativeElement.value = "new";
dispatchEvent(input.nativeElement, "input");
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"text": "new"});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"text": "new"});
async.done();
});
}));
@@ -247,18 +247,18 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"text": new Control('old')});
- rootTC.detectChanges();
+ fixture.detectChanges();
- var textarea = rootTC.debugElement.query(By.css("textarea"));
+ var textarea = fixture.debugElement.query(By.css("textarea"));
expect(textarea.nativeElement.value).toEqual("old");
textarea.nativeElement.value = "new";
dispatchEvent(textarea.nativeElement, "input");
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"text": 'new'});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"text": 'new'});
async.done();
});
}));
@@ -269,18 +269,18 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"checkbox": new Control(true)});
- rootTC.detectChanges();
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.checked).toBe(true);
input.nativeElement.checked = false;
dispatchEvent(input.nativeElement, "change");
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"checkbox": false});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"checkbox": false});
async.done();
});
}));
@@ -291,18 +291,18 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"num": new Control(10)});
- rootTC.detectChanges();
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("10");
input.nativeElement.value = "20";
dispatchEvent(input.nativeElement, "change");
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"num": 20});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"num": 20});
async.done();
});
}));
@@ -316,20 +316,20 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"city": new Control("SF")});
- rootTC.detectChanges();
+ fixture.detectChanges();
- var select = rootTC.debugElement.query(By.css("select"));
- var sfOption = rootTC.debugElement.query(By.css("option"));
+ var select = fixture.debugElement.query(By.css("select"));
+ var sfOption = fixture.debugElement.query(By.css("option"));
expect(select.nativeElement.value).toEqual('SF');
expect(sfOption.nativeElement.selected).toBe(true);
select.nativeElement.value = 'NYC';
dispatchEvent(select.nativeElement, "change");
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"city": 'NYC'});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"city": 'NYC'});
expect(sfOption.nativeElement.selected).toBe(false);
async.done();
});
@@ -343,17 +343,18 @@ export function main() {
`;
- var rootTC;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rtc) => rootTC = rtc);
+ var fixture;
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
+ (compFixture) => fixture = compFixture);
tick();
- rootTC.debugElement.componentInstance.form =
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"city": new Control("NYC")});
- rootTC.debugElement.componentInstance.data = ['SF', 'NYC'];
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.data = ['SF', 'NYC'];
+ fixture.detectChanges();
tick();
- var select = rootTC.debugElement.query(By.css('select'));
+ var select = fixture.debugElement.query(By.css('select'));
expect(select.nativeElement.value).toEqual('NYC');
})));
@@ -363,17 +364,17 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"name": new Control("aa")});
- rootTC.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ fixture.detectChanges();
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("!aa!");
input.nativeElement.value = "!bb!";
dispatchEvent(input.nativeElement, "change");
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"name": "bb"});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"name": "bb"});
async.done();
});
}));
@@ -384,16 +385,16 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form =
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form =
new ControlGroup({"name": new Control("aa")});
- rootTC.detectChanges();
- var input = rootTC.debugElement.query(By.css("my-input"));
+ fixture.detectChanges();
+ var input = fixture.debugElement.query(By.css("my-input"));
expect(input.componentInstance.value).toEqual("!aa!");
input.componentInstance.value = "!bb!";
ObservableWrapper.subscribe(input.componentInstance.onChange, (value) => {
- expect(rootTC.debugElement.componentInstance.form.value).toEqual({"name": "bb"});
+ expect(fixture.debugElement.componentInstance.form.value).toEqual({"name": "bb"});
async.done();
});
input.componentInstance.dispatchChangeEvent();
@@ -414,13 +415,13 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
- var required = rootTC.debugElement.query(By.css("[required]"));
- var minLength = rootTC.debugElement.query(By.css("[minlength]"));
- var maxLength = rootTC.debugElement.query(By.css("[maxlength]"));
+ var required = fixture.debugElement.query(By.css("[required]"));
+ var minLength = fixture.debugElement.query(By.css("[minlength]"));
+ var maxLength = fixture.debugElement.query(By.css("[maxlength]"));
required.nativeElement.value = "";
minLength.nativeElement.value = "1";
@@ -485,12 +486,12 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
expect(form.valid).toEqual(true);
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
input.nativeElement.value = "";
dispatchEvent(input.nativeElement, "change");
@@ -510,16 +511,17 @@ export function main() {
`;
- var rootTC;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => rootTC = root);
+ var fixture;
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => fixture =
+ root);
tick();
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
expect(form.hasError("required", ["login"])).toEqual(true);
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
input.nativeElement.value = "wrong value";
dispatchEvent(input.nativeElement, "change");
@@ -548,11 +550,11 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ var input = fixture.debugElement.query(By.css("input"));
expect(input.nativeElement.value).toEqual("value");
async.done();
});
@@ -569,10 +571,10 @@ export function main() {
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
- var input = rootTC.debugElement.query(By.css("input"));
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
+ var input = fixture.debugElement.query(By.css("input"));
input.nativeElement.value = "updatedValue";
dispatchEvent(input.nativeElement, "change");
@@ -591,47 +593,49 @@ export function main() {
var t =
`
`;
- var rootTC: RootTestComponent;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { rootTC = root; });
+ var fixture: ComponentFixture;
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = 'oldValue';
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = 'oldValue';
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input")).nativeElement;
+ var input = fixture.debugElement.query(By.css("input")).nativeElement;
expect(input.value).toEqual("oldValue");
input.value = "updatedValue";
dispatchEvent(input, "change");
tick();
- expect(rootTC.debugElement.componentInstance.name).toEqual("updatedValue");
+ expect(fixture.debugElement.componentInstance.name).toEqual("updatedValue");
})));
it("should support ng-model for single fields",
- inject(
- [TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
- var form = new Control("");
+ inject([TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
+ var form = new Control("");
- var t = `
`;
+ var t =
+ `
`;
- var rootTC: RootTestComponent;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { rootTC = root; });
- tick();
- rootTC.debugElement.componentInstance.form = form;
- rootTC.debugElement.componentInstance.name = "oldValue";
- rootTC.detectChanges();
+ var fixture: ComponentFixture;
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
+ (root) => { fixture = root; });
+ tick();
+ fixture.debugElement.componentInstance.form = form;
+ fixture.debugElement.componentInstance.name = "oldValue";
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input")).nativeElement;
- expect(input.value).toEqual("oldValue");
+ var input = fixture.debugElement.query(By.css("input")).nativeElement;
+ expect(input.value).toEqual("oldValue");
- input.value = "updatedValue";
- dispatchEvent(input, "change");
- tick();
+ input.value = "updatedValue";
+ dispatchEvent(input, "change");
+ tick();
- expect(rootTC.debugElement.componentInstance.name).toEqual("updatedValue");
- })));
+ expect(fixture.debugElement.componentInstance.name).toEqual("updatedValue");
+ })));
describe("template-driven forms", () => {
it("should add new controls and control groups",
@@ -642,14 +646,14 @@ export function main() {
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = null;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = null;
+ fixture.detectChanges();
- var form = rootTC.debugElement.componentViewChildren[0].inject(NgForm);
+ var form = fixture.debugElement.componentViewChildren[0].inject(NgForm);
expect(form.controls['user']).not.toBeDefined();
tick();
@@ -662,17 +666,17 @@ export function main() {
inject([TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
var t = `
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = 'old';
- var form = rootTC.debugElement.query(By.css("form"));
+ fixture.debugElement.componentInstance.name = 'old';
+ var form = fixture.debugElement.query(By.css("form"));
dispatchEvent(form.nativeElement, "submit");
tick();
- expect(rootTC.debugElement.componentInstance.name).toEqual("updated");
+ expect(fixture.debugElement.componentInstance.name).toEqual("updated");
})));
it("should not create a template-driven form when ng-no-form is used",
@@ -680,11 +684,11 @@ export function main() {
var t = ``;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.name = null;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.name = null;
+ fixture.detectChanges();
- expect(rootTC.debugElement.componentViewChildren.length).toEqual(0);
+ expect(fixture.debugElement.componentViewChildren.length).toEqual(0);
async.done();
});
}));
@@ -697,20 +701,20 @@ export function main() {
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = 'show';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = 'show';
+ fixture.detectChanges();
tick();
- var form = rootTC.debugElement.componentViewChildren[0].inject(NgForm);
+ var form = fixture.debugElement.componentViewChildren[0].inject(NgForm);
expect(form.controls['login']).toBeDefined();
- rootTC.debugElement.componentInstance.name = 'hide';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = 'hide';
+ fixture.detectChanges();
tick();
expect(form.controls['login']).not.toBeDefined();
@@ -725,19 +729,19 @@ export function main() {
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = 'show';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = 'show';
+ fixture.detectChanges();
tick();
- var form = rootTC.debugElement.componentViewChildren[0].inject(NgForm);
+ var form = fixture.debugElement.componentViewChildren[0].inject(NgForm);
expect(form.controls['user']).toBeDefined();
- rootTC.debugElement.componentInstance.name = 'hide';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = 'hide';
+ fixture.detectChanges();
tick();
expect(form.controls['user']).not.toBeDefined();
@@ -749,22 +753,22 @@ export function main() {
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = "oldValue";
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = "oldValue";
+ fixture.detectChanges();
tick();
- var input = rootTC.debugElement.query(By.css("input")).nativeElement;
+ var input = fixture.debugElement.query(By.css("input")).nativeElement;
expect(input.value).toEqual("oldValue");
input.value = "updatedValue";
dispatchEvent(input, "change");
tick();
- expect(rootTC.debugElement.componentInstance.name).toEqual("updatedValue");
+ expect(fixture.debugElement.componentInstance.name).toEqual("updatedValue");
})));
@@ -772,21 +776,21 @@ export function main() {
inject([TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
var t = `
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = "oldValue";
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = "oldValue";
+ fixture.detectChanges();
- var input = rootTC.debugElement.query(By.css("input")).nativeElement;
+ var input = fixture.debugElement.query(By.css("input")).nativeElement;
expect(input.value).toEqual("oldValue");
input.value = "updatedValue";
dispatchEvent(input, "change");
tick();
- expect(rootTC.debugElement.componentInstance.name).toEqual("updatedValue");
+ expect(fixture.debugElement.componentInstance.name).toEqual("updatedValue");
})));
});
@@ -798,21 +802,21 @@ export function main() {
var t = `
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
- var input = rootTC.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']);
dispatchEvent(input, "blur");
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
input.value = "updatedValue";
dispatchEvent(input, "change");
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-dirty", "ng-touched", "ng-valid"]);
async.done();
@@ -825,21 +829,21 @@ export function main() {
var t = ``;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
- var input = rootTC.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"]);
dispatchEvent(input, "blur");
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
input.value = "updatedValue";
dispatchEvent(input, "change");
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-dirty", "ng-touched", "ng-valid"]);
async.done();
@@ -850,21 +854,21 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
var t = `
`;
- tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((rootTC) => {
- rootTC.debugElement.componentInstance.name = "";
- rootTC.detectChanges();
+ tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => {
+ fixture.debugElement.componentInstance.name = "";
+ fixture.detectChanges();
- var input = rootTC.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"]);
dispatchEvent(input, "blur");
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-invalid", "ng-pristine", "ng-touched"]);
input.value = "updatedValue";
dispatchEvent(input, "change");
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(sortedClassList(input)).toEqual(["ng-dirty", "ng-touched", "ng-valid"]);
async.done();
@@ -879,27 +883,27 @@ export function main() {
var t =
`
`;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.form = form;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.form = form;
+ fixture.detectChanges();
// In Firefox, effective text selection in the real DOM requires an actual focus
// of the field. This is not an issue in a new HTML document.
if (browserDetection.isFirefox) {
var fakeDoc = DOM.createHtmlDocument();
- DOM.appendChild(fakeDoc.body, rootTC.debugElement.nativeElement);
+ DOM.appendChild(fakeDoc.body, fixture.debugElement.nativeElement);
}
- var input = rootTC.debugElement.query(By.css("input")).nativeElement;
+ var input = fixture.debugElement.query(By.css("input")).nativeElement;
input.value = "aa";
input.selectionStart = 1;
dispatchEvent(input, "change");
tick();
- rootTC.detectChanges();
+ fixture.detectChanges();
// selection start has not changed because we did not reset the value
expect(input.selectionStart).toEqual(1);
@@ -908,33 +912,33 @@ export function main() {
it("should update the view when the model is set back to what used to be in the view",
inject([TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
var t = ` `;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.debugElement.componentInstance.name = "";
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.name = "";
+ fixture.detectChanges();
// Type "aa" into the input.
- var input = rootTC.debugElement.query(By.css("input")).nativeElement;
+ var input = fixture.debugElement.query(By.css("input")).nativeElement;
input.value = "aa";
input.selectionStart = 1;
dispatchEvent(input, "change");
tick();
- rootTC.detectChanges();
- expect(rootTC.debugElement.componentInstance.name).toEqual("aa");
+ fixture.detectChanges();
+ expect(fixture.debugElement.componentInstance.name).toEqual("aa");
// Programatically update the input value to be "bb".
- rootTC.debugElement.componentInstance.name = "bb";
+ fixture.debugElement.componentInstance.name = "bb";
tick();
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(input.value).toEqual("bb");
// Programatically set it back to "aa".
- rootTC.debugElement.componentInstance.name = "aa";
+ fixture.debugElement.componentInstance.name = "aa";
tick();
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(input.value).toEqual("aa");
})));
it("should not crash when validity is checked from a binding",
@@ -944,11 +948,11 @@ export function main() {
// fixed.
var t = ``;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
- (root) => { rootTC = root; });
+ (root) => { fixture = root; });
tick();
- rootTC.detectChanges();
+ fixture.detectChanges();
})));
});
});
diff --git a/modules/angular2/test/core/linker/dynamic_component_loader_spec.ts b/modules/angular2/test/core/linker/dynamic_component_loader_spec.ts
index 2c6777244c..72fdbbe22e 100644
--- a/modules/angular2/test/core/linker/dynamic_component_loader_spec.ts
+++ b/modules/angular2/test/core/linker/dynamic_component_loader_spec.ts
@@ -13,7 +13,7 @@ import {
it,
xit,
TestComponentBuilder,
- RootTestComponent
+ ComponentFixture
} from 'angular2/testing_internal';
import {OnDestroy} from 'angular2/lifecycle_hooks';
@@ -24,7 +24,7 @@ import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component
import {ElementRef} from 'angular2/src/core/linker/element_ref';
import {DOCUMENT} from 'angular2/src/core/render/render';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
-import {RootTestComponent_} from "angular2/src/testing/test_component_builder";
+import {ComponentFixture_} from "angular2/src/testing/test_component_builder";
export function main() {
describe('DynamicComponentLoader', function() {
@@ -232,7 +232,7 @@ export function main() {
DOM.appendChild(doc.body, rootEl);
loader.loadAsRoot(ChildComp, null, injector)
.then((componentRef) => {
- var el = new RootTestComponent_(componentRef);
+ var el = new ComponentFixture_(componentRef);
expect(rootEl.parentNode).toBe(doc.body);
el.detectChanges();
diff --git a/modules/angular2/test/core/linker/integration_spec.ts b/modules/angular2/test/core/linker/integration_spec.ts
index e2bc3ca673..b663f7f890 100644
--- a/modules/angular2/test/core/linker/integration_spec.ts
+++ b/modules/angular2/test/core/linker/integration_spec.ts
@@ -18,7 +18,7 @@ import {
fakeAsync,
tick,
clearPendingTimers,
- RootTestComponent
+ ComponentFixture
} from 'angular2/testing_internal';
@@ -106,11 +106,11 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({template: '{{ctxProp}}
'}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = 'Hello World!';
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = 'Hello World!';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('Hello World!');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('Hello World!');
async.done();
});
}));
@@ -119,11 +119,11 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({template: '{{null}}{{ctxProp}}
'}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = null;
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = null;
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
}));
@@ -132,12 +132,12 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({template: '
'}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.ctxProp = 'Hello World!';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'Hello World!';
+ fixture.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[0].nativeElement.id)
+ expect(fixture.debugElement.componentViewChildren[0].nativeElement.id)
.toEqual('Hello World!');
async.done();
});
@@ -149,18 +149,20 @@ export function main() {
new ViewMetadata({template: '
'}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.ctxProp = 'Initial aria label';
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[0].nativeElement,
- 'aria-label'))
+ fixture.debugElement.componentInstance.ctxProp = 'Initial aria label';
+ fixture.detectChanges();
+ expect(
+ DOM.getAttribute(fixture.debugElement.componentViewChildren[0].nativeElement,
+ 'aria-label'))
.toEqual('Initial aria label');
- rootTC.debugElement.componentInstance.ctxProp = 'Changed aria label';
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[0].nativeElement,
- 'aria-label'))
+ fixture.debugElement.componentInstance.ctxProp = 'Changed aria label';
+ fixture.detectChanges();
+ expect(
+ DOM.getAttribute(fixture.debugElement.componentViewChildren[0].nativeElement,
+ 'aria-label'))
.toEqual('Changed aria label');
async.done();
@@ -173,18 +175,18 @@ export function main() {
new ViewMetadata({template: '
'}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.ctxProp = 'bar';
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[0].nativeElement,
- 'foo'))
+ fixture.debugElement.componentInstance.ctxProp = 'bar';
+ fixture.detectChanges();
+ expect(DOM.getAttribute(
+ fixture.debugElement.componentViewChildren[0].nativeElement, 'foo'))
.toEqual('bar');
- rootTC.debugElement.componentInstance.ctxProp = null;
- rootTC.detectChanges();
- expect(DOM.hasAttribute(rootTC.debugElement.componentViewChildren[0].nativeElement,
- 'foo'))
+ fixture.debugElement.componentInstance.ctxProp = null;
+ fixture.detectChanges();
+ expect(DOM.hasAttribute(
+ fixture.debugElement.componentViewChildren[0].nativeElement, 'foo'))
.toBeFalsy();
async.done();
@@ -197,15 +199,15 @@ export function main() {
new ViewMetadata({template: '
'}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[0].nativeElement.tabIndex)
+ fixture.detectChanges();
+ expect(fixture.debugElement.componentViewChildren[0].nativeElement.tabIndex)
.toEqual(0);
- rootTC.debugElement.componentInstance.ctxNumProp = 5;
- rootTC.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[0].nativeElement.tabIndex)
+ fixture.debugElement.componentInstance.ctxNumProp = 5;
+ fixture.detectChanges();
+ expect(fixture.debugElement.componentViewChildren[0].nativeElement.tabIndex)
.toEqual(5);
async.done();
@@ -218,15 +220,15 @@ export function main() {
new ViewMetadata({template: ' '}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[0].nativeElement.readOnly)
+ fixture.detectChanges();
+ expect(fixture.debugElement.componentViewChildren[0].nativeElement.readOnly)
.toBeFalsy();
- rootTC.debugElement.componentInstance.ctxBoolProp = true;
- rootTC.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[0].nativeElement.readOnly)
+ fixture.debugElement.componentInstance.ctxBoolProp = true;
+ fixture.detectChanges();
+ expect(fixture.debugElement.componentViewChildren[0].nativeElement.readOnly)
.toBeTruthy();
async.done();
@@ -239,18 +241,18 @@ export function main() {
new ViewMetadata({template: '
'}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.ctxProp = 'Some HTML ';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'Some HTML ';
+ fixture.detectChanges();
expect(
- DOM.getInnerHTML(rootTC.debugElement.componentViewChildren[0].nativeElement))
+ DOM.getInnerHTML(fixture.debugElement.componentViewChildren[0].nativeElement))
.toEqual('Some HTML ');
- rootTC.debugElement.componentInstance.ctxProp = 'Some other HTML
';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'Some other HTML
';
+ fixture.detectChanges();
expect(
- DOM.getInnerHTML(rootTC.debugElement.componentViewChildren[0].nativeElement))
+ DOM.getInnerHTML(fixture.debugElement.componentViewChildren[0].nativeElement))
.toEqual('Some other HTML
');
async.done();
@@ -264,10 +266,10 @@ export function main() {
new ViewMetadata({template: '
'}))
.createAsync(MyComp)
- .then((rootTC) => {
- var nativeEl = rootTC.debugElement.componentViewChildren[0].nativeElement;
- rootTC.debugElement.componentInstance.ctxProp = 'foo bar';
- rootTC.detectChanges();
+ .then((fixture) => {
+ var nativeEl = fixture.debugElement.componentViewChildren[0].nativeElement;
+ fixture.debugElement.componentInstance.ctxProp = 'foo bar';
+ fixture.detectChanges();
expect(nativeEl).toHaveCssClass('foo');
expect(nativeEl).toHaveCssClass('bar');
@@ -288,18 +290,18 @@ export function main() {
tcb.overrideView(MyComp, new ViewMetadata({template: tpl, directives: [MyDir]}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.ctxProp = 'Hello World!';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'Hello World!';
+ fixture.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[0].inject(MyDir).dirProp)
+ expect(fixture.debugElement.componentViewChildren[0].inject(MyDir).dirProp)
.toEqual('Hello World!');
- expect(rootTC.debugElement.componentViewChildren[1].inject(MyDir).dirProp)
+ expect(fixture.debugElement.componentViewChildren[1].inject(MyDir).dirProp)
.toEqual('Hi there!');
- expect(rootTC.debugElement.componentViewChildren[2].inject(MyDir).dirProp)
+ expect(fixture.debugElement.componentViewChildren[2].inject(MyDir).dirProp)
.toEqual('Hi there!');
- expect(rootTC.debugElement.componentViewChildren[3].inject(MyDir).dirProp)
+ expect(fixture.debugElement.componentViewChildren[3].inject(MyDir).dirProp)
.toEqual('One more Hello World!');
async.done();
});
@@ -317,11 +319,11 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = 'a';
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = 'a';
+ fixture.detectChanges();
- var dir = rootTC.debugElement.componentViewChildren[0].getLocal('dir');
+ var dir = fixture.debugElement.componentViewChildren[0].getLocal('dir');
expect(dir.dirProp).toEqual('aa');
async.done();
});
@@ -335,11 +337,11 @@ export function main() {
new ViewMetadata({template: ' ', directives: [ChildComp]}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
async.done();
});
}));
@@ -353,12 +355,12 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.debugElement.componentInstance.ctxProp = 'Hello World!';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'Hello World!';
+ fixture.detectChanges();
- var tc = rootTC.debugElement.componentViewChildren[0];
+ var tc = fixture.debugElement.componentViewChildren[0];
expect(tc.inject(MyDir).dirProp).toEqual('Hello World!');
expect(tc.inject(ChildComp).dirProp).toEqual(null);
@@ -376,7 +378,7 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => { async.done(); });
+ .then((fixture) => { async.done(); });
}));
it('should execute a given directive once, even if specified multiple times',
@@ -387,8 +389,8 @@ export function main() {
directives: [DuplicateDir, DuplicateDir, [DuplicateDir, [DuplicateDir]]]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(rootTC.debugElement.nativeElement).toHaveText('noduplicate');
+ .then((fixture) => {
+ expect(fixture.debugElement.nativeElement).toHaveText('noduplicate');
async.done();
});
}));
@@ -399,16 +401,16 @@ export function main() {
{template: '
', directives: [IdDir]}))
.createAsync(MyComp)
- .then((rootTC) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var tc = fixture.debugElement.componentViewChildren[0];
var idDir = tc.inject(IdDir);
- rootTC.debugElement.componentInstance.ctxProp = 'some_id';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'some_id';
+ fixture.detectChanges();
expect(idDir.id).toEqual('some_id');
- rootTC.debugElement.componentInstance.ctxProp = 'other_id';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'other_id';
+ fixture.detectChanges();
expect(idDir.id).toEqual('other_id');
async.done();
@@ -423,7 +425,7 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => { async.done(); });
+ .then((fixture) => { async.done(); });
}));
it('should support template directives via `` elements.',
@@ -436,11 +438,11 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
- var childNodesOfWrapper = DOM.childNodes(rootTC.debugElement.nativeElement);
+ var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement);
// 1 template + 2 copies.
expect(childNodesOfWrapper.length).toBe(3);
expect(childNodesOfWrapper[1]).toHaveText('hello');
@@ -459,10 +461,10 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- var childNodesOfWrapper = DOM.childNodes(rootTC.debugElement.nativeElement);
+ var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement);
// 1 template + 2 copies.
expect(childNodesOfWrapper.length).toBe(3);
expect(childNodesOfWrapper[1]).toHaveText('hello');
@@ -480,11 +482,11 @@ export function main() {
directives: [SomeDirective, CompWithHost, ToolbarComponent, ToolbarPart]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = 'From myComp';
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = 'From myComp';
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement)
+ expect(fixture.debugElement.nativeElement)
.toHaveText(
'TOOLBAR(From myComp,From toolbar,Component with an injected host)');
@@ -502,8 +504,8 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(rootTC.debugElement.componentViewChildren[0].getLocal('alice'))
+ .then((fixture) => {
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('alice'))
.toBeAnInstanceOf(ChildComp);
async.done();
@@ -518,8 +520,8 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(rootTC.debugElement.componentViewChildren[0].getLocal('localdir'))
+ .then((fixture) => {
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('localdir'))
.toBeAnInstanceOf(ExportDir);
async.done();
@@ -537,10 +539,10 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement)
+ expect(fixture.debugElement.nativeElement)
.toHaveText('hellohello'); // this first one is the
// component, the second one is
// the text binding
@@ -558,15 +560,15 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- expect(rootTC.debugElement.componentViewChildren[0].getLocal('alice'))
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('alice'))
.toBeAnInstanceOf(ChildComp);
- expect(rootTC.debugElement.componentViewChildren[0].getLocal('bob'))
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('bob'))
.toBeAnInstanceOf(ChildComp);
- expect(rootTC.debugElement.componentViewChildren[0].getLocal('alice'))
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('alice'))
.not.toBe(
- rootTC.debugElement.componentViewChildren[0].getLocal('bob'));
+ fixture.debugElement.componentViewChildren[0].getLocal('bob'));
async.done();
})}));
@@ -580,9 +582,9 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- expect(rootTC.debugElement.componentViewChildren[0].getLocal('alice'))
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('alice'))
.toBeAnInstanceOf(ChildComp);
async.done();
@@ -596,10 +598,10 @@ export function main() {
{template: '
Hello
'}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
var value =
- rootTC.debugElement.componentViewChildren[0].getLocal('alice');
+ fixture.debugElement.componentViewChildren[0].getLocal('alice');
expect(value).not.toBe(null);
expect(value.tagName.toLowerCase()).toEqual('div');
@@ -615,8 +617,8 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(rootTC.debugElement.componentViewChildren[0].getLocal('superAlice'))
+ .then((fixture) => {
+ expect(fixture.debugElement.componentViewChildren[0].getLocal('superAlice'))
.toBeAnInstanceOf(ChildComp);
async.done();
@@ -634,11 +636,11 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
// Get the element at index 2, since index 0 is the .
- expect(DOM.childNodes(rootTC.debugElement.nativeElement)[2])
+ expect(DOM.childNodes(fixture.debugElement.nativeElement)[2])
.toHaveText("1-hello");
async.done();
@@ -657,19 +659,19 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- var cmp = rootTC.debugElement.componentViewChildren[0].getLocal('cmp');
+ var cmp = fixture.debugElement.componentViewChildren[0].getLocal('cmp');
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(1);
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(1);
cmp.propagate();
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(2);
async.done();
})}));
@@ -684,15 +686,15 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var cmp = rootTC.debugElement.componentViewChildren[0].getLocal('cmp');
+ .then((fixture) => {
+ var cmp = fixture.debugElement.componentViewChildren[0].getLocal('cmp');
- rootTC.debugElement.componentInstance.ctxProp = "one";
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = "one";
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(1);
- rootTC.debugElement.componentInstance.ctxProp = "two";
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = "two";
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(2);
async.done();
@@ -709,16 +711,16 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- var cmp = rootTC.debugElement.componentViewChildren[0].getLocal('cmp');
+ var cmp = fixture.debugElement.componentViewChildren[0].getLocal('cmp');
- rootTC.debugElement.componentInstance.ctxProp = "one";
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = "one";
+ fixture.detectChanges();
expect(cmp.prop).toEqual("one");
- rootTC.debugElement.componentInstance.ctxProp = "two";
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = "two";
+ fixture.detectChanges();
expect(cmp.prop).toEqual("two");
async.done();
@@ -733,22 +735,22 @@ export function main() {
directives: [[[PushCmpWithAsyncPipe]]]
}));
- var rootTC: RootTestComponent;
- tcb.createAsync(MyComp).then(root => { rootTC = root; });
+ var fixture: ComponentFixture;
+ tcb.createAsync(MyComp).then(root => { fixture = root; });
tick();
- var cmp = rootTC.debugElement.componentViewChildren[0].getLocal('cmp');
- rootTC.detectChanges();
+ var cmp = fixture.debugElement.componentViewChildren[0].getLocal('cmp');
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(1);
- rootTC.detectChanges();
- rootTC.detectChanges();
+ fixture.detectChanges();
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(1);
cmp.resolve(2);
tick();
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmp.numberOfChecks).toEqual(2);
})));
}
@@ -768,10 +770,10 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
var childComponent =
- rootTC.debugElement.componentViewChildren[0].getLocal('child');
+ fixture.debugElement.componentViewChildren[0].getLocal('child');
expect(childComponent.myHost).toBeAnInstanceOf(SomeDirective);
async.done();
@@ -790,10 +792,10 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- var tc = rootTC.debugElement.componentViewChildren[0].children[1];
+ var tc = fixture.debugElement.componentViewChildren[0].children[1];
var childComponent = tc.getLocal('child');
expect(childComponent.myHost).toBeAnInstanceOf(SomeDirective);
@@ -810,9 +812,9 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ var tc = fixture.debugElement.componentViewChildren[0];
var emitter = tc.inject(DirectiveEmitingEvent);
var listener = tc.inject(DirectiveListeningEvent);
@@ -836,9 +838,9 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ var tc = fixture.debugElement.componentViewChildren[0];
var emitter = tc.inject(DirectiveEmitingEvent);
var myComp = tc.inject(MyComp);
var listener = tc.inject(DirectiveListeningEvent);
@@ -864,17 +866,17 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var tc = fixture.debugElement.componentViewChildren[0];
var dir = tc.inject(DirectiveWithTwoWayBinding);
- rootTC.debugElement.componentInstance.ctxProp = 'one';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'one';
+ fixture.detectChanges();
expect(dir.control).toEqual('one');
ObservableWrapper.subscribe(dir.controlChange, (_) => {
- expect(rootTC.debugElement.componentInstance.ctxProp).toEqual('two');
+ expect(fixture.debugElement.componentInstance.ctxProp).toEqual('two');
async.done();
});
@@ -890,9 +892,9 @@ export function main() {
{template: '
', directives: [DirectiveListeningDomEvent]}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ var tc = fixture.debugElement.componentViewChildren[0];
var listener = tc.inject(DirectiveListeningDomEvent);
dispatchEvent(tc.nativeElement, 'domEvent');
@@ -913,8 +915,8 @@ export function main() {
{template: '
', directives: [DirectiveListeningDomEvent]}))
.createAsync(MyComp)
- .then((rootTC) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var tc = fixture.debugElement.componentViewChildren[0];
var listener = tc.inject(DirectiveListeningDomEvent);
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
expect(listener.eventTypes).toEqual(['window_domEvent']);
@@ -923,7 +925,7 @@ export function main() {
dispatchEvent(DOM.getGlobalEventTarget("document"), 'domEvent');
expect(listener.eventTypes).toEqual(['document_domEvent', 'window_domEvent']);
- rootTC.destroy();
+ fixture.destroy();
listener.eventTypes = [];
dispatchEvent(DOM.getGlobalEventTarget("body"), 'domEvent');
expect(listener.eventTypes).toEqual([]);
@@ -940,11 +942,11 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[0].nativeElement,
- "role"))
+ expect(DOM.getAttribute(
+ fixture.debugElement.componentViewChildren[0].nativeElement, "role"))
.toEqual("button");
async.done();
@@ -959,13 +961,13 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var tc = fixture.debugElement.componentViewChildren[0];
var updateHost = tc.inject(DirectiveUpdatingHostProperties);
updateHost.id = "newId";
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(tc.nativeElement.id).toEqual("newId");
@@ -989,20 +991,20 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
var dispatchedEvent = DOM.createMouseEvent('click');
var dispatchedEvent2 = DOM.createMouseEvent('click');
- DOM.dispatchEvent(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ DOM.dispatchEvent(fixture.debugElement.componentViewChildren[0].nativeElement,
dispatchedEvent);
- DOM.dispatchEvent(rootTC.debugElement.componentViewChildren[1].nativeElement,
+ DOM.dispatchEvent(fixture.debugElement.componentViewChildren[1].nativeElement,
dispatchedEvent2);
expect(DOM.isPrevented(dispatchedEvent)).toBe(true);
expect(DOM.isPrevented(dispatchedEvent2)).toBe(false);
expect(
- DOM.getChecked(rootTC.debugElement.componentViewChildren[0].nativeElement))
+ DOM.getChecked(fixture.debugElement.componentViewChildren[0].nativeElement))
.toBeFalsy();
expect(
- DOM.getChecked(rootTC.debugElement.componentViewChildren[1].nativeElement))
+ DOM.getChecked(fixture.debugElement.componentViewChildren[1].nativeElement))
.toBeTruthy();
async.done();
});
@@ -1019,12 +1021,12 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
globalCounter = 0;
- rootTC.debugElement.componentInstance.ctxBoolProp = true;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxBoolProp = true;
+ fixture.detectChanges();
- var tc = rootTC.debugElement.componentViewChildren[1];
+ var tc = fixture.debugElement.componentViewChildren[1];
var listener = tc.inject(DirectiveListeningDomEvent);
var listenerother = tc.inject(DirectiveListeningDomEventOther);
@@ -1034,13 +1036,13 @@ export function main() {
expect(globalCounter).toEqual(1);
- rootTC.debugElement.componentInstance.ctxBoolProp = false;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxBoolProp = false;
+ fixture.detectChanges();
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
expect(globalCounter).toEqual(1);
- rootTC.debugElement.componentInstance.ctxBoolProp = true;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxBoolProp = true;
+ fixture.detectChanges();
dispatchEvent(DOM.getGlobalEventTarget("window"), 'domEvent');
expect(globalCounter).toEqual(2);
@@ -1058,12 +1060,12 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var tc = fixture.debugElement.componentViewChildren[0];
var dynamicVp = tc.inject(DynamicViewport);
dynamicVp.done.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.componentViewChildren[1].nativeElement)
+ fixture.detectChanges();
+ expect(fixture.debugElement.componentViewChildren[1].nativeElement)
.toHaveText('dynamic greet');
async.done();
});
@@ -1079,8 +1081,8 @@ export function main() {
new ViewMetadata(
{template: ' ', directives: [NeedsAttribute]}))
.createAsync(MyComp)
- .then((rootTC) => {
- var tc = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var tc = fixture.debugElement.componentViewChildren[0];
var needsAttribute = tc.inject(NeedsAttribute);
expect(needsAttribute.typeAttribute).toEqual('text');
expect(needsAttribute.staticAttribute).toEqual('');
@@ -1105,8 +1107,8 @@ export function main() {
directives: [DirectiveProvidingInjectable, DirectiveConsumingInjectable]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var comp = rootTC.debugElement.componentViewChildren[0].getLocal("consuming");
+ .then((fixture) => {
+ var comp = fixture.debugElement.componentViewChildren[0].getLocal("consuming");
expect(comp.injectable).toBeAnInstanceOf(InjectableService);
async.done();
@@ -1123,8 +1125,8 @@ export function main() {
directives: [DirectiveConsumingInjectable]
}))
.createAsync(DirectiveProvidingInjectableInView)
- .then((rootTC) => {
- var comp = rootTC.debugElement.componentViewChildren[0].getLocal("consuming");
+ .then((fixture) => {
+ var comp = fixture.debugElement.componentViewChildren[0].getLocal("consuming");
expect(comp.injectable).toBeAnInstanceOf(InjectableService);
async.done();
@@ -1153,8 +1155,8 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var comp = rootTC.debugElement.componentViewChildren[0].getLocal("dir");
+ .then((fixture) => {
+ var comp = fixture.debugElement.componentViewChildren[0].getLocal("dir");
expect(comp.directive.injectable).toBeAnInstanceOf(InjectableService);
async.done();
@@ -1179,8 +1181,8 @@ export function main() {
]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var gpComp = rootTC.debugElement.componentViewChildren[0];
+ .then((fixture) => {
+ var gpComp = fixture.debugElement.componentViewChildren[0];
var parentComp = gpComp.children[0];
var childComp = parentComp.children[0];
@@ -1211,12 +1213,13 @@ export function main() {
[DirectiveConsumingInjectable, ComponentProvidingLoggingInjectable, NgIf]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- var providing = rootTC.debugElement.componentViewChildren[0].getLocal("providing");
+ .then((fixture) => {
+ var providing =
+ fixture.debugElement.componentViewChildren[0].getLocal("providing");
expect(providing.created).toBe(false);
- rootTC.debugElement.componentInstance.ctxBoolProp = true;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxBoolProp = true;
+ fixture.detectChanges();
expect(providing.created).toBe(true);
@@ -1234,8 +1237,8 @@ export function main() {
beforeinside after
`
}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(DOM.querySelectorAll(rootTC.debugElement.nativeElement, 'script').length)
+ .then((fixture) => {
+ expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'script').length)
.toEqual(0);
async.done();
});
@@ -1306,9 +1309,9 @@ export function main() {
tcb = tcb.overrideView(
MyComp, new ViewMetadata({template: ` `}));
- tcb.createAsync(MyComp).then(rootTC => {
+ tcb.createAsync(MyComp).then(fixture => {
try {
- rootTC.detectChanges();
+ fixture.detectChanges();
throw "Should throw";
} catch (e) {
var c = e.context;
@@ -1316,7 +1319,7 @@ export function main() {
expect(DOM.nodeName(c.componentElement).toUpperCase()).toEqual("DIV");
expect(c.injector).toBeAnInstanceOf(Injector);
expect(c.expression).toContain("one.two.three");
- expect(c.context).toBe(rootTC.debugElement.componentInstance);
+ expect(c.context).toBe(fixture.debugElement.componentInstance);
expect(c.locals["local"]).toBeDefined();
}
@@ -1329,9 +1332,9 @@ export function main() {
tcb = tcb.overrideView(MyComp, new ViewMetadata({template: `{{one.two.three}}`}));
- tcb.createAsync(MyComp).then(rootTC => {
+ tcb.createAsync(MyComp).then(fixture => {
try {
- rootTC.detectChanges();
+ fixture.detectChanges();
throw "Should throw";
} catch (e) {
var c = e.context;
@@ -1353,11 +1356,11 @@ export function main() {
directives: [DirectiveEmitingEvent, DirectiveListeningEvent]
}));
- var rootTC: RootTestComponent;
- tcb.createAsync(MyComp).then(root => { rootTC = root; });
+ var fixture: ComponentFixture;
+ tcb.createAsync(MyComp).then(root => { fixture = root; });
tick();
- var tc = rootTC.debugElement.componentViewChildren[0];
+ var tc = fixture.debugElement.componentViewChildren[0];
tc.inject(DirectiveEmitingEvent).fireEvent("boom");
try {
@@ -1370,7 +1373,7 @@ export function main() {
expect(DOM.nodeName(c.element).toUpperCase()).toEqual("SPAN");
expect(DOM.nodeName(c.componentElement).toUpperCase()).toEqual("DIV");
expect(c.injector).toBeAnInstanceOf(Injector);
- expect(c.context).toBe(rootTC.debugElement.componentInstance);
+ expect(c.context).toBe(fixture.debugElement.componentInstance);
expect(c.locals["local"]).toBeDefined();
}
})));
@@ -1402,8 +1405,8 @@ export function main() {
tcb.overrideView(MyComp, new ViewMetadata({template: '{{a.b}}'}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(() => rootTC.detectChanges())
+ .then((fixture) => {
+ expect(() => fixture.detectChanges())
.toThrowError(containsRegexp(`{{a.b}} in ${stringify(MyComp)}`));
async.done();
})}));
@@ -1416,8 +1419,8 @@ export function main() {
tcb.overrideView(MyComp, new ViewMetadata({template: '
'}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(() => rootTC.detectChanges())
+ .then((fixture) => {
+ expect(() => fixture.detectChanges())
.toThrowError(containsRegexp(`a.b in ${stringify(MyComp)}`));
async.done();
})}));
@@ -1432,8 +1435,8 @@ export function main() {
}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(() => rootTC.detectChanges())
+ .then((fixture) => {
+ expect(() => fixture.detectChanges())
.toThrowError(containsRegexp(`a.b in ${stringify(MyComp)}`));
async.done();
})}));
@@ -1446,8 +1449,8 @@ export function main() {
directives: [SimpleImperativeViewComponent]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- expect(rootTC.debugElement.nativeElement).toHaveText('hello imp view');
+ .then((fixture) => {
+ expect(fixture.debugElement.nativeElement).toHaveText('hello imp view');
async.done();
});
}));
@@ -1460,18 +1463,18 @@ export function main() {
directives: [SomeImperativeViewport]
}))
.createAsync(MyComp)
- .then((rootTC: RootTestComponent) => {
- rootTC.detectChanges();
+ .then((fixture: ComponentFixture) => {
+ fixture.detectChanges();
expect(anchorElement).toHaveText('');
- rootTC.debugElement.componentInstance.ctxBoolProp = true;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxBoolProp = true;
+ fixture.detectChanges();
expect(anchorElement).toHaveText('hello');
- rootTC.debugElement.componentInstance.ctxBoolProp = false;
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ fixture.debugElement.componentInstance.ctxBoolProp = false;
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
@@ -1513,11 +1516,11 @@ export function main() {
directives: [DirectiveWithTitle]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = "TITLE";
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = "TITLE";
+ fixture.detectChanges();
- var el = DOM.querySelector(rootTC.debugElement.nativeElement, "span");
+ var el = DOM.querySelector(fixture.debugElement.nativeElement, "span");
expect(isBlank(el.title) || el.title == '').toBeTruthy();
async.done();
@@ -1532,11 +1535,11 @@ export function main() {
directives: [DirectiveWithTitleAndHostProperty]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = "TITLE";
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = "TITLE";
+ fixture.detectChanges();
- var el = DOM.querySelector(rootTC.debugElement.nativeElement, "span");
+ var el = DOM.querySelector(fixture.debugElement.nativeElement, "span");
expect(el.title).toEqual("TITLE");
async.done();
@@ -1559,11 +1562,11 @@ export function main() {
tcb.overrideView(MyComp, new ViewMetadata({template: tpl, directives: [MyDir]}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = 'hello';
- rootTC.detectChanges();
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = 'hello';
+ fixture.detectChanges();
- expect(DOM.getInnerHTML(rootTC.debugElement.nativeElement))
+ expect(DOM.getInnerHTML(fixture.debugElement.nativeElement))
.toContain('ng-reflect-dir-prop="hello"');
async.done();
});
@@ -1577,11 +1580,11 @@ export function main() {
tcb.overrideView(MyComp,
new ViewMetadata({template: `{{ctxProp}}
`}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.debugElement.componentInstance.ctxProp = 'Hello World!';
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.ctxProp = 'Hello World!';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('Hello World!');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('Hello World!');
async.done();
});
});
@@ -1654,9 +1657,9 @@ export function main() {
directives: [DirectiveWithPropDecorators]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
- var dir = rootTC.debugElement.componentViewChildren[0].inject(
+ .then((fixture) => {
+ fixture.detectChanges();
+ var dir = fixture.debugElement.componentViewChildren[0].inject(
DirectiveWithPropDecorators);
expect(dir.dirProp).toEqual("aaa");
async.done();
@@ -1670,15 +1673,15 @@ export function main() {
directives: [DirectiveWithPropDecorators]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
- var dir = rootTC.debugElement.componentViewChildren[0].inject(
+ .then((fixture) => {
+ fixture.detectChanges();
+ var dir = fixture.debugElement.componentViewChildren[0].inject(
DirectiveWithPropDecorators);
dir.myAttr = "aaa";
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(
- DOM.getOuterHTML(rootTC.debugElement.componentViewChildren[0].nativeElement))
+ DOM.getOuterHTML(fixture.debugElement.componentViewChildren[0].nativeElement))
.toContain('my-attr="aaa"');
async.done();
});
@@ -1693,17 +1696,17 @@ export function main() {
directives: [DirectiveWithPropDecorators]
}));
- var rootTC: RootTestComponent;
- tcb.createAsync(MyComp).then(root => { rootTC = root; });
+ var fixture: ComponentFixture;
+ tcb.createAsync(MyComp).then(root => { fixture = root; });
tick();
- var emitter = rootTC.debugElement.componentViewChildren[0].inject(
+ var emitter = fixture.debugElement.componentViewChildren[0].inject(
DirectiveWithPropDecorators);
emitter.fireEvent('fired !');
tick();
- expect(rootTC.debugElement.componentInstance.ctxProp).toEqual("called");
+ expect(fixture.debugElement.componentInstance.ctxProp).toEqual("called");
})));
@@ -1715,11 +1718,11 @@ export function main() {
directives: [DirectiveWithPropDecorators]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
- var dir = rootTC.debugElement.componentViewChildren[0].inject(
+ .then((fixture) => {
+ fixture.detectChanges();
+ var dir = fixture.debugElement.componentViewChildren[0].inject(
DirectiveWithPropDecorators);
- var native = rootTC.debugElement.componentViewChildren[0].nativeElement;
+ var native = fixture.debugElement.componentViewChildren[0].nativeElement;
DOM.dispatchEvent(native, DOM.createMouseEvent('click'));
expect(dir.target).toBe(native);
@@ -1735,9 +1738,9 @@ export function main() {
directives: [ComponentWithTemplate]
}))
.createAsync(MyComp)
- .then((rootTC) => {
- rootTC.detectChanges();
- var native = rootTC.debugElement.componentViewChildren[0].nativeElement;
+ .then((fixture) => {
+ fixture.detectChanges();
+ var native = fixture.debugElement.componentViewChildren[0].nativeElement;
expect(native).toHaveText("No View Decorator: 123");
async.done();
});
@@ -1752,8 +1755,8 @@ export function main() {
tcb.overrideView(MyComp,
new ViewMetadata({template: ' '}))
.createAsync(MyComp)
- .then((rootTC) => {
- var el = rootTC.debugElement.nativeElement;
+ .then((fixture) => {
+ var el = fixture.debugElement.nativeElement;
var svg = DOM.childNodes(el)[0];
var use = DOM.childNodes(svg)[0];
expect(DOM.getProperty(svg, 'namespaceURI'))
diff --git a/modules/angular2/test/core/linker/projection_integration_spec.ts b/modules/angular2/test/core/linker/projection_integration_spec.ts
index cb7a3aa8d5..48e5ca5cea 100644
--- a/modules/angular2/test/core/linker/projection_integration_spec.ts
+++ b/modules/angular2/test/core/linker/projection_integration_spec.ts
@@ -15,7 +15,7 @@ import {
containsRegexp,
stringifyElement,
TestComponentBuilder,
- RootTestComponent,
+ ComponentFixture,
fakeAsync,
tick
} from 'angular2/testing_internal';
@@ -293,7 +293,7 @@ export function main() {
{template: ' ', directives: [Simple]}))
.overrideTemplate(Simple, 'P,
{{stringProp}}')
.createAsync(MainComp)
- .then((main: RootTestComponent) => {
+ .then((main: ComponentFixture) => {
main.detectChanges();
@@ -314,7 +314,7 @@ export function main() {
{template: ' ', directives: [Simple]}))
.overrideTemplate(Simple, 'P,
{{stringProp}}')
.createAsync(MainComp)
- .then((main: RootTestComponent) => {
+ .then((main: ComponentFixture) => {
main.detectChanges();
expect(main.debugElement.nativeElement).toHaveText('P,text');
diff --git a/modules/angular2/test/core/linker/query_integration_spec.ts b/modules/angular2/test/core/linker/query_integration_spec.ts
index 2d768ccb69..1cc4e27451 100644
--- a/modules/angular2/test/core/linker/query_integration_spec.ts
+++ b/modules/angular2/test/core/linker/query_integration_spec.ts
@@ -211,10 +211,10 @@ export function main() {
tcb.overrideTemplate(MyComp, template)
.createAsync(MyComp)
- .then((rtc) => {
- rtc.debugElement.componentInstance.shouldShow = true;
- rtc.detectChanges();
- rtc.destroy();
+ .then((fixture) => {
+ fixture.debugElement.componentInstance.shouldShow = true;
+ fixture.detectChanges();
+ fixture.destroy();
async.done();
});
diff --git a/modules/angular2/test/core/pipes/json_pipe_spec.ts b/modules/angular2/test/core/pipes/json_pipe_spec.ts
index 0ba44ec828..4ae8ea5280 100644
--- a/modules/angular2/test/core/pipes/json_pipe_spec.ts
+++ b/modules/angular2/test/core/pipes/json_pipe_spec.ts
@@ -55,15 +55,15 @@ export function main() {
describe('integration', () => {
it('should work with mutable objects',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.createAsync(TestComp).then((rootTC) => {
+ tcb.createAsync(TestComp).then((fixture) => {
let mutable: number[] = [1];
- rootTC.debugElement.componentInstance.data = mutable;
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText("[\n 1\n]");
+ fixture.debugElement.componentInstance.data = mutable;
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText("[\n 1\n]");
mutable.push(2);
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText("[\n 1,\n 2\n]");
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText("[\n 1,\n 2\n]");
async.done();
});
diff --git a/modules/angular2/test/core/pipes/slice_pipe_spec.ts b/modules/angular2/test/core/pipes/slice_pipe_spec.ts
index 3a6d44cdf9..9a6d2886b8 100644
--- a/modules/angular2/test/core/pipes/slice_pipe_spec.ts
+++ b/modules/angular2/test/core/pipes/slice_pipe_spec.ts
@@ -91,15 +91,15 @@ export function main() {
describe('integration', () => {
it('should work with mutable arrays',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.createAsync(TestComp).then((rootTC) => {
+ tcb.createAsync(TestComp).then((fixture) => {
let mutable: number[] = [1, 2];
- rootTC.debugElement.componentInstance.data = mutable;
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('2');
+ fixture.debugElement.componentInstance.data = mutable;
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('2');
mutable.push(3);
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('2,3');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('2,3');
async.done();
});
diff --git a/modules/angular2/test/router/integration/lifecycle_hook_spec.ts b/modules/angular2/test/router/integration/lifecycle_hook_spec.ts
index 7892164e65..747cc7a2a8 100644
--- a/modules/angular2/test/router/integration/lifecycle_hook_spec.ts
+++ b/modules/angular2/test/router/integration/lifecycle_hook_spec.ts
@@ -1,5 +1,5 @@
import {
- RootTestComponent,
+ ComponentFixture,
AsyncTestCompleter,
TestComponentBuilder,
beforeEach,
@@ -58,7 +58,7 @@ export function main() {
describe('Router lifecycle hooks', () => {
var tcb: TestComponentBuilder;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
var rtr;
beforeEachBindings(() => [
@@ -87,7 +87,7 @@ export function main() {
directives: [RouterOutlet, RouterLink]
}))
.createAsync(MyComp)
- .then((tc) => { rootTC = tc; });
+ .then((tc) => { fixture = tc; });
}
it('should call the onActivate hook', inject([AsyncTestCompleter], (async) => {
@@ -95,8 +95,8 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
.then((_) => rtr.navigateByUrl('/on-activate'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('activate cmp');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('activate cmp');
expect(log).toEqual(['activate: null -> /on-activate']);
async.done();
});
@@ -114,8 +114,8 @@ export function main() {
});
rtr.navigateByUrl('/parent-activate/child-activate')
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('parent {activate cmp}');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('parent {activate cmp}');
expect(log).toEqual([
'parent activate: null -> /parent-activate',
'activate: null -> /child-activate'
@@ -131,8 +131,8 @@ export function main() {
.then((_) => rtr.navigateByUrl('/on-deactivate'))
.then((_) => rtr.navigateByUrl('/a'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('A');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('A');
expect(log).toEqual(['deactivate: /on-deactivate -> /a']);
async.done();
});
@@ -147,13 +147,13 @@ export function main() {
ObservableWrapper.subscribe(eventBus, (ev) => {
if (ev.startsWith('deactivate')) {
completer.resolve(true);
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('parent {deactivate cmp}');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('parent {deactivate cmp}');
}
});
rtr.navigateByUrl('/a').then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('A');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('A');
expect(log).toEqual([
'deactivate: /child-deactivate -> null',
'parent deactivate: /parent-deactivate -> /a'
@@ -169,16 +169,16 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
.then((_) => rtr.navigateByUrl('/on-reuse/1/a'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(log).toEqual([]);
- expect(rootTC.debugElement.nativeElement).toHaveText('reuse {A}');
+ expect(fixture.debugElement.nativeElement).toHaveText('reuse {A}');
expect(cmpInstanceCount).toBe(1);
})
.then((_) => rtr.navigateByUrl('/on-reuse/2/b'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(log).toEqual(['reuse: /on-reuse/1 -> /on-reuse/2']);
- expect(rootTC.debugElement.nativeElement).toHaveText('reuse {B}');
+ expect(fixture.debugElement.nativeElement).toHaveText('reuse {B}');
expect(cmpInstanceCount).toBe(1);
async.done();
});
@@ -191,16 +191,16 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
.then((_) => rtr.navigateByUrl('/never-reuse/1/a'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(log).toEqual([]);
- expect(rootTC.debugElement.nativeElement).toHaveText('reuse {A}');
+ expect(fixture.debugElement.nativeElement).toHaveText('reuse {A}');
expect(cmpInstanceCount).toBe(1);
})
.then((_) => rtr.navigateByUrl('/never-reuse/2/b'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(log).toEqual([]);
- expect(rootTC.debugElement.nativeElement).toHaveText('reuse {B}');
+ expect(fixture.debugElement.nativeElement).toHaveText('reuse {B}');
expect(cmpInstanceCount).toBe(2);
async.done();
});
@@ -218,8 +218,8 @@ export function main() {
});
rtr.navigateByUrl('/can-activate/a')
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('canActivate {A}');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('canActivate {A}');
expect(log).toEqual(['canActivate: null -> /can-activate']);
async.done();
});
@@ -238,8 +238,8 @@ export function main() {
});
rtr.navigateByUrl('/can-activate/a')
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('');
expect(log).toEqual(['canActivate: null -> /can-activate']);
async.done();
});
@@ -252,8 +252,8 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
.then((_) => rtr.navigateByUrl('/can-deactivate/a'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('canDeactivate {A}');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('canDeactivate {A}');
expect(log).toEqual([]);
ObservableWrapper.subscribe(eventBus, (ev) => {
@@ -263,8 +263,8 @@ export function main() {
});
rtr.navigateByUrl('/a').then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('A');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('A');
expect(log).toEqual(['canDeactivate: /can-deactivate -> /a']);
async.done();
});
@@ -277,8 +277,8 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
.then((_) => rtr.navigateByUrl('/can-deactivate/a'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('canDeactivate {A}');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('canDeactivate {A}');
expect(log).toEqual([]);
ObservableWrapper.subscribe(eventBus, (ev) => {
@@ -288,8 +288,8 @@ export function main() {
});
rtr.navigateByUrl('/a').then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('canDeactivate {A}');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('canDeactivate {A}');
expect(log).toEqual(['canDeactivate: /can-deactivate -> /a']);
async.done();
});
diff --git a/modules/angular2/test/router/integration/navigation_spec.ts b/modules/angular2/test/router/integration/navigation_spec.ts
index 0b741224b2..fee5445665 100644
--- a/modules/angular2/test/router/integration/navigation_spec.ts
+++ b/modules/angular2/test/router/integration/navigation_spec.ts
@@ -1,5 +1,5 @@
import {
- RootTestComponent,
+ ComponentFixture,
AsyncTestCompleter,
TestComponentBuilder,
beforeEach,
@@ -41,7 +41,7 @@ export function main() {
describe('navigation', () => {
var tcb: TestComponentBuilder;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
var rtr;
beforeEachBindings(() => [
@@ -70,7 +70,7 @@ export function main() {
directives: [RouterOutlet, RouterLink]
}))
.createAsync(MyComp)
- .then((tc) => { rootTC = tc; });
+ .then((tc) => { fixture = tc; });
}
it('should work in a simple case', inject([AsyncTestCompleter], (async) => {
@@ -78,8 +78,8 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))
.then((_) => rtr.navigateByUrl('/test'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
async.done();
});
}));
@@ -91,13 +91,13 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/user/:name', component: UserCmp})]))
.then((_) => rtr.navigateByUrl('/user/brian'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello brian');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('hello brian');
})
.then((_) => rtr.navigateByUrl('/user/igor'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello igor');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('hello igor');
async.done();
});
}));
@@ -108,8 +108,8 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
.then((_) => rtr.navigateByUrl('/a/b'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('outer { inner { hello } }');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('outer { inner { hello } }');
async.done();
});
}));
@@ -120,8 +120,8 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
.then((_) => rtr.navigateByUrl('/a'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('outer { inner { hello } }');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('outer { inner { hello } }');
async.done();
});
}));
@@ -132,8 +132,8 @@ export function main() {
.then((_) => rtr.config([new AsyncRoute({path: '/a/...', loader: parentLoader})]))
.then((_) => rtr.navigateByUrl('/a/b'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('outer { inner { hello } }');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('outer { inner { hello } }');
async.done();
});
}));
@@ -148,8 +148,8 @@ export function main() {
]))
.then((_) => rtr.navigateByUrl('/original'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('hello');
expect(location.urlChanges).toEqual(['/redirected']);
async.done();
});
@@ -161,15 +161,15 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
.then((_) => rtr.navigateByUrl('/team/angular/user/rado'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmpInstanceCount).toBe(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('team angular { hello rado }');
+ expect(fixture.debugElement.nativeElement).toHaveText('team angular { hello rado }');
})
.then((_) => rtr.navigateByUrl('/team/angular/user/victor'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmpInstanceCount).toBe(1);
- expect(rootTC.debugElement.nativeElement)
+ expect(fixture.debugElement.nativeElement)
.toHaveText('team angular { hello victor }');
async.done();
});
@@ -181,17 +181,17 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
.then((_) => rtr.navigateByUrl('/team/angular/user/rado'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmpInstanceCount).toBe(1);
expect(childCmpInstanceCount).toBe(1);
- expect(rootTC.debugElement.nativeElement).toHaveText('team angular { hello rado }');
+ expect(fixture.debugElement.nativeElement).toHaveText('team angular { hello rado }');
})
.then((_) => rtr.navigateByUrl('/team/dart/user/rado'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(cmpInstanceCount).toBe(2);
expect(childCmpInstanceCount).toBe(2);
- expect(rootTC.debugElement.nativeElement).toHaveText('team dart { hello rado }');
+ expect(fixture.debugElement.nativeElement).toHaveText('team dart { hello rado }');
async.done();
});
}));
@@ -203,8 +203,8 @@ export function main() {
]))
.then((_) => rtr.navigateByUrl('/route-data'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('true');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('true');
async.done();
});
}));
@@ -218,8 +218,8 @@ export function main() {
]))
.then((_) => rtr.navigateByUrl('/route-data'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('true');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('true');
async.done();
});
}));
@@ -231,8 +231,8 @@ export function main() {
[new Route({path: '/route-data-default', component: RouteDataCmp})]))
.then((_) => rtr.navigateByUrl('/route-data-default'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('');
async.done();
});
}));
@@ -243,8 +243,9 @@ export function main() {
.then((_) => rtr.config([new Route({path: '/...', component: AuxCmp})]))
.then((_) => rtr.navigateByUrl('/hello(modal)'))
.then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('main {hello} | aux {modal}');
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement)
+ .toHaveText('main {hello} | aux {modal}');
async.done();
});
}));
diff --git a/modules/angular2/test/router/integration/router_integration_spec.ts b/modules/angular2/test/router/integration/router_integration_spec.ts
index bf63445bfd..47ea76408d 100644
--- a/modules/angular2/test/router/integration/router_integration_spec.ts
+++ b/modules/angular2/test/router/integration/router_integration_spec.ts
@@ -79,10 +79,10 @@ export function main() {
it('should rethrow exceptions from component constructors',
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
- tcb.createAsync(AppCmp).then((rootTC) => {
- var router = rootTC.debugElement.componentInstance.router;
+ tcb.createAsync(AppCmp).then((fixture) => {
+ var router = fixture.debugElement.componentInstance.router;
PromiseWrapper.catchError(router.navigateByUrl('/cause-error'), (error) => {
- expect(rootTC.debugElement.nativeElement).toHaveText('outer { oh no }');
+ expect(fixture.debugElement.nativeElement).toHaveText('outer { oh no }');
expect(error).toContainError('oops!');
async.done();
});
@@ -98,8 +98,8 @@ export function main() {
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
tcb.createAsync(HierarchyAppCmp)
- .then((rootTC) => {
- var router = rootTC.debugElement.componentInstance.router;
+ .then((fixture) => {
+ var router = fixture.debugElement.componentInstance.router;
var position = 0;
var flipped = false;
var history =
@@ -110,8 +110,8 @@ export function main() {
]
router.subscribe((_) => {
- var location = rootTC.debugElement.componentInstance.location;
- var element = rootTC.debugElement.nativeElement;
+ var location = fixture.debugElement.componentInstance.location;
+ var element = fixture.debugElement.nativeElement;
var path = location.path();
var entry = history[position];
@@ -150,12 +150,12 @@ export function main() {
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
tcb.createAsync(HierarchyAppCmp)
- .then((rootTC) => {
- var router = rootTC.debugElement.componentInstance.router;
+ .then((fixture) => {
+ var router = fixture.debugElement.componentInstance.router;
router.subscribe((_) => {
- expect(rootTC.debugElement.nativeElement)
+ expect(fixture.debugElement.nativeElement)
.toHaveText('root { parent { hello } }');
- expect(rootTC.debugElement.componentInstance.location.path())
+ expect(fixture.debugElement.componentInstance.location.path())
.toEqual('/parent/child');
async.done();
});
@@ -171,12 +171,12 @@ export function main() {
(async, tcb: TestComponentBuilder) => {
tcb.createAsync(HierarchyAppCmp)
- .then((rootTC) => {
- var router = rootTC.debugElement.componentInstance.router;
+ .then((fixture) => {
+ var router = fixture.debugElement.componentInstance.router;
router.subscribe((_) => {
- expect(rootTC.debugElement.nativeElement)
+ expect(fixture.debugElement.nativeElement)
.toHaveText('root { parent { hello } }');
- expect(rootTC.debugElement.componentInstance.location.path())
+ expect(fixture.debugElement.componentInstance.location.path())
.toEqual('/my/app/parent/child');
async.done();
});
@@ -194,12 +194,12 @@ export function main() {
it('should recognize and return querystring params with the injected RouteParams',
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
tcb.createAsync(QueryStringAppCmp)
- .then((rootTC) => {
- var router = rootTC.debugElement.componentInstance.router;
+ .then((fixture) => {
+ var router = fixture.debugElement.componentInstance.router;
router.subscribe((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
- expect(rootTC.debugElement.nativeElement)
+ expect(fixture.debugElement.nativeElement)
.toHaveText('qParam = search-for-something');
/*
expect(applicationRef.hostComponent.location.path())
@@ -207,7 +207,7 @@ export function main() {
async.done();
});
router.navigateByUrl('/qs?q=search-for-something');
- rootTC.detectChanges();
+ fixture.detectChanges();
});
}));
});
diff --git a/modules/angular2/test/router/integration/router_link_spec.ts b/modules/angular2/test/router/integration/router_link_spec.ts
index 22db57c36c..d7dcf27c63 100644
--- a/modules/angular2/test/router/integration/router_link_spec.ts
+++ b/modules/angular2/test/router/integration/router_link_spec.ts
@@ -1,5 +1,5 @@
import {
- RootTestComponent,
+ ComponentFixture,
AsyncTestCompleter,
beforeEach,
ddescribe,
@@ -43,7 +43,7 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';
export function main() {
describe('router-link directive', function() {
var tcb: TestComponentBuilder;
- var rootTC: RootTestComponent;
+ var fixture: ComponentFixture;
var router, location;
beforeEachBindings(() => [
@@ -70,7 +70,7 @@ export function main() {
directives: [RouterOutlet, RouterLink]
}))
.createAsync(MyComp)
- .then((tc) => { rootTC = tc; });
+ .then((tc) => { fixture = tc; });
}
it('should generate absolute hrefs that include the base href',
@@ -81,8 +81,8 @@ export function main() {
[new Route({path: '/user', component: UserCmp, name: 'User'})]))
.then((_) => router.navigateByUrl('/a/b'))
.then((_) => {
- rootTC.detectChanges();
- expect(getHref(rootTC)).toEqual('/my/base/user');
+ fixture.detectChanges();
+ expect(getHref(fixture)).toEqual('/my/base/user');
async.done();
});
}));
@@ -94,8 +94,8 @@ export function main() {
[new Route({path: '/user', component: UserCmp, name: 'User'})]))
.then((_) => router.navigateByUrl('/a/b'))
.then((_) => {
- rootTC.detectChanges();
- expect(getHref(rootTC)).toEqual('/user');
+ fixture.detectChanges();
+ expect(getHref(fixture)).toEqual('/user');
async.done();
});
}));
@@ -107,10 +107,10 @@ export function main() {
[new Route({path: '/user/:name', component: UserCmp, name: 'User'})]))
.then((_) => router.navigateByUrl('/a/b'))
.then((_) => {
- rootTC.debugElement.componentInstance.name = 'brian';
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('brian');
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[0].nativeElement,
+ fixture.debugElement.componentInstance.name = 'brian';
+ fixture.detectChanges();
+ expect(fixture.debugElement.nativeElement).toHaveText('brian');
+ expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[0].nativeElement,
'href'))
.toEqual('/user/brian');
async.done();
@@ -125,8 +125,8 @@ export function main() {
[new Route({path: '/page/:number', component: SiblingPageCmp, name: 'Page'})]))
.then((_) => router.navigateByUrl('/page/1'))
.then((_) => {
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[1]
+ fixture.detectChanges();
+ expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[1]
.componentViewChildren[0]
.nativeElement,
'href'))
@@ -144,8 +144,8 @@ export function main() {
]))
.then((_) => router.navigateByUrl('/page/1'))
.then((_) => {
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[1]
+ fixture.detectChanges();
+ expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[1]
.componentViewChildren[0]
.nativeElement,
'href'))
@@ -162,8 +162,8 @@ export function main() {
]))
.then((_) => router.navigateByUrl('/book/1984/page/1'))
.then((_) => {
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[1]
+ fixture.detectChanges();
+ expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[1]
.componentViewChildren[0]
.nativeElement,
'href'))
@@ -181,7 +181,7 @@ export function main() {
.then((_) => router.navigateByUrl('/book/1984/page/1'))
.then((_) => {
var link = ListWrapper.toJSON(['Book', {number: 100}]);
- expect(() => rootTC.detectChanges())
+ expect(() => fixture.detectChanges())
.toThrowErrorWith(
`Link "${link}" is ambiguous, use "./" or "../" to disambiguate.`);
async.done();
@@ -200,8 +200,8 @@ export function main() {
]))
.then((_) => router.navigate(['/ChildWithGrandchild']))
.then((_) => {
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[1]
+ fixture.detectChanges();
+ expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[1]
.componentViewChildren[0]
.nativeElement,
'href'))
@@ -217,14 +217,14 @@ export function main() {
[new Route({path: '/book/:title/...', component: BookCmp, name: 'Book'})]))
.then((_) => router.navigateByUrl('/book/1984/page/1'))
.then((_) => {
- rootTC.detectChanges();
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[1]
+ fixture.detectChanges();
+ expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[1]
.componentViewChildren[0]
.nativeElement,
'href'))
.toEqual('/book/1984/page/100');
- expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[1]
+ expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[1]
.componentViewChildren[2]
.componentViewChildren[0]
.nativeElement,
@@ -245,9 +245,9 @@ export function main() {
Better Child
`))
.then((_) => {
- var element = rootTC.debugElement.nativeElement;
+ var element = fixture.debugElement.nativeElement;
- rootTC.detectChanges();
+ fixture.detectChanges();
var link1 = DOM.querySelector(element, '.child-link');
var link2 = DOM.querySelector(element, '.better-child-link');
@@ -256,7 +256,7 @@ export function main() {
expect(link2).not.toHaveCssClass('router-link-active');
router.subscribe((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(link1).not.toHaveCssClass('router-link-active');
expect(link2).toHaveCssClass('router-link-active');
@@ -280,9 +280,9 @@ export function main() {
Better Child
`))
.then((_) => {
- var element = rootTC.debugElement.nativeElement;
+ var element = fixture.debugElement.nativeElement;
- rootTC.detectChanges();
+ fixture.detectChanges();
var link1 = DOM.querySelector(element, '.child-link');
var link2 = DOM.querySelector(element, '.child-with-grandchild-link');
@@ -291,7 +291,7 @@ export function main() {
expect(link2).not.toHaveCssClass('router-link-active');
router.subscribe((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
expect(link1).not.toHaveCssClass('router-link-active');
expect(link2).toHaveCssClass('router-link-active');
@@ -312,7 +312,7 @@ export function main() {
describe('when clicked', () => {
var clickOnElement = function(view) {
- var anchorEl = rootTC.debugElement.componentViewChildren[0].nativeElement;
+ var anchorEl = fixture.debugElement.componentViewChildren[0].nativeElement;
var dispatchedEvent = DOM.createMouseEvent('click');
DOM.dispatchEvent(anchorEl, dispatchedEvent);
return dispatchedEvent;
@@ -324,9 +324,9 @@ export function main() {
[new Route({path: '/user', component: UserCmp, name: 'User'})]))
.then((_) => router.navigateByUrl('/a/b'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
- var dispatchedEvent = clickOnElement(rootTC);
+ var dispatchedEvent = clickOnElement(fixture);
expect(DOM.isPrevented(dispatchedEvent)).toBe(true);
// router navigation is async.
@@ -345,9 +345,9 @@ export function main() {
[new Route({path: '/user', component: UserCmp, name: 'User'})]))
.then((_) => router.navigateByUrl('/a/b'))
.then((_) => {
- rootTC.detectChanges();
+ fixture.detectChanges();
- var dispatchedEvent = clickOnElement(rootTC);
+ var dispatchedEvent = clickOnElement(fixture);
expect(DOM.isPrevented(dispatchedEvent)).toBe(true);
// router navigation is async.
@@ -361,7 +361,7 @@ export function main() {
});
}
-function getHref(tc: RootTestComponent) {
+function getHref(tc: ComponentFixture) {
return DOM.getAttribute(tc.debugElement.componentViewChildren[0].nativeElement, 'href');
}
diff --git a/modules/angular2/test/testing/test_component_builder_spec.ts b/modules/angular2/test/testing/test_component_builder_spec.ts
index 144bb60505..5276983b97 100644
--- a/modules/angular2/test/testing/test_component_builder_spec.ts
+++ b/modules/angular2/test/testing/test_component_builder_spec.ts
@@ -95,10 +95,10 @@ export function main() {
it('should instantiate a component with valid DOM',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.createAsync(ChildComp).then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ tcb.createAsync(ChildComp).then((componentFixture) => {
+ componentFixture.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Original Child');
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Original Child');
async.done();
});
}));
@@ -106,13 +106,13 @@ export function main() {
it('should allow changing members of the component',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.createAsync(MyIfComp).then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('MyIf()');
+ tcb.createAsync(MyIfComp).then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('MyIf()');
- rootTestComponent.debugElement.componentInstance.showMore = true;
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('MyIf(More)');
+ componentFixture.debugElement.componentInstance.showMore = true;
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('MyIf(More)');
async.done();
});
@@ -123,9 +123,9 @@ export function main() {
tcb.overrideTemplate(MockChildComp, 'Mock ')
.createAsync(MockChildComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Mock');
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Mock');
async.done();
});
@@ -137,9 +137,9 @@ export function main() {
tcb.overrideView(ChildComp,
new ViewMetadata({template: 'Modified {{childBinding}} '}))
.createAsync(ChildComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Modified Child');
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Modified Child');
async.done();
});
@@ -150,9 +150,9 @@ export function main() {
tcb.overrideDirective(ParentComp, ChildComp, MockChildComp)
.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Parent(Mock)');
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Parent(Mock)');
async.done();
});
@@ -165,9 +165,9 @@ export function main() {
tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
.overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp)
.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement)
.toHaveText('Parent(Original Child(ChildChild Mock))');
async.done();
@@ -180,9 +180,9 @@ export function main() {
tcb.overrideProviders(TestBindingsComp,
[provide(FancyService, {useClass: MockFancyService})])
.createAsync(TestBindingsComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement)
.toHaveText('injected value: mocked out value');
async.done();
});
@@ -195,9 +195,9 @@ export function main() {
tcb.overrideViewProviders(TestViewBindingsComp,
[provide(FancyService, {useClass: MockFancyService})])
.createAsync(TestViewBindingsComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement)
.toHaveText('injected value: mocked out value');
async.done();
});
diff --git a/modules/angular2/test/testing/testing_public_spec.ts b/modules/angular2/test/testing/testing_public_spec.ts
index 4feb459bd8..e35e5af0a3 100644
--- a/modules/angular2/test/testing/testing_public_spec.ts
+++ b/modules/angular2/test/testing/testing_public_spec.ts
@@ -243,23 +243,23 @@ export function main() {
it('should instantiate a component with valid DOM',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
- return tcb.createAsync(ChildComp).then((rootTestComponent) => {
- rootTestComponent.detectChanges();
+ return tcb.createAsync(ChildComp).then((componentFixture) => {
+ componentFixture.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Original Child');
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Original Child');
});
}));
it('should allow changing members of the component',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
- return tcb.createAsync(MyIfComp).then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('MyIf()');
+ return tcb.createAsync(MyIfComp).then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('MyIf()');
- rootTestComponent.debugElement.componentInstance.showMore = true;
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('MyIf(More)');
+ componentFixture.debugElement.componentInstance.showMore = true;
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('MyIf(More)');
});
}));
@@ -268,9 +268,9 @@ export function main() {
return tcb.overrideTemplate(MockChildComp, 'Mock ')
.createAsync(MockChildComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Mock');
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Mock');
});
}));
@@ -282,9 +282,9 @@ export function main() {
ChildComp,
new ViewMetadata({template: 'Modified {{childBinding}} '}))
.createAsync(ChildComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Modified Child');
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Modified Child');
});
}));
@@ -294,9 +294,9 @@ export function main() {
return tcb.overrideDirective(ParentComp, ChildComp, MockChildComp)
.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement).toHaveText('Parent(Mock)');
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement).toHaveText('Parent(Mock)');
});
}));
@@ -308,9 +308,9 @@ export function main() {
return tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
.overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp)
.createAsync(ParentComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement)
.toHaveText('Parent(Original Child(ChildChild Mock))');
});
@@ -322,9 +322,9 @@ export function main() {
return tcb.overrideProviders(TestProvidersComp,
[bind(FancyService).toClass(MockFancyService)])
.createAsync(TestProvidersComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement)
.toHaveText('injected value: mocked out value');
});
}));
@@ -336,9 +336,9 @@ export function main() {
return tcb.overrideViewProviders(TestViewProvidersComp,
[bind(FancyService).toClass(MockFancyService)])
.createAsync(TestViewProvidersComp)
- .then((rootTestComponent) => {
- rootTestComponent.detectChanges();
- expect(rootTestComponent.debugElement.nativeElement)
+ .then((componentFixture) => {
+ componentFixture.detectChanges();
+ expect(componentFixture.debugElement.nativeElement)
.toHaveText('injected value: mocked out value');
});
}));
diff --git a/modules/angular2/test/web_workers/worker/renderer_integration_spec.ts b/modules/angular2/test/web_workers/worker/renderer_integration_spec.ts
index 087d9be096..9beff59314 100644
--- a/modules/angular2/test/web_workers/worker/renderer_integration_spec.ts
+++ b/modules/angular2/test/web_workers/worker/renderer_integration_spec.ts
@@ -138,12 +138,12 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({template: '{{ctxProp}}
'}))
.createAsync(MyComp)
- .then((rootTC) => {
- var renderEl = getRenderElement(rootTC.debugElement.elementRef);
+ .then((fixture) => {
+ var renderEl = getRenderElement(fixture.debugElement.elementRef);
expect(renderEl).toHaveText('');
- rootTC.debugElement.componentInstance.ctxProp = 'Hello World!';
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxProp = 'Hello World!';
+ fixture.detectChanges();
expect(renderEl).toHaveText('Hello World!');
async.done();
@@ -156,7 +156,7 @@ export function main() {
tcb.overrideView(MyComp, new ViewMetadata(
{template: ' '}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
var checkSetters = (elr) => {
var el = getRenderElement(elr);
renderer.setElementProperty(elr, 'tabIndex', 1);
@@ -177,9 +177,9 @@ export function main() {
};
// root element
- checkSetters(rootTC.debugElement.elementRef);
+ checkSetters(fixture.debugElement.elementRef);
// nested elements
- checkSetters(rootTC.debugElement.componentViewChildren[0].elementRef);
+ checkSetters(fixture.debugElement.componentViewChildren[0].elementRef);
async.done();
});
@@ -192,17 +192,17 @@ export function main() {
directives: [NgIf]
}))
.createAsync(MyComp)
- .then((rootTC) => {
+ .then((fixture) => {
- var rootEl = getRenderElement(rootTC.debugElement.elementRef);
+ var rootEl = getRenderElement(fixture.debugElement.elementRef);
expect(rootEl).toHaveText('');
- rootTC.debugElement.componentInstance.ctxBoolProp = true;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxBoolProp = true;
+ fixture.detectChanges();
expect(rootEl).toHaveText('hello');
- rootTC.debugElement.componentInstance.ctxBoolProp = false;
- rootTC.detectChanges();
+ fixture.debugElement.componentInstance.ctxBoolProp = false;
+ fixture.detectChanges();
expect(rootEl).toHaveText('');
async.done();
@@ -216,8 +216,8 @@ export function main() {
tcb.overrideView(MyComp,
new ViewMetadata({template: ' '}))
.createAsync(MyComp)
- .then((rootTC) => {
- var elRef = rootTC.debugElement.componentViewChildren[0].elementRef;
+ .then((fixture) => {
+ var elRef = fixture.debugElement.componentViewChildren[0].elementRef;
renderer.invokeElementMethod(elRef, 'setAttribute', ['a', 'b']);
expect(DOM.getAttribute(getRenderElement(elRef), 'a')).toEqual('b');
diff --git a/modules/angular2/testing.ts b/modules/angular2/testing.ts
index 425ab6fe09..618fd03fe6 100644
--- a/modules/angular2/testing.ts
+++ b/modules/angular2/testing.ts
@@ -7,6 +7,6 @@
*
*/
export * from './src/testing/testing';
-export {RootTestComponent, TestComponentBuilder} from './src/testing/test_component_builder';
+export {ComponentFixture, TestComponentBuilder} from './src/testing/test_component_builder';
export * from './src/testing/test_injector';
export * from './src/testing/fake_async';
diff --git a/modules/angular2_material/test/button_spec.ts b/modules/angular2_material/test/button_spec.ts
index 7f2027d895..1ddbe04ff7 100644
--- a/modules/angular2_material/test/button_spec.ts
+++ b/modules/angular2_material/test/button_spec.ts
@@ -36,10 +36,9 @@ export function main() {
describe('button[md-button]', () => {
it('should handle a click on the button', inject([AsyncTestCompleter], (async) => {
- builder.createAsync(TestApp).then(rootTestComponent => {
- let testComponent = rootTestComponent.debugElement.componentInstance;
- let buttonDebugElement =
- getChildDebugElement(rootTestComponent.debugElement, 'button');
+ builder.createAsync(TestApp).then(fixture => {
+ let testComponent = fixture.debugElement.componentInstance;
+ let buttonDebugElement = getChildDebugElement(fixture.debugElement, 'button');
buttonDebugElement.nativeElement.click();
expect(testComponent.clickCount).toBe(1);
@@ -49,10 +48,9 @@ export function main() {
}), 1000);
it('should disable the button', inject([AsyncTestCompleter], (async) => {
- builder.createAsync(TestApp).then(rootTestComponent => {
- let testAppComponent = rootTestComponent.debugElement.componentInstance;
- let buttonDebugElement =
- getChildDebugElement(rootTestComponent.debugElement, 'button');
+ builder.createAsync(TestApp).then(fixture => {
+ let testAppComponent = fixture.debugElement.componentInstance;
+ let buttonDebugElement = getChildDebugElement(fixture.debugElement, 'button');
let buttonElement = buttonDebugElement.nativeElement;
// The button should initially be enabled.
@@ -60,7 +58,7 @@ export function main() {
// After the disabled binding has been changed.
testAppComponent.isDisabled = true;
- rootTestComponent.detectChanges();
+ fixture.detectChanges();
// The button should should now be disabled.
expect(buttonElement.disabled).toBe(true);
@@ -82,9 +80,9 @@ export function main() {
});
it('should remove disabled anchors from tab order', inject([AsyncTestCompleter], (async) => {
- builder.createAsync(TestApp).then(rootTestComponent => {
- let testAppComponent = rootTestComponent.debugElement.componentInstance;
- let anchorDebugElement = getChildDebugElement(rootTestComponent.debugElement, 'a');
+ builder.createAsync(TestApp).then(fixture => {
+ let testAppComponent = fixture.debugElement.componentInstance;
+ let anchorDebugElement = getChildDebugElement(fixture.debugElement, 'a');
let anchorElement = anchorDebugElement.nativeElement;
// The anchor should initially be in the tab order.
@@ -92,7 +90,7 @@ export function main() {
// After the disabled binding has been changed.
testAppComponent.isDisabled = true;
- rootTestComponent.detectChanges();
+ fixture.detectChanges();
// The anchor should now be out of the tab order.
expect(anchorElement.tabIndex).toBe(-1);