test(ivy): add root cause analysis for failing core tests (view injector integration) (#27912)
PR Close #27912
This commit is contained in:
parent
c4f7727408
commit
460be795cf
@ -589,7 +589,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
|
||||
|
||||
}));
|
||||
|
||||
modifiedInIvy('FW-821: Pure pipes are instantiated differently in view engine and ivy')
|
||||
modifiedInIvy('Pure pipes are instantiated differently in view engine and ivy')
|
||||
.it('should call pure pipes that are used multiple times only when the arguments change and share state between pipe instances',
|
||||
fakeAsync(() => {
|
||||
const ctx = createCompFixture(
|
||||
|
@ -10,7 +10,7 @@ import {Attribute, ChangeDetectionStrategy, ChangeDetectorRef, Component, Compon
|
||||
import {ComponentFixture, TestBed, fakeAsync} from '@angular/core/testing';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {fixmeIvy, obsoleteInIvy, onlyInIvy} from '@angular/private/testing';
|
||||
import {fixmeIvy, modifiedInIvy, obsoleteInIvy, onlyInIvy} from '@angular/private/testing';
|
||||
|
||||
@Directive({selector: '[simpleDirective]'})
|
||||
class SimpleDirective {
|
||||
@ -292,7 +292,9 @@ class TestComp {
|
||||
expect(el.children[0].injector.get('injectable2')).toEqual('injectable1-injectable2');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should instantiate viewProviders that have dependencies', () => {
|
||||
fixmeIvy(
|
||||
'FW-889: Element injector cannot access the viewProviders of the component to which it belongs')
|
||||
.it('should instantiate viewProviders that have dependencies', () => {
|
||||
TestBed.configureTestingModule({declarations: [SimpleComponent]});
|
||||
const viewProviders = [
|
||||
{provide: 'injectable1', useValue: 'injectable1'}, {
|
||||
@ -429,7 +431,7 @@ class TestComp {
|
||||
expect(ctx.debugElement.injector.get('eager2')).toBe('v2: v1');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should inject providers that were declared after it', () => {
|
||||
it('should inject providers that were declared after it', () => {
|
||||
@Component({
|
||||
template: '',
|
||||
providers: [
|
||||
@ -465,7 +467,8 @@ class TestComp {
|
||||
expect(comp.componentInstance.a).toBe('aValue');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should support ngOnDestroy for lazy providers', () => {
|
||||
fixmeIvy('FW-848: ngOnDestroy hooks are not called on providers')
|
||||
.it('should support ngOnDestroy for lazy providers', () => {
|
||||
let created = false;
|
||||
let destroyed = false;
|
||||
|
||||
@ -497,7 +500,9 @@ class TestComp {
|
||||
expect(destroyed).toBe(true);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should instantiate view providers lazily', () => {
|
||||
fixmeIvy(
|
||||
'FW-889: Element injector cannot access the viewProviders of the component to which it belongs')
|
||||
.it('should instantiate view providers lazily', () => {
|
||||
let created = false;
|
||||
TestBed.configureTestingModule({declarations: [SimpleComponent]});
|
||||
TestBed.overrideComponent(
|
||||
@ -552,8 +557,8 @@ class TestComp {
|
||||
.toEqual('parentService');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should instantiate directives that depend on providers of a component', () => {
|
||||
fixmeIvy('FW-890: Overridden providers are not found during dependency resolution')
|
||||
.it('should instantiate directives that depend on providers of a component', () => {
|
||||
TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
|
||||
TestBed.overrideComponent(
|
||||
SimpleComponent,
|
||||
@ -565,8 +570,8 @@ class TestComp {
|
||||
.toEqual('hostService');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should instantiate directives that depend on view providers of a component', () => {
|
||||
fixmeIvy('FW-890: Overridden providers are not found during dependency resolution')
|
||||
.it('should instantiate directives that depend on view providers of a component', () => {
|
||||
TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
|
||||
TestBed.overrideComponent(
|
||||
SimpleComponent,
|
||||
@ -578,8 +583,8 @@ class TestComp {
|
||||
.toEqual('hostService');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should instantiate directives in a root embedded view that depend on view providers of a component',
|
||||
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',
|
||||
() => {
|
||||
TestBed.configureTestingModule({declarations: [SimpleComponent, NeedsService]});
|
||||
TestBed.overrideComponent(
|
||||
@ -734,8 +739,8 @@ class TestComp {
|
||||
expect(d.dependency).toBeAnInstanceOf(SimpleComponent);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should instantiate host views for components that have a @Host dependency ', () => {
|
||||
obsoleteInIvy('@Host() / @Self() no longer looks in module injector')
|
||||
.it('should instantiate host views for components that have a @Host dependency ', () => {
|
||||
TestBed.configureTestingModule({declarations: [NeedsHostAppService]});
|
||||
const el = createComponent('', [], NeedsHostAppService);
|
||||
expect(el.componentInstance.service).toEqual('appService');
|
||||
@ -764,15 +769,16 @@ class TestComp {
|
||||
.toThrowError('NodeInjector: NOT_FOUND [SimpleDirective]');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should allow to use the NgModule injector from a root ViewContainerRef.parentInjector',
|
||||
fixmeIvy('FW-638: Exception thrown when getting VCRef.parentInjector on the root view')
|
||||
.it('should allow to use the NgModule injector from a root ViewContainerRef.parentInjector',
|
||||
() => {
|
||||
@Component({template: ''})
|
||||
class MyComp {
|
||||
constructor(public vc: ViewContainerRef) {}
|
||||
}
|
||||
|
||||
const compFixture = TestBed
|
||||
const compFixture =
|
||||
TestBed
|
||||
.configureTestingModule({
|
||||
declarations: [MyComp],
|
||||
providers: [{provide: 'someToken', useValue: 'someValue'}]
|
||||
@ -812,8 +818,7 @@ class TestComp {
|
||||
.toBe(el.children[0].nativeElement);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should inject ChangeDetectorRef of the component\'s view into the component', () => {
|
||||
it('should inject ChangeDetectorRef of the component\'s view into the component', () => {
|
||||
TestBed.configureTestingModule({declarations: [PushComponentNeedsChangeDetectorRef]});
|
||||
const cf = createComponentFixture('<div componentNeedsChangeDetectorRef></div>');
|
||||
cf.detectChanges();
|
||||
@ -827,8 +832,9 @@ class TestComp {
|
||||
expect(compEl.nativeElement).toHaveText('1');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should inject ChangeDetectorRef of the containing component into directives', () => {
|
||||
fixmeIvy(
|
||||
'FW-893: expect(changeDetectorRef).toEqual(otherChangeDetectorRef) creates an infinite loop')
|
||||
.it('should inject ChangeDetectorRef of the containing component into directives', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations:
|
||||
[PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
|
||||
@ -858,12 +864,9 @@ class TestComp {
|
||||
expect(compEl.nativeElement).toHaveText('1');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
'should inject ChangeDetectorRef of a same element component into a directive', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations:
|
||||
[PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
|
||||
});
|
||||
it('should inject ChangeDetectorRef of a same element component into a directive', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]});
|
||||
const cf = createComponentFixture(
|
||||
'<div componentNeedsChangeDetectorRef directiveNeedsChangeDetectorRef></div>');
|
||||
cf.detectChanges();
|
||||
@ -878,13 +881,10 @@ class TestComp {
|
||||
expect(compEl.nativeElement).toHaveText('1');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it(
|
||||
`should not inject ChangeDetectorRef of a parent element's component into a directive`,
|
||||
() => {
|
||||
it(`should not inject ChangeDetectorRef of a parent element's component into a directive`, () => {
|
||||
TestBed
|
||||
.configureTestingModule({
|
||||
declarations:
|
||||
[PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
|
||||
declarations: [PushComponentNeedsChangeDetectorRef, DirectiveNeedsChangeDetectorRef]
|
||||
})
|
||||
.overrideComponent(
|
||||
PushComponentNeedsChangeDetectorRef,
|
||||
@ -912,7 +912,8 @@ class TestComp {
|
||||
.toBe(el.children[0].nativeElement);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should inject ViewContainerRef', () => {
|
||||
fixmeIvy('FW-638: Exception thrown when getting VCRef.parentInjector on the root view')
|
||||
.it('should inject ViewContainerRef', () => {
|
||||
@Component({template: ''})
|
||||
class TestComp {
|
||||
constructor(public vcr: ViewContainerRef) {}
|
||||
@ -937,7 +938,7 @@ class TestComp {
|
||||
expect(component.instance.vcr.parentInjector.get('someToken')).toBe('someNewValue');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should inject TemplateRef', () => {
|
||||
it('should inject TemplateRef', () => {
|
||||
TestBed.configureTestingModule({declarations: [NeedsViewContainerRef, NeedsTemplateRef]});
|
||||
const el =
|
||||
createComponent('<ng-template needsViewContainerRef needsTemplateRef></ng-template>');
|
||||
@ -960,20 +961,24 @@ class TestComp {
|
||||
});
|
||||
|
||||
describe('pipes', () => {
|
||||
fixmeIvy('unknown').it('should instantiate pipes that have dependencies', () => {
|
||||
fixmeIvy('FW-890: Overridden providers are not found during dependency resolution')
|
||||
.it('should instantiate pipes that have dependencies', () => {
|
||||
TestBed.configureTestingModule({declarations: [SimpleDirective, PipeNeedsService]});
|
||||
|
||||
const el = createComponent(
|
||||
'<div [simpleDirective]="true | pipeNeedsService"></div>',
|
||||
[{provide: 'service', useValue: 'pipeService'}]);
|
||||
expect(el.children[0].injector.get(SimpleDirective).value.service).toEqual('pipeService');
|
||||
expect(el.children[0].injector.get(SimpleDirective).value.service)
|
||||
.toEqual('pipeService');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should 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', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [SimpleDirective, DuplicatePipe1, DuplicatePipe2]});
|
||||
const el = createComponent('<div [simpleDirective]="true | duplicatePipe"></div>');
|
||||
expect(el.children[0].injector.get(SimpleDirective).value).toBeAnInstanceOf(DuplicatePipe2);
|
||||
expect(el.children[0].injector.get(SimpleDirective).value)
|
||||
.toBeAnInstanceOf(DuplicatePipe2);
|
||||
});
|
||||
|
||||
it('should inject ChangeDetectorRef into pipes', () => {
|
||||
@ -988,7 +993,8 @@ class TestComp {
|
||||
expect(el.children[0].injector.get(SimpleDirective).value.changeDetectorRef).toEqual(cdRef);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown').it('should cache pure pipes', () => {
|
||||
modifiedInIvy('Pure pipes are instantiated differently in view engine and ivy')
|
||||
.it('should cache pure pipes', () => {
|
||||
TestBed.configureTestingModule({declarations: [SimpleDirective, PurePipe]});
|
||||
const el = createComponent(
|
||||
'<div [simpleDirective]="true | purePipe"></div><div [simpleDirective]="true | purePipe"></div>' +
|
||||
|
Loading…
x
Reference in New Issue
Block a user