diff --git a/packages/core/test/linker/change_detection_integration_spec.ts b/packages/core/test/linker/change_detection_integration_spec.ts index ea57cad708..103ce26c12 100644 --- a/packages/core/test/linker/change_detection_integration_spec.ts +++ b/packages/core/test/linker/change_detection_integration_spec.ts @@ -13,7 +13,7 @@ import {ComponentFixture, TestBed, fakeAsync} from '@angular/core/testing'; import {By} from '@angular/platform-browser/src/dom/debug/by'; 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'; +import {fixmeIvy, ivyEnabled, modifiedInIvy} from '@angular/private/testing'; export function createUrlResolverWithoutPackagePrefix(): UrlResolver { return new UrlResolver(); @@ -589,8 +589,8 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [ })); - fixmeIvy('FW-821: 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', + modifiedInIvy('FW-821: 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( `
` + @@ -614,6 +614,33 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [ ]); })); + // this is the ivy version of the above tests - the difference is in pure pipe instantiation + // logic and binding execution order + ivyEnabled && + it('should call pure pipes that are used multiple times only when the arguments change', + fakeAsync(() => { + const ctx = createCompFixture( + `
` + + '
', + Person); + ctx.componentInstance.name = 'a'; + ctx.componentInstance.age = 10; + ctx.componentInstance.address = new Address('mtv'); + ctx.detectChanges(false); + expect(renderLog.loggedValues).toEqual([ + 'a state:0', '10 state:0', 'mtv state:0', 'mtv state:0' + ]); + ctx.detectChanges(false); + expect(renderLog.loggedValues).toEqual([ + 'a state:0', '10 state:0', 'mtv state:0', 'mtv state:0' + ]); + ctx.componentInstance.age = 11; + ctx.detectChanges(false); + expect(renderLog.loggedValues).toEqual([ + 'a state:0', '10 state:0', 'mtv state:0', 'mtv state:0', '11 state:1' + ]); + })); + it('should call impure pipes on each change detection run', fakeAsync(() => { const ctx = _bindSimpleValue('name | countingImpurePipe', Person); ctx.componentInstance.name = 'bob'; diff --git a/packages/core/test/linker/ng_container_integration_spec.ts b/packages/core/test/linker/ng_container_integration_spec.ts index b0cf9c2e27..8d5a93a6e7 100644 --- a/packages/core/test/linker/ng_container_integration_spec.ts +++ b/packages/core/test/linker/ng_container_integration_spec.ts @@ -11,7 +11,7 @@ import {AfterContentInit, AfterViewInit, Component, ContentChildren, Directive, import {TestBed} 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, polyfillGoogGetMsg} from '@angular/private/testing'; +import {fixmeIvy, modifiedInIvy, polyfillGoogGetMsg} from '@angular/private/testing'; if (ivyEnabled) { describe('ivy', () => { declareTests(); }); @@ -52,7 +52,7 @@ function declareTests(config?: {useJit: boolean}) { expect(el).toHaveText('foo'); }); - fixmeIvy('FW-678: ivy generates different DOM structure for ') + modifiedInIvy('FW-678: ivy generates different DOM structure for ') .it('should be rendered as comment with children as siblings', () => { const template = '

'; TestBed.overrideComponent(MyComp, {set: {template}}); @@ -67,7 +67,7 @@ function declareTests(config?: {useJit: boolean}) { expect(getDOM().tagName(children[1]).toUpperCase()).toEqual('P'); }); - fixmeIvy('FW-678: ivy generates different DOM structure for ') + modifiedInIvy('FW-678: ivy generates different DOM structure for ') .it('should support nesting', () => { const template = '12'; @@ -86,7 +86,7 @@ function declareTests(config?: {useJit: boolean}) { expect(children[4]).toHaveText('2'); }); - fixmeIvy('FW-678: ivy generates different DOM structure for ') + modifiedInIvy('FW-678: ivy generates different DOM structure for ') .it('should group inner nodes', () => { const template = '

'; TestBed.overrideComponent(MyComp, {set: {template}});