Skip to content

Commit

Permalink
fix(ivy): avoid innerHTML usage in exports test (to make it work in I…
Browse files Browse the repository at this point in the history
…E11) (#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
  • Loading branch information
AndrewKushnir committed Mar 6, 2019
1 parent c29d2a4 commit 84406e4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/core/test/acceptance/exports_spec.ts
Expand Up @@ -45,8 +45,8 @@ describe('exports', () => {
const fixture = initWithTemplate(
AppComp, '<div dir-on-change #myDir="dirOnChange" [in]="true"></div> {{ myDir.name }}');
fixture.detectChanges();
expect(fixture.nativeElement.innerHTML)
.toEqual('<div dir-on-change="" ng-reflect-in="true" title="Drew!?@"></div> 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')
Expand All @@ -55,8 +55,8 @@ describe('exports', () => {
AppComp,
'{{ myDir.name }} <div dir-on-change #myDir="dirOnChange" [in]="true"></div>');
fixture.detectChanges();
expect(fixture.nativeElement.innerHTML)
.toEqual('Drew!?@ <div dir-on-change="" ng-reflect-in="true" title="Drew!?@"></div>');
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')
Expand All @@ -77,9 +77,8 @@ describe('exports', () => {
AppComp,
'<div dir-on-change #myDir="dirOnChange" [in]="true" [id]="myDir.name"></div>');
fixture.detectChanges();
expect(fixture.nativeElement.innerHTML)
.toEqual(
'<div dir-on-change="" ng-reflect-in="true" id="Drew!?@" title="Drew!?@"></div>');
expect(fixture.nativeElement.firstChild.id).toBe('Drew!?@');
expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@');
});

onlyInIvy('Supporting input changes in hooks is limited in Ivy')
Expand All @@ -98,8 +97,7 @@ describe('exports', () => {
const fixture =
initWithTemplate(AppComp, '<div dir-on-change #myDir="dirOnChange" [in]="true"></div>');
fixture.detectChanges();
expect(fixture.nativeElement.innerHTML)
.toEqual('<div dir-on-change="" ng-reflect-in="true" title="Drew!?@"></div>');
expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@');
});
});

Expand Down

0 comments on commit 84406e4

Please sign in to comment.