chore(test): rename RootTestComponent to ComponentFixture

BREAKING CHANGE:

Before:

```
testComponentBuilder.createAsync(MyComponent).then(root: RootTestComponent => {
}
```

After:

```
testComponentBuilder.createAsync(MyComponent).then(fixture: ComponentFixture => {
}
```

Closes #4711
This commit is contained in:
Julie Ralph
2015-10-31 09:50:19 -07:00
parent a16214c614
commit 686457890d
25 changed files with 1128 additions and 1121 deletions
@@ -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<string>(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<string>(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<string>(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();
});
@@ -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();
});
}));
@@ -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();
});
}));
});
@@ -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() {
<a [router-link]="['./BetterChild']" class="better-child-link">Better Child</a>
<router-outlet></router-outlet>`))
.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() {
<a [router-link]="['./ChildWithGrandchild/Grandchild']" class="child-with-grandchild-link">Better Child</a>
<router-outlet></router-outlet>`))
.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');
}