test(ivy): update root causes for @angular/core TestBed failures (#27321)

PR Close #27321
This commit is contained in:
Pawel Kozlowski 2018-11-28 12:18:44 +01:00 committed by Jason Aden
parent 0340ba47df
commit 7076773360
2 changed files with 162 additions and 171 deletions

View File

@ -28,16 +28,13 @@ import {stringify} from '../../src/util';
const ANCHOR_ELEMENT = new InjectionToken('AnchorElement');
{
if (ivyEnabled) {
if (ivyEnabled) {
describe('ivy', () => { declareTests(); });
} else {
} else {
describe('jit', () => { declareTests({useJit: true}); });
describe('no jit', () => { declareTests({useJit: false}); });
}
}
function declareTests(config?: {useJit: boolean}) {
describe('integration tests', function() {
@ -227,7 +224,6 @@ function declareTests(config?: {useJit: boolean}) {
expect(nativeEl).not.toHaveCssClass('initial');
});
fixmeIvy('FW-587: Inputs with aliases in component decorators don\'t work') &&
it('should consume binding to htmlFor using for alias', () => {
const template = '<label [for]="ctxProp"></label>';
const fixture = TestBed.configureTestingModule({declarations: [MyComp]})
@ -856,7 +852,9 @@ function declareTests(config?: {useJit: boolean}) {
dir.triggerChange('two');
}));
fixmeIvy('unknown') && it('should support render events', () => {
fixmeIvy(
'FW-743: Registering events on global objects (document, window, body) is not supported') &&
it('should support render events', () => {
TestBed.configureTestingModule({declarations: [MyComp, DirectiveListeningDomEvent]});
const template = '<div listener></div>';
TestBed.overrideComponent(MyComp, {set: {template}});
@ -877,7 +875,9 @@ function declareTests(config?: {useJit: boolean}) {
expect(listener.eventTypes).toEqual([]);
});
fixmeIvy('unknown') && it('should support render global events', () => {
fixmeIvy(
'FW-743: Registering events on global objects (document, window, body) is not supported') &&
it('should support render global events', () => {
TestBed.configureTestingModule({declarations: [MyComp, DirectiveListeningDomEvent]});
const template = '<div listener></div>';
TestBed.overrideComponent(MyComp, {set: {template}});
@ -1034,7 +1034,8 @@ function declareTests(config?: {useJit: boolean}) {
});
}
fixmeIvy('unknown') &&
fixmeIvy(
'FW-743: Registering events on global objects (document, window, body) is not supported') &&
it('should support render global events from multiple directives', () => {
TestBed.configureTestingModule({
declarations: [MyComp, DirectiveListeningDomEvent, DirectiveListeningDomEventOther]
@ -1457,7 +1458,6 @@ function declareTests(config?: {useJit: boolean}) {
`Directive ${stringify(SomeDirective)} has no selector, please add it!`);
});
fixmeIvy('FW-662: Components without selector are not supported') &&
it('should use a default element name for components without selectors', () => {
let noSelectorComponentFactory: ComponentFactory<SomeComponent> = undefined !;
@ -1465,8 +1465,7 @@ function declareTests(config?: {useJit: boolean}) {
class NoSelectorComponent {
}
@Component(
{selector: 'some-comp', template: '', entryComponents: [NoSelectorComponent]})
@Component({selector: 'some-comp', template: '', entryComponents: [NoSelectorComponent]})
class SomeComponent {
constructor(componentFactoryResolver: ComponentFactoryResolver) {
// grab its own component factory
@ -1482,9 +1481,9 @@ function declareTests(config?: {useJit: boolean}) {
expect(noSelectorComponentFactory.selector).toBe('ng-component');
expect(getDOM()
.nodeName(
noSelectorComponentFactory.create(Injector.NULL).location.nativeElement)
expect(
getDOM()
.nodeName(noSelectorComponentFactory.create(Injector.NULL).location.nativeElement)
.toLowerCase())
.toEqual('ng-component');
});
@ -1699,14 +1698,12 @@ function declareTests(config?: {useJit: boolean}) {
.toContain('ng-reflect-dir-prop="hello"');
});
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
it(`should work with prop names containing '$'`, () => {
TestBed.configureTestingModule({declarations: [ParentCmp, SomeCmpWithInput]});
const fixture = TestBed.createComponent(ParentCmp);
fixture.detectChanges();
expect(getDOM().getInnerHTML(fixture.nativeElement))
.toContain('ng-reflect-test_="hello"');
expect(getDOM().getInnerHTML(fixture.nativeElement)).toContain('ng-reflect-test_="hello"');
});
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
@ -1725,8 +1722,7 @@ function declareTests(config?: {useJit: boolean}) {
.toContain('"ng\-reflect\-ng\-if"\: "true"');
});
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
it('should indicate when toString() throws', () => {
fixmeIvy('unknown') && it('should indicate when toString() throws', () => {
TestBed.configureTestingModule({declarations: [MyComp, MyDir]});
const template = '<div my-dir [elprop]="toStringThrow"></div>';
TestBed.overrideComponent(MyComp, {set: {template}});

View File

@ -239,7 +239,6 @@ import {fixmeIvy} from '@angular/private/testing';
expect(main.nativeElement).toHaveText('P,text');
});
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
it('should support moving non projected light dom around', () => {
let sourceDirective: ManualViewportDirective = undefined !;
@ -270,7 +269,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(main.nativeElement).toHaveText('START(A)END');
});
fixmeIvy('unknown') && it('should support moving projected light dom around', () => {
it('should support moving projected light dom around', () => {
TestBed.configureTestingModule(
{declarations: [Empty, ProjectDirective, ManualViewportDirective]});
TestBed.overrideComponent(MainComp, {
@ -330,7 +329,6 @@ import {fixmeIvy} from '@angular/private/testing';
// Note: This does not use a ng-content element, but
// is still important as we are merging proto views independent of
// the presence of ng-content elements!
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
it('should still allow to implement a recursive trees', () => {
TestBed.configureTestingModule({declarations: [Tree, ManualViewportDirective]});
TestBed.overrideComponent(MainComp, {set: {template: '<tree></tree>'}});
@ -338,8 +336,8 @@ import {fixmeIvy} from '@angular/private/testing';
main.detectChanges();
const manualDirective: ManualViewportDirective =
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0]
.injector.get(ManualViewportDirective);
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
ManualViewportDirective);
expect(main.nativeElement).toHaveText('TREE(0:)');
manualDirective.show();
main.detectChanges();
@ -349,7 +347,6 @@ import {fixmeIvy} from '@angular/private/testing';
// Note: This does not use a ng-content element, but
// is still important as we are merging proto views independent of
// the presence of ng-content elements!
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
it('should still allow to implement a recursive trees via multiple components', () => {
TestBed.configureTestingModule({declarations: [Tree, Tree2, ManualViewportDirective]});
TestBed.overrideComponent(MainComp, {set: {template: '<tree></tree>'}});
@ -369,8 +366,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(main.nativeElement).toHaveText('TREE(0:TREE2(1:))');
const tree2 = main.debugElement.query(By.directive(Tree2));
manualDirective =
tree2.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
manualDirective = tree2.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
ManualViewportDirective);
manualDirective.show();
main.detectChanges();
@ -457,7 +453,6 @@ import {fixmeIvy} from '@angular/private/testing';
expect(main.nativeElement).toHaveText('MAIN(FIRST(SECOND(a)))');
});
fixmeIvy('unknown') &&
it('should allow to switch the order of nested components via ng-content', () => {
TestBed.configureTestingModule({declarations: [CmpA, CmpB, CmpD, CmpC]});
TestBed.overrideComponent(MainComp, {set: {template: `<cmp-a><cmp-b></cmp-b></cmp-a>`}});
@ -470,7 +465,7 @@ import {fixmeIvy} from '@angular/private/testing';
'<cmp-c><b>cmp-c</b></cmp-c></cmp-a>');
});
fixmeIvy('unknown') && it('should create nested components in the right order', () => {
it('should create nested components in the right order', () => {
TestBed.configureTestingModule(
{declarations: [CmpA1, CmpA2, CmpB11, CmpB12, CmpB21, CmpB22]});
TestBed.overrideComponent(MainComp, {set: {template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`}});