test(ivy): enable more @angular/core tests (#27912)

PR Close #27912
This commit is contained in:
Marc Laval 2019-01-03 16:20:40 +01:00 committed by Ben Lesh
parent 460be795cf
commit b7d0ab7de3
1 changed files with 37 additions and 46 deletions

View File

@ -557,45 +557,38 @@ class TestComp {
.toEqual('parentService'); .toEqual('parentService');
}); });
fixmeIvy('FW-890: Overridden providers are not found during dependency resolution') it('should instantiate directives that depend on providers of a component', () => {
.it('should instantiate directives that depend on providers of a component', () => { TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]}); TestBed.overrideComponent(
TestBed.overrideComponent( SimpleComponent, {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
SimpleComponent, TestBed.overrideComponent(SimpleComponent, {set: {template: '<div needsService></div>'}});
{set: {providers: [{provide: 'service', useValue: 'hostService'}]}}); const el = createComponent('<div simpleComponent></div>');
TestBed.overrideComponent( expect(el.children[0].children[0].injector.get(NeedsService).service)
SimpleComponent, {set: {template: '<div needsService></div>'}}); .toEqual('hostService');
const el = createComponent('<div simpleComponent></div>'); });
expect(el.children[0].children[0].injector.get(NeedsService).service)
.toEqual('hostService');
});
fixmeIvy('FW-890: Overridden providers are not found during dependency resolution') it('should instantiate directives that depend on view providers of a component', () => {
.it('should instantiate directives that depend on view providers of a component', () => { TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]}); TestBed.overrideComponent(
TestBed.overrideComponent( SimpleComponent, {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
SimpleComponent, TestBed.overrideComponent(SimpleComponent, {set: {template: '<div needsService></div>'}});
{set: {providers: [{provide: 'service', useValue: 'hostService'}]}}); const el = createComponent('<div simpleComponent></div>');
TestBed.overrideComponent( expect(el.children[0].children[0].injector.get(NeedsService).service)
SimpleComponent, {set: {template: '<div needsService></div>'}}); .toEqual('hostService');
const el = createComponent('<div simpleComponent></div>'); });
expect(el.children[0].children[0].injector.get(NeedsService).service)
.toEqual('hostService');
});
fixmeIvy('FW-890: Overridden providers are not found during dependency resolution') it('should instantiate directives in a root embedded view that depend on view providers of a component',
.it('should instantiate directives in a root embedded view that depend on view providers of a component', () => {
() => { TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]}); TestBed.overrideComponent(
TestBed.overrideComponent( SimpleComponent,
SimpleComponent, {set: {providers: [{provide: 'service', useValue: 'hostService'}]}});
{set: {providers: [{provide: 'service', useValue: 'hostService'}]}}); TestBed.overrideComponent(
TestBed.overrideComponent( SimpleComponent, {set: {template: '<div *ngIf="true" needsService></div>'}});
SimpleComponent, {set: {template: '<div *ngIf="true" needsService></div>'}}); const el = createComponent('<div simpleComponent></div>');
const el = createComponent('<div simpleComponent></div>'); expect(el.children[0].children[0].injector.get(NeedsService).service)
expect(el.children[0].children[0].injector.get(NeedsService).service) .toEqual('hostService');
.toEqual('hostService'); });
});
it('should instantiate directives that depend on instances in the app injector', () => { it('should instantiate directives that depend on instances in the app injector', () => {
TestBed.configureTestingModule({declarations: [NeedsAppService]}); TestBed.configureTestingModule({declarations: [NeedsAppService]});
@ -961,16 +954,14 @@ class TestComp {
}); });
describe('pipes', () => { describe('pipes', () => {
fixmeIvy('FW-890: Overridden providers are not found during dependency resolution') it('should instantiate pipes that have dependencies', () => {
.it('should instantiate pipes that have dependencies', () => { TestBed.configureTestingModule({declarations: [SimpleDirective, PipeNeedsService]});
TestBed.configureTestingModule({declarations: [SimpleDirective, PipeNeedsService]});
const el = createComponent( const el = createComponent(
'<div [simpleDirective]="true | pipeNeedsService"></div>', '<div [simpleDirective]="true | pipeNeedsService"></div>',
[{provide: 'service', useValue: 'pipeService'}]); [{provide: 'service', useValue: 'pipeService'}]);
expect(el.children[0].injector.get(SimpleDirective).value.service) expect(el.children[0].injector.get(SimpleDirective).value.service).toEqual('pipeService');
.toEqual('pipeService'); });
});
fixmeIvy('FW-894: Pipes don\'t overwrite pipes with later entry in the pipes array') fixmeIvy('FW-894: Pipes don\'t overwrite pipes with later entry in the pipes array')
.it('should overwrite pipes with later entry in the pipes array', () => { .it('should overwrite pipes with later entry in the pipes array', () => {