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:
@ -17,7 +17,7 @@ import {
|
||||
ComponentFixtureNoNgZone
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {Injectable, provide} from 'angular2/core';
|
||||
import {Injectable, provide, ComponentResolver} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {Directive, Component, ViewMetadata, Input} from 'angular2/src/core/metadata';
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
@ -460,6 +460,27 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('createSync', () => {
|
||||
it('should create components',
|
||||
inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter],
|
||||
(cr: ComponentResolver, tcb: TestComponentBuilder, async) => {
|
||||
cr.resolveComponent(MyIfComp).then((cmpFactory) => {
|
||||
let componentFixture = tcb.createSync(cmpFactory);
|
||||
|
||||
componentFixture.detectChanges();
|
||||
expect(componentFixture.nativeElement).toHaveText('MyIf()');
|
||||
|
||||
componentFixture.componentInstance.showMore = true;
|
||||
componentFixture.detectChanges();
|
||||
expect(componentFixture.nativeElement).toHaveText('MyIf(More)');
|
||||
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user