fix(ivy): fix fixmeIvy invocations in "platform-browser" tests (#27498)
Some "platform-browser" tests were updated before `fixmeIvy` function contract was changed to `fixmeIvy(...).it(...)`, thus triggering failed tests to run on CI. This commit updates these cases to invoke `fixmeIvy` correctly. PR Close #27498
This commit is contained in:
parent
f514ac3da2
commit
a315dedb85
|
@ -121,8 +121,8 @@ import {el} from '../../testing/src/browser_util';
|
||||||
if (isNode) return;
|
if (isNode) return;
|
||||||
|
|
||||||
fixmeIvy(
|
fixmeIvy(
|
||||||
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`) &&
|
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`)
|
||||||
it('should flush and fire callbacks when the zone becomes stable', (async) => {
|
.it('should flush and fire callbacks when the zone becomes stable', (async) => {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-cmp',
|
selector: 'my-cmp',
|
||||||
template: '<div [@myAnimation]="exp" (@myAnimation.start)="onStart($event)"></div>',
|
template: '<div [@myAnimation]="exp" (@myAnimation.start)="onStart($event)"></div>',
|
||||||
|
@ -198,76 +198,76 @@ import {el} from '../../testing/src/browser_util';
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy(
|
fixmeIvy(
|
||||||
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`) &&
|
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`)
|
||||||
it('should only queue up dom removals if the element itself contains a valid leave animation',
|
.it('should only queue up dom removals if the element itself contains a valid leave animation',
|
||||||
() => {
|
() => {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-cmp',
|
selector: 'my-cmp',
|
||||||
template: `
|
template: `
|
||||||
<div #elm1 *ngIf="exp1"></div>
|
<div #elm1 *ngIf="exp1"></div>
|
||||||
<div #elm2 @animation1 *ngIf="exp2"></div>
|
<div #elm2 @animation1 *ngIf="exp2"></div>
|
||||||
<div #elm3 @animation2 *ngIf="exp3"></div>
|
<div #elm3 @animation2 *ngIf="exp3"></div>
|
||||||
`,
|
`,
|
||||||
animations: [
|
animations: [
|
||||||
trigger('animation1', [transition('a => b', [])]),
|
trigger('animation1', [transition('a => b', [])]),
|
||||||
trigger('animation2', [transition(':leave', [])]),
|
trigger('animation2', [transition(':leave', [])]),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
class Cmp {
|
class Cmp {
|
||||||
exp1: any = true;
|
exp1: any = true;
|
||||||
exp2: any = true;
|
exp2: any = true;
|
||||||
exp3: any = true;
|
exp3: any = true;
|
||||||
|
|
||||||
@ViewChild('elm1') public elm1: any;
|
@ViewChild('elm1') public elm1: any;
|
||||||
|
|
||||||
@ViewChild('elm2') public elm2: any;
|
@ViewChild('elm2') public elm2: any;
|
||||||
|
|
||||||
@ViewChild('elm3') public elm3: any;
|
@ViewChild('elm3') public elm3: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [{provide: AnimationEngine, useClass: InjectableAnimationEngine}],
|
providers: [{provide: AnimationEngine, useClass: InjectableAnimationEngine}],
|
||||||
declarations: [Cmp]
|
declarations: [Cmp]
|
||||||
});
|
});
|
||||||
|
|
||||||
const engine = TestBed.get(AnimationEngine);
|
const engine = TestBed.get(AnimationEngine);
|
||||||
const fixture = TestBed.createComponent(Cmp);
|
const fixture = TestBed.createComponent(Cmp);
|
||||||
const cmp = fixture.componentInstance;
|
const cmp = fixture.componentInstance;
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const elm1 = cmp.elm1;
|
const elm1 = cmp.elm1;
|
||||||
const elm2 = cmp.elm2;
|
const elm2 = cmp.elm2;
|
||||||
const elm3 = cmp.elm3;
|
const elm3 = cmp.elm3;
|
||||||
assertHasParent(elm1);
|
assertHasParent(elm1);
|
||||||
assertHasParent(elm2);
|
assertHasParent(elm2);
|
||||||
assertHasParent(elm3);
|
assertHasParent(elm3);
|
||||||
engine.flush();
|
engine.flush();
|
||||||
finishPlayers(engine.players);
|
finishPlayers(engine.players);
|
||||||
|
|
||||||
cmp.exp1 = false;
|
cmp.exp1 = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
assertHasParent(elm1, false);
|
assertHasParent(elm1, false);
|
||||||
assertHasParent(elm2);
|
assertHasParent(elm2);
|
||||||
assertHasParent(elm3);
|
assertHasParent(elm3);
|
||||||
engine.flush();
|
engine.flush();
|
||||||
expect(engine.players.length).toEqual(0);
|
expect(engine.players.length).toEqual(0);
|
||||||
|
|
||||||
cmp.exp2 = false;
|
cmp.exp2 = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
assertHasParent(elm1, false);
|
assertHasParent(elm1, false);
|
||||||
assertHasParent(elm2, false);
|
assertHasParent(elm2, false);
|
||||||
assertHasParent(elm3);
|
assertHasParent(elm3);
|
||||||
engine.flush();
|
engine.flush();
|
||||||
expect(engine.players.length).toEqual(0);
|
expect(engine.players.length).toEqual(0);
|
||||||
|
|
||||||
cmp.exp3 = false;
|
cmp.exp3 = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
assertHasParent(elm1, false);
|
assertHasParent(elm1, false);
|
||||||
assertHasParent(elm2, false);
|
assertHasParent(elm2, false);
|
||||||
assertHasParent(elm3);
|
assertHasParent(elm3);
|
||||||
engine.flush();
|
engine.flush();
|
||||||
expect(engine.players.length).toEqual(1);
|
expect(engine.players.length).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -284,8 +284,8 @@ import {el} from '../../testing/src/browser_util';
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy(
|
fixmeIvy(
|
||||||
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`) &&
|
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`)
|
||||||
it('should provide hooks at the start and end of change detection', () => {
|
.it('should provide hooks at the start and end of change detection', () => {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-cmp',
|
selector: 'my-cmp',
|
||||||
template: `
|
template: `
|
||||||
|
|
|
@ -20,8 +20,8 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||||
|
|
||||||
// TODO: remove the dummy test above ^ once the bug FW-643 has been fixed
|
// TODO: remove the dummy test above ^ once the bug FW-643 has been fixed
|
||||||
fixmeIvy(
|
fixmeIvy(
|
||||||
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`) &&
|
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`)
|
||||||
it('should flush and fire callbacks when the zone becomes stable', (async) => {
|
.it('should flush and fire callbacks when the zone becomes stable', (async) => {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-cmp',
|
selector: 'my-cmp',
|
||||||
template:
|
template:
|
||||||
|
@ -56,50 +56,50 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy(
|
fixmeIvy(
|
||||||
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`) &&
|
`FW-643: Components with animations throw with "Failed to execute 'setAttribute' on 'Element'`)
|
||||||
it('should handle leave animation callbacks even if the element is destroyed in the process',
|
.it('should handle leave animation callbacks even if the element is destroyed in the process',
|
||||||
(async) => {
|
(async) => {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-cmp',
|
selector: 'my-cmp',
|
||||||
template:
|
template:
|
||||||
'<div *ngIf="exp" @myAnimation (@myAnimation.start)="onStart($event)" (@myAnimation.done)="onDone($event)"></div>',
|
'<div *ngIf="exp" @myAnimation (@myAnimation.start)="onStart($event)" (@myAnimation.done)="onDone($event)"></div>',
|
||||||
animations: [trigger(
|
animations: [trigger(
|
||||||
'myAnimation',
|
'myAnimation',
|
||||||
[transition(
|
[transition(
|
||||||
':leave',
|
':leave',
|
||||||
[style({'opacity': '0'}), animate(500, style({'opacity': '1'}))])])],
|
[style({'opacity': '0'}), animate(500, style({'opacity': '1'}))])])],
|
||||||
})
|
})
|
||||||
class Cmp {
|
class Cmp {
|
||||||
exp: any;
|
exp: any;
|
||||||
startEvent: any;
|
startEvent: any;
|
||||||
doneEvent: any;
|
doneEvent: any;
|
||||||
onStart(event: any) { this.startEvent = event; }
|
onStart(event: any) { this.startEvent = event; }
|
||||||
onDone(event: any) { this.doneEvent = event; }
|
onDone(event: any) { this.doneEvent = event; }
|
||||||
}
|
}
|
||||||
|
|
||||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||||
const engine = TestBed.get(ɵAnimationEngine);
|
const engine = TestBed.get(ɵAnimationEngine);
|
||||||
const fixture = TestBed.createComponent(Cmp);
|
const fixture = TestBed.createComponent(Cmp);
|
||||||
const cmp = fixture.componentInstance;
|
const cmp = fixture.componentInstance;
|
||||||
|
|
||||||
cmp.exp = true;
|
cmp.exp = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
cmp.startEvent = null;
|
cmp.startEvent = null;
|
||||||
cmp.doneEvent = null;
|
cmp.doneEvent = null;
|
||||||
|
|
||||||
cmp.exp = false;
|
cmp.exp = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
expect(cmp.startEvent.triggerName).toEqual('myAnimation');
|
expect(cmp.startEvent.triggerName).toEqual('myAnimation');
|
||||||
expect(cmp.startEvent.phaseName).toEqual('start');
|
expect(cmp.startEvent.phaseName).toEqual('start');
|
||||||
expect(cmp.startEvent.toState).toEqual('void');
|
expect(cmp.startEvent.toState).toEqual('void');
|
||||||
expect(cmp.doneEvent.triggerName).toEqual('myAnimation');
|
expect(cmp.doneEvent.triggerName).toEqual('myAnimation');
|
||||||
expect(cmp.doneEvent.phaseName).toEqual('done');
|
expect(cmp.doneEvent.phaseName).toEqual('done');
|
||||||
expect(cmp.doneEvent.toState).toEqual('void');
|
expect(cmp.doneEvent.toState).toEqual('void');
|
||||||
async();
|
async();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue