From 84406e4d6d93b28b23efbb1701bc5ae1084da67b Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Tue, 5 Mar 2019 20:30:29 -0800 Subject: [PATCH] fix(ivy): avoid innerHTML usage in exports test (to make it work in IE11) (#29127) Some tests in exports spec rely on the exact output of innerHTML. In IE11 the order of attributes might change, thus causing tests to fail (in case an element contains more than one attribute). This commit avoids innerHTML usage and performs the necessary checks via element properties. PR Close #29127 --- packages/core/test/acceptance/exports_spec.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/core/test/acceptance/exports_spec.ts b/packages/core/test/acceptance/exports_spec.ts index 4d6feb609c578..690f47194bcb3 100644 --- a/packages/core/test/acceptance/exports_spec.ts +++ b/packages/core/test/acceptance/exports_spec.ts @@ -45,8 +45,8 @@ describe('exports', () => { const fixture = initWithTemplate( AppComp, '
{{ myDir.name }}'); fixture.detectChanges(); - expect(fixture.nativeElement.innerHTML) - .toEqual('
Drew!?@'); + expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@'); // div element + expect(fixture.nativeElement.lastChild.textContent).toContain('Drew!?@'); // text node }); modifiedInIvy('Supporting input changes in hooks is limited in Ivy') @@ -55,8 +55,8 @@ describe('exports', () => { AppComp, '{{ myDir.name }}
'); fixture.detectChanges(); - expect(fixture.nativeElement.innerHTML) - .toEqual('Drew!?@
'); + expect(fixture.nativeElement.firstChild.textContent).toContain('Drew!?@'); // text node + expect(fixture.nativeElement.lastChild.title).toBe('Drew!?@'); // div element }); onlyInIvy('Supporting input changes in hooks is limited in Ivy') @@ -77,9 +77,8 @@ describe('exports', () => { AppComp, '
'); fixture.detectChanges(); - expect(fixture.nativeElement.innerHTML) - .toEqual( - '
'); + expect(fixture.nativeElement.firstChild.id).toBe('Drew!?@'); + expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@'); }); onlyInIvy('Supporting input changes in hooks is limited in Ivy') @@ -98,8 +97,7 @@ describe('exports', () => { const fixture = initWithTemplate(AppComp, '
'); fixture.detectChanges(); - expect(fixture.nativeElement.innerHTML) - .toEqual('
'); + expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@'); }); });