test(ivy): update root causes for @angular/core TestBed failures (#27479)
PR Close #27479
This commit is contained in:
		
							parent
							
								
									26433509f9
								
							
						
					
					
						commit
						821fecb413
					
				| @ -625,8 +625,7 @@ function declareTests(config?: {useJit: boolean}) { | ||||
|             }); | ||||
| 
 | ||||
|         if (getDOM().supportsDOMEvents()) { | ||||
|           fixmeIvy('unknown').it( | ||||
|               'should allow to destroy a component from within a host event handler', | ||||
|           it('should allow to destroy a component from within a host event handler', | ||||
|              fakeAsync(() => { | ||||
|                TestBed.configureTestingModule({declarations: [MyComp, [[PushCmpWithHostEvent]]]}); | ||||
|                const template = '<push-cmp-with-host-event></push-cmp-with-host-event>'; | ||||
|  | ||||
| @ -136,8 +136,8 @@ function declareTests(config?: {useJit: boolean}) { | ||||
|       expect(dir.text).toEqual('container'); | ||||
|     }); | ||||
| 
 | ||||
|     fixmeIvy('unknown').it( | ||||
|         'should contain all direct child directives in a <ng-container> (content dom)', () => { | ||||
|     fixmeIvy('FW-795: Queries with descendants: true don\'t descent into <ng-container>') | ||||
|         .it('should contain all direct child directives in a <ng-container> (content dom)', () => { | ||||
|           const template = | ||||
|               '<needs-content-children #q><ng-container><div text="foo"></div></ng-container></needs-content-children>'; | ||||
|           TestBed.overrideComponent(MyComp, {set: {template}}); | ||||
|  | ||||
| @ -13,8 +13,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; | ||||
| import {expect} from '@angular/platform-browser/testing/src/matchers'; | ||||
| import {fixmeIvy} from '@angular/private/testing'; | ||||
| 
 | ||||
| { | ||||
|   describe('projection', () => { | ||||
| describe('projection', () => { | ||||
|   beforeEach(() => TestBed.configureTestingModule({declarations: [MainComp, OtherComp, Simple]})); | ||||
| 
 | ||||
|   it('should support simple components', () => { | ||||
| @ -114,8 +113,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|     expect(main.nativeElement).toHaveText('(, BAC)'); | ||||
|   }); | ||||
| 
 | ||||
|     fixmeIvy('FW-665: Unable to find the given context data for the given target') | ||||
|         .it('should redistribute direct child viewcontainers when the light dom changes', () => { | ||||
|   it('should redistribute direct child viewcontainers when the light dom changes', () => { | ||||
|     TestBed.configureTestingModule( | ||||
|         {declarations: [MultipleContentTagsComponent, ManualViewportDirective]}); | ||||
|     TestBed.overrideComponent(MainComp, { | ||||
| @ -158,8 +156,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|     expect(main.nativeElement).toHaveText('OUTER(SIMPLE(AB))'); | ||||
|   }); | ||||
| 
 | ||||
|     fixmeIvy('FW-665: Unable to find the given context data for the given target') | ||||
|         .it('should support nesting with content being direct child of a nested component', () => { | ||||
|   it('should support nesting with content being direct child of a nested component', () => { | ||||
|     TestBed.configureTestingModule({ | ||||
|       declarations: | ||||
|           [InnerComponent, InnerInnerComponent, OuterComponent, ManualViewportDirective] | ||||
| @ -176,8 +173,8 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|     const main = TestBed.createComponent(MainComp); | ||||
| 
 | ||||
|     const viewportDirective = | ||||
|               main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0] | ||||
|                   .injector.get(ManualViewportDirective); | ||||
|         main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get( | ||||
|             ManualViewportDirective); | ||||
| 
 | ||||
|     expect(main.nativeElement).toHaveText('OUTER(INNER(INNERINNER(,BC)))'); | ||||
|     viewportDirective.show(); | ||||
| @ -185,8 +182,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|     expect(main.nativeElement).toHaveText('OUTER(INNER(INNERINNER(A,BC)))'); | ||||
|   }); | ||||
| 
 | ||||
|     fixmeIvy( | ||||
|         'FW-745: Compiler isn\'t generating projectionDefs for <ng-content> tags inside <ng-templates>') | ||||
|   fixmeIvy('FW-796: Content projection logic is incorrect for <ng-content> in nested templates') | ||||
|       .it('should redistribute when the shadow dom changes', () => { | ||||
|         TestBed.configureTestingModule( | ||||
|             {declarations: [ConditionalContentComponent, ManualViewportDirective]}); | ||||
| @ -202,8 +198,8 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|         const main = TestBed.createComponent(MainComp); | ||||
| 
 | ||||
|         const viewportDirective = | ||||
|               main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0] | ||||
|                   .injector.get(ManualViewportDirective); | ||||
|             main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get( | ||||
|                 ManualViewportDirective); | ||||
| 
 | ||||
|         expect(main.nativeElement).toHaveText('(, BC)'); | ||||
| 
 | ||||
| @ -234,8 +230,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|   // which could skrew up text node indices.
 | ||||
|   it('should support text nodes after style tags', () => { | ||||
|     TestBed.overrideComponent(MainComp, {set: {template: '<simple stringProp="text"></simple>'}}); | ||||
|       TestBed.overrideComponent( | ||||
|           Simple, {set: {template: '<style></style><p>P,</p>{{stringProp}}'}}); | ||||
|     TestBed.overrideComponent(Simple, {set: {template: '<style></style><p>P,</p>{{stringProp}}'}}); | ||||
|     const main = TestBed.createComponent(MainComp); | ||||
| 
 | ||||
|     main.detectChanges(); | ||||
| @ -295,11 +290,10 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|     expect(main.nativeElement).toHaveText('SIMPLE()START(A)END'); | ||||
|   }); | ||||
| 
 | ||||
|     fixmeIvy('FW-665: Unable to find the given context data for the given target') | ||||
|   fixmeIvy('FW-796: Content projection logic is incorrect for <ng-content> in nested templates') | ||||
|       .it('should support moving ng-content around', () => { | ||||
|         TestBed.configureTestingModule({ | ||||
|             declarations: | ||||
|                 [ConditionalContentComponent, ProjectDirective, ManualViewportDirective] | ||||
|           declarations: [ConditionalContentComponent, ProjectDirective, ManualViewportDirective] | ||||
|         }); | ||||
|         TestBed.overrideComponent(MainComp, { | ||||
|           set: { | ||||
| @ -313,8 +307,8 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|         const main = TestBed.createComponent(MainComp); | ||||
| 
 | ||||
|         const sourceDirective: ManualViewportDirective = | ||||
|               main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0] | ||||
|                   .injector.get(ManualViewportDirective); | ||||
|             main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get( | ||||
|                 ManualViewportDirective); | ||||
|         const projectDirective: ProjectDirective = | ||||
|             main.debugElement.queryAllNodes(By.directive(ProjectDirective))[0].injector.get( | ||||
|                 ProjectDirective); | ||||
| @ -435,7 +429,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|     fixmeIvy('FW-665: Unable to find the given context data for the given target') | ||||
|   fixmeIvy('FW-796: Content projection logic is incorrect for <ng-content> in nested templates') | ||||
|       .it('should support nested conditionals that contain ng-contents', () => { | ||||
|         TestBed.configureTestingModule( | ||||
|             {declarations: [ConditionalTextComponent, ManualViewportDirective]}); | ||||
| @ -450,8 +444,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|         viewportElement.injector.get(ManualViewportDirective).show(); | ||||
|         expect(main.nativeElement).toHaveText('MAIN(FIRST())'); | ||||
| 
 | ||||
|           viewportElement = | ||||
|               main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[1]; | ||||
|         viewportElement = main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[1]; | ||||
|         viewportElement.injector.get(ManualViewportDirective).show(); | ||||
|         expect(main.nativeElement).toHaveText('MAIN(FIRST(SECOND(a)))'); | ||||
|       }); | ||||
| @ -469,8 +462,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|   }); | ||||
| 
 | ||||
|   it('should create nested components in the right order', () => { | ||||
|       TestBed.configureTestingModule( | ||||
|           {declarations: [CmpA1, CmpA2, CmpB11, CmpB12, CmpB21, CmpB22]}); | ||||
|     TestBed.configureTestingModule({declarations: [CmpA1, CmpA2, CmpB11, CmpB12, CmpB21, CmpB22]}); | ||||
|     TestBed.overrideComponent(MainComp, {set: {template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`}}); | ||||
|     const main = TestBed.createComponent(MainComp); | ||||
| 
 | ||||
| @ -481,8 +473,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|             '<cmp-a2>a2<cmp-b21>b21</cmp-b21><cmp-b22>b22</cmp-b22></cmp-a2>'); | ||||
|   }); | ||||
| 
 | ||||
|     fixmeIvy( | ||||
|         'FW-745: Compiler isn\'t generating projectionDefs for <ng-content> tags inside <ng-templates>') | ||||
|   fixmeIvy('FW-796: Content projection logic is incorrect for <ng-content> in nested templates') | ||||
|       .it('should project filled view containers into a view container', () => { | ||||
|         TestBed.configureTestingModule( | ||||
|             {declarations: [ConditionalContentComponent, ManualViewportDirective]}); | ||||
| @ -498,8 +489,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|         }); | ||||
|         const main = TestBed.createComponent(MainComp); | ||||
| 
 | ||||
|           const conditionalComp = | ||||
|               main.debugElement.query(By.directive(ConditionalContentComponent)); | ||||
|         const conditionalComp = main.debugElement.query(By.directive(ConditionalContentComponent)); | ||||
| 
 | ||||
|         const viewViewportDir = | ||||
|             conditionalComp.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get( | ||||
| @ -526,8 +516,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|         main.detectChanges(); | ||||
|         expect(main.nativeElement).toHaveText('(, D)'); | ||||
|       }); | ||||
|   }); | ||||
| } | ||||
| }); | ||||
| 
 | ||||
| @Component({selector: 'main', template: ''}) | ||||
| class MainComp { | ||||
|  | ||||
| @ -9,7 +9,7 @@ | ||||
| import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, Component, ContentChild, ContentChildren, Directive, QueryList, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef, asNativeElements} from '@angular/core'; | ||||
| import {ComponentFixture, TestBed, async} from '@angular/core/testing'; | ||||
| import {expect} from '@angular/platform-browser/testing/src/matchers'; | ||||
| import {fixmeIvy, modifiedInIvy} from '@angular/private/testing'; | ||||
| import {fixmeIvy, ivyEnabled, modifiedInIvy} from '@angular/private/testing'; | ||||
| import {Subject} from 'rxjs'; | ||||
| 
 | ||||
| import {stringify} from '../../src/util'; | ||||
| @ -637,11 +637,13 @@ describe('Query API', () => { | ||||
|           expect(q.query.length).toBe(0); | ||||
|         }); | ||||
| 
 | ||||
|     fixmeIvy('unknown').it( | ||||
|         'should not throw if a content template is queried and created in the view during change detection', | ||||
|     modifiedInIvy('https://github.com/angular/angular/issues/15117 fixed in ivy') | ||||
|         .it('should not throw if a content template is queried and created in the view during change detection', | ||||
|             () => { | ||||
|           @Component( | ||||
|               {selector: 'auto-projecting', template: '<div *ngIf="true; then: content"></div>'}) | ||||
|               @Component({ | ||||
|                 selector: 'auto-projecting', | ||||
|                 template: '<div *ngIf="true; then: content"></div>' | ||||
|               }) | ||||
|               class AutoProjecting { | ||||
|                 // TODO(issue/24571):
 | ||||
|                 // remove '!'.
 | ||||
| @ -666,6 +668,35 @@ describe('Query API', () => { | ||||
|               expect(q.query.length).toBe(0); | ||||
|             }); | ||||
| 
 | ||||
|     if (ivyEnabled) { | ||||
|       // The fixed version of the "should not throw if a content template is queried and created in
 | ||||
|       // the view during change detection" test. This test is a different as ivy fixes
 | ||||
|       // https://github.com/angular/angular/issues/15117 present in the view engine.
 | ||||
|       it('should not throw if a content template is queried and created in the view during change detection - fixed in ivy', | ||||
|          () => { | ||||
|            @Component( | ||||
|                {selector: 'auto-projecting', template: '<div *ngIf="true; then: content"></div>'}) | ||||
|            class AutoProjecting { | ||||
|              // TODO(issue/24571):
 | ||||
|              // remove '!'.
 | ||||
|              @ContentChild(TemplateRef) | ||||
|              content !: TemplateRef<any>; | ||||
| 
 | ||||
|              // TODO(issue/24571):
 | ||||
|              // remove '!'.
 | ||||
|              @ContentChildren(TextDirective) | ||||
|              query !: QueryList<TextDirective>; | ||||
|            } | ||||
| 
 | ||||
|            TestBed.configureTestingModule({declarations: [AutoProjecting]}); | ||||
|            const template = | ||||
|                '<auto-projecting #q><ng-template><div text="1"></div></ng-template></auto-projecting>'; | ||||
|            const view = createTestCmpAndDetectChanges(MyComp0, template); | ||||
| 
 | ||||
|            const q = view.debugElement.children[0].references !['q']; | ||||
|            expect(q.query.length).toBe(1); | ||||
|          }); | ||||
|     } | ||||
|   }); | ||||
| }); | ||||
| 
 | ||||
|  | ||||
| @ -32,7 +32,8 @@ function declareTests(config?: {useJit: boolean}) { | ||||
|     describe('platform pipes', () => { | ||||
|       beforeEach(() => { TestBed.configureCompiler({...config}); }); | ||||
| 
 | ||||
|       fixmeIvy('unknown').it('should overwrite them by custom pipes', () => { | ||||
|       fixmeIvy('FW-798: Handle pipes with duplicate names') | ||||
|           .it('should overwrite them by custom pipes', () => { | ||||
|             TestBed.configureTestingModule({declarations: [CustomPipe]}); | ||||
|             const template = '{{true | somePipe}}'; | ||||
|             TestBed.overrideComponent(MyComp1, {set: {template}}); | ||||
| @ -351,8 +352,9 @@ function declareTests(config?: {useJit: boolean}) { | ||||
|           }); | ||||
|     }); | ||||
| 
 | ||||
|     fixmeIvy('unknown').it( | ||||
|         'should support @ContentChild and @Input on the same property for static queries', () => { | ||||
|     fixmeIvy('FW-797: @ContentChildren results are assigned after @Input bindings') | ||||
|         .it('should support @ContentChild and @Input on the same property for static queries', | ||||
|             () => { | ||||
|               @Directive({selector: 'test'}) | ||||
|               class Test { | ||||
|                 // TODO(issue/24571): remove '!'.
 | ||||
| @ -375,8 +377,8 @@ function declareTests(config?: {useJit: boolean}) { | ||||
|                   TestBed.configureTestingModule({declarations: [App, Test]}).createComponent(App); | ||||
|               fixture.detectChanges(); | ||||
| 
 | ||||
|           const testDirs = | ||||
|               fixture.debugElement.queryAll(By.directive(Test)).map(el => el.injector.get(Test)); | ||||
|               const testDirs = fixture.debugElement.queryAll(By.directive(Test)) | ||||
|                                    .map(el => el.injector.get(Test)); | ||||
|               expect(testDirs[0].tpl).toBeUndefined(); | ||||
|               expect(testDirs[1].tpl).toBeDefined(); | ||||
|               expect(testDirs[2].tpl).toBeDefined(); | ||||
|  | ||||
| @ -102,29 +102,30 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|     function declareTests( | ||||
|         {ngUrl, templateDecorator}: | ||||
|             {ngUrl: string, templateDecorator: (template: string) => { [key: string]: any }}) { | ||||
|       fixmeIvy('unknown').it( | ||||
|           'should use the right source url in html parse errors', fakeAsync(() => { | ||||
|       fixmeIvy('FW-682: Compiler error handling') | ||||
|           .it('should use the right source url in html parse errors', fakeAsync(() => { | ||||
|                 @Component({...templateDecorator('<div>\n  </error>')}) | ||||
|                 class MyComp { | ||||
|                 } | ||||
| 
 | ||||
|                 expect(() => compileAndCreateComponent(MyComp)) | ||||
|                 .toThrowError( | ||||
|                     new RegExp(`Template parse errors[\\s\\S]*${ngUrl.replace('$', '\\$')}@1:2`)); | ||||
|                     .toThrowError(new RegExp( | ||||
|                         `Template parse errors[\\s\\S]*${ngUrl.replace('$', '\\$')}@1:2`)); | ||||
|               })); | ||||
| 
 | ||||
|       fixmeIvy('unknown').it( | ||||
|           'should use the right source url in template parse errors', fakeAsync(() => { | ||||
|       fixmeIvy('FW-682: Compiler error handling') | ||||
|           .it('should use the right source url in template parse errors', fakeAsync(() => { | ||||
|                 @Component({...templateDecorator('<div>\n  <div unknown="{{ctxProp}}"></div>')}) | ||||
|                 class MyComp { | ||||
|                 } | ||||
| 
 | ||||
|                 expect(() => compileAndCreateComponent(MyComp)) | ||||
|                 .toThrowError( | ||||
|                     new RegExp(`Template parse errors[\\s\\S]*${ngUrl.replace('$', '\\$')}@1:7`)); | ||||
|                     .toThrowError(new RegExp( | ||||
|                         `Template parse errors[\\s\\S]*${ngUrl.replace('$', '\\$')}@1:7`)); | ||||
|               })); | ||||
| 
 | ||||
|       fixmeIvy('unknown').it('should create a sourceMap for templates', fakeAsync(() => { | ||||
|       fixmeIvy('FW-223: Generate source maps during template compilation') | ||||
|           .it('should create a sourceMap for templates', fakeAsync(() => { | ||||
|                 const template = `Hello World!`; | ||||
| 
 | ||||
|                 @Component({...templateDecorator(template)}) | ||||
| @ -133,8 +134,7 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
| 
 | ||||
|                 compileAndCreateComponent(MyComp); | ||||
| 
 | ||||
|                                const sourceMap = | ||||
|                                    getSourceMap('ng:///DynamicTestModule/MyComp.ngfactory.js'); | ||||
|                 const sourceMap = getSourceMap('ng:///DynamicTestModule/MyComp.ngfactory.js'); | ||||
|                 expect(sourceMap.sources).toEqual([ | ||||
|                   'ng:///DynamicTestModule/MyComp.ngfactory.js', ngUrl | ||||
|                 ]); | ||||
| @ -142,8 +142,8 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|               })); | ||||
| 
 | ||||
| 
 | ||||
|       fixmeIvy('unknown').it( | ||||
|           'should report source location for di errors', fakeAsync(() => { | ||||
|       fixmeIvy('FW-223: Generate source maps during template compilation') | ||||
|           .it('should report source location for di errors', fakeAsync(() => { | ||||
|                 const template = `<div>\n    <div   someDir></div></div>`; | ||||
| 
 | ||||
|                 @Component({...templateDecorator(template)}) | ||||
| @ -170,8 +170,8 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|                 }); | ||||
|               })); | ||||
| 
 | ||||
|       fixmeIvy('unknown').it( | ||||
|           'should report di errors with multiple elements and directives', fakeAsync(() => { | ||||
|       fixmeIvy('FW-223: Generate source maps during template compilation') | ||||
|           .it('should report di errors with multiple elements and directives', fakeAsync(() => { | ||||
|                 const template = `<div someDir></div><div someDir="throw"></div>`; | ||||
| 
 | ||||
|                 @Component({...templateDecorator(template)}) | ||||
| @ -202,8 +202,8 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|                 }); | ||||
|               })); | ||||
| 
 | ||||
|       fixmeIvy('unknown').it( | ||||
|           'should report source location for binding errors', fakeAsync(() => { | ||||
|       fixmeIvy('FW-223: Generate source maps during template compilation') | ||||
|           .it('should report source location for binding errors', fakeAsync(() => { | ||||
|                 const template = `<div>\n    <span   [title]="createError()"></span></div>`; | ||||
| 
 | ||||
|                 @Component({...templateDecorator(template)}) | ||||
| @ -233,8 +233,8 @@ import {fixmeIvy} from '@angular/private/testing'; | ||||
|                 }); | ||||
|               })); | ||||
| 
 | ||||
|       fixmeIvy('unknown').it( | ||||
|           'should report source location for event errors', fakeAsync(() => { | ||||
|       fixmeIvy('FW-223: Generate source maps during template compilation') | ||||
|           .it('should report source location for event errors', fakeAsync(() => { | ||||
|                 const template = `<div>\n    <span   (click)="createError()"></span></div>`; | ||||
| 
 | ||||
|                 @Component({...templateDecorator(template)}) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user