refactor(core): type ComponentRef, ComponentFactory and ComponentFixture by the component type

BREAKING CHANGE:
- `ComponetRef`, `ComponentFactory`, `ComponentFixture` now all require a type
  parameter with the component type.
Closes #8361
This commit is contained in:
Tobias Bosch
2016-04-30 10:52:04 -07:00
parent 4e2c68354e
commit 6a0cbb8a57
48 changed files with 225 additions and 209 deletions

View File

@ -35,7 +35,7 @@ import {
asyncRouteDataCmp
} from './fixture_components';
function getLinkElement(rtc: ComponentFixture) {
function getLinkElement(rtc: ComponentFixture<any>) {
return rtc.debugElement.query(By.css('a')).nativeElement;
}

View File

@ -30,13 +30,13 @@ import {
import {specs, compile, clickOnElement, getHref} from '../util';
import {BaseException} from 'angular2/src/facade/exceptions';
function getLinkElement(rtc: ComponentFixture, linkIndex: number = 0) {
function getLinkElement(rtc: ComponentFixture<any>, linkIndex: number = 0) {
return rtc.debugElement.queryAll(By.css('a'))[linkIndex].nativeElement;
}
function auxRoutes() {
var tcb: TestComponentBuilder;
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var rtr;
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {
@ -139,7 +139,7 @@ function auxRoutes() {
function auxRoutesWithAPrimaryRoute() {
var tcb: TestComponentBuilder;
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var rtr;
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {

View File

@ -142,7 +142,7 @@ export class RedirectToParentCmp {
@Component({selector: 'dynamic-loader-cmp', template: `{ <div #viewport></div> }`})
@RouteConfig([new Route({path: '/', component: HelloCmp})])
export class DynamicLoaderCmp {
private _componentRef: ComponentRef = null;
private _componentRef: ComponentRef<any> = null;
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;

View File

@ -30,7 +30,7 @@ import {
import {PromiseWrapper} from 'angular2/src/facade/async';
function getLinkElement(rtc: ComponentFixture) {
function getLinkElement(rtc: ComponentFixture<any>) {
return rtc.debugElement.query(By.css('a')).nativeElement;
}
@ -431,7 +431,7 @@ function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
}
function syncRoutesWithDynamicComponents() {
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var tcb: TestComponentBuilder;
var rtr: Router;

View File

@ -55,7 +55,7 @@ export function main() {
describe('Router lifecycle hooks', () => {
var tcb: TestComponentBuilder;
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var rtr: Router;
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);

View File

@ -37,7 +37,7 @@ export function main() {
describe('navigation', () => {
var tcb: TestComponentBuilder;
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var rtr;
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);

View File

@ -35,7 +35,7 @@ export function main() {
describe('redirects', () => {
var tcb: TestComponentBuilder;
var rootTC: ComponentFixture;
var rootTC: ComponentFixture<any>;
var rtr;
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);

View File

@ -47,7 +47,7 @@ import {RouterLinkTransform} from 'angular2/src/router/directives/router_link_tr
export function main() {
describe('routerLink directive', function() {
var tcb: TestComponentBuilder;
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var router: Router;
var location: Location;
@ -373,7 +373,7 @@ export function main() {
});
}
function getHref(tc: ComponentFixture) {
function getHref(tc: ComponentFixture<any>) {
return DOM.getAttribute(tc.debugElement.query(By.css('a')).nativeElement, 'href');
}