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
This commit is contained in:
parent
c29d2a4f16
commit
84406e4d6d
|
@ -45,8 +45,8 @@ describe('exports', () => {
|
||||||
const fixture = initWithTemplate(
|
const fixture = initWithTemplate(
|
||||||
AppComp, '<div dir-on-change #myDir="dirOnChange" [in]="true"></div> {{ myDir.name }}');
|
AppComp, '<div dir-on-change #myDir="dirOnChange" [in]="true"></div> {{ myDir.name }}');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.nativeElement.innerHTML)
|
expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@'); // div element
|
||||||
.toEqual('<div dir-on-change="" ng-reflect-in="true" title="Drew!?@"></div> Drew!?@');
|
expect(fixture.nativeElement.lastChild.textContent).toContain('Drew!?@'); // text node
|
||||||
});
|
});
|
||||||
|
|
||||||
modifiedInIvy('Supporting input changes in hooks is limited in Ivy')
|
modifiedInIvy('Supporting input changes in hooks is limited in Ivy')
|
||||||
|
@ -55,8 +55,8 @@ describe('exports', () => {
|
||||||
AppComp,
|
AppComp,
|
||||||
'{{ myDir.name }} <div dir-on-change #myDir="dirOnChange" [in]="true"></div>');
|
'{{ myDir.name }} <div dir-on-change #myDir="dirOnChange" [in]="true"></div>');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.nativeElement.innerHTML)
|
expect(fixture.nativeElement.firstChild.textContent).toContain('Drew!?@'); // text node
|
||||||
.toEqual('Drew!?@ <div dir-on-change="" ng-reflect-in="true" title="Drew!?@"></div>');
|
expect(fixture.nativeElement.lastChild.title).toBe('Drew!?@'); // div element
|
||||||
});
|
});
|
||||||
|
|
||||||
onlyInIvy('Supporting input changes in hooks is limited in Ivy')
|
onlyInIvy('Supporting input changes in hooks is limited in Ivy')
|
||||||
|
@ -77,9 +77,8 @@ describe('exports', () => {
|
||||||
AppComp,
|
AppComp,
|
||||||
'<div dir-on-change #myDir="dirOnChange" [in]="true" [id]="myDir.name"></div>');
|
'<div dir-on-change #myDir="dirOnChange" [in]="true" [id]="myDir.name"></div>');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.nativeElement.innerHTML)
|
expect(fixture.nativeElement.firstChild.id).toBe('Drew!?@');
|
||||||
.toEqual(
|
expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@');
|
||||||
'<div dir-on-change="" ng-reflect-in="true" id="Drew!?@" title="Drew!?@"></div>');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onlyInIvy('Supporting input changes in hooks is limited in Ivy')
|
onlyInIvy('Supporting input changes in hooks is limited in Ivy')
|
||||||
|
@ -98,8 +97,7 @@ describe('exports', () => {
|
||||||
const fixture =
|
const fixture =
|
||||||
initWithTemplate(AppComp, '<div dir-on-change #myDir="dirOnChange" [in]="true"></div>');
|
initWithTemplate(AppComp, '<div dir-on-change #myDir="dirOnChange" [in]="true"></div>');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.nativeElement.innerHTML)
|
expect(fixture.nativeElement.firstChild.title).toBe('Drew!?@');
|
||||||
.toEqual('<div dir-on-change="" ng-reflect-in="true" title="Drew!?@"></div>');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue