Skip to content

Commit aee5cbd

Browse files
karaAndrewKushnir
authored andcommitted
test(ivy): re-enable passing animation tests (#27997)
PR Close #27997
1 parent e9614ef commit aee5cbd

1 file changed

Lines changed: 62 additions & 66 deletions

File tree

‎packages/core/test/animation/animation_integration_spec.ts‎

Lines changed: 62 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -817,43 +817,40 @@ const DEFAULT_COMPONENT_ID = '1';
817817
});
818818

819819
describe('host bindings', () => {
820-
fixmeIvy('unknown').it(
821-
'should trigger a state change animation from state => state on the component host element',
822-
fakeAsync(() => {
823-
@Component({
824-
selector: 'my-cmp',
825-
template: '...',
826-
animations: [trigger(
827-
'myAnimation',
828-
[transition(
829-
'a => b',
830-
[style({'opacity': '0'}), animate(500, style({'opacity': '1'}))])])],
831-
})
832-
class Cmp {
833-
@HostBinding('@myAnimation')
834-
exp = 'a';
835-
}
820+
it('should trigger a state change animation from state => state on the component host element',
821+
fakeAsync(() => {
822+
@Component({
823+
selector: 'my-cmp',
824+
template: '...',
825+
animations: [trigger(
826+
'myAnimation',
827+
[transition(
828+
'a => b',
829+
[style({'opacity': '0'}), animate(500, style({'opacity': '1'}))])])],
830+
})
831+
class Cmp {
832+
@HostBinding('@myAnimation')
833+
exp = 'a';
834+
}
836835

837-
TestBed.configureTestingModule({declarations: [Cmp]});
836+
TestBed.configureTestingModule({declarations: [Cmp]});
838837

839-
const engine = TestBed.get(ɵAnimationEngine);
840-
const fixture = TestBed.createComponent(Cmp);
841-
const cmp = fixture.componentInstance;
842-
fixture.detectChanges();
843-
engine.flush();
844-
expect(getLog().length).toEqual(0);
838+
const engine = TestBed.get(ɵAnimationEngine);
839+
const fixture = TestBed.createComponent(Cmp);
840+
const cmp = fixture.componentInstance;
841+
fixture.detectChanges();
842+
engine.flush();
843+
expect(getLog().length).toEqual(0);
845844

846-
cmp.exp = 'b';
847-
fixture.detectChanges();
848-
engine.flush();
849-
expect(getLog().length).toEqual(1);
845+
cmp.exp = 'b';
846+
fixture.detectChanges();
847+
engine.flush();
848+
expect(getLog().length).toEqual(1);
850849

851-
const data = getLog().pop() !;
852-
expect(data.element).toEqual(fixture.elementRef.nativeElement);
853-
expect(data.keyframes).toEqual([
854-
{offset: 0, opacity: '0'}, {offset: 1, opacity: '1'}
855-
]);
856-
}));
850+
const data = getLog().pop() !;
851+
expect(data.element).toEqual(fixture.elementRef.nativeElement);
852+
expect(data.keyframes).toEqual([{offset: 0, opacity: '0'}, {offset: 1, opacity: '1'}]);
853+
}));
857854

858855
// nonAnimationRenderer => animationRenderer
859856
fixmeIvy('unknown').it(
@@ -2720,44 +2717,43 @@ const DEFAULT_COMPONENT_ID = '1';
27202717
expect(elm.innerText.trim()).toEqual('');
27212718
}));
27222719

2723-
fixmeIvy('unknown').it(
2724-
'should trigger a state change listener for when the animation changes state from void => state on the host element',
2725-
fakeAsync(() => {
2726-
@Component({
2727-
selector: 'my-cmp',
2728-
template: `...`,
2729-
animations: [trigger(
2730-
'myAnimation2',
2731-
[transition(
2732-
'void => *',
2733-
[style({'opacity': '0'}), animate(1000, style({'opacity': '1'}))])])],
2734-
})
2735-
class Cmp {
2736-
// TODO(issue/24571): remove '!'.
2737-
event !: AnimationEvent;
2720+
it('should trigger a state change listener for when the animation changes state from void => state on the host element',
2721+
fakeAsync(() => {
2722+
@Component({
2723+
selector: 'my-cmp',
2724+
template: `...`,
2725+
animations: [trigger(
2726+
'myAnimation2',
2727+
[transition(
2728+
'void => *',
2729+
[style({'opacity': '0'}), animate(1000, style({'opacity': '1'}))])])],
2730+
})
2731+
class Cmp {
2732+
// TODO(issue/24571): remove '!'.
2733+
event !: AnimationEvent;
27382734

2739-
@HostBinding('@myAnimation2')
2740-
exp: any = false;
2735+
@HostBinding('@myAnimation2')
2736+
exp: any = false;
27412737

2742-
@HostListener('@myAnimation2.start', ['$event'])
2743-
callback = (event: any) => { this.event = event; }
2744-
}
2738+
@HostListener('@myAnimation2.start', ['$event'])
2739+
callback = (event: any) => { this.event = event; }
2740+
}
27452741

2746-
TestBed.configureTestingModule({declarations: [Cmp]});
2742+
TestBed.configureTestingModule({declarations: [Cmp]});
27472743

2748-
const engine = TestBed.get(ɵAnimationEngine);
2749-
const fixture = TestBed.createComponent(Cmp);
2750-
const cmp = fixture.componentInstance;
2751-
cmp.exp = 'TRUE';
2752-
fixture.detectChanges();
2753-
flushMicrotasks();
2744+
const engine = TestBed.get(ɵAnimationEngine);
2745+
const fixture = TestBed.createComponent(Cmp);
2746+
const cmp = fixture.componentInstance;
2747+
cmp.exp = 'TRUE';
2748+
fixture.detectChanges();
2749+
flushMicrotasks();
27542750

2755-
expect(cmp.event.triggerName).toEqual('myAnimation2');
2756-
expect(cmp.event.phaseName).toEqual('start');
2757-
expect(cmp.event.totalTime).toEqual(1000);
2758-
expect(cmp.event.fromState).toEqual('void');
2759-
expect(cmp.event.toState).toEqual('TRUE');
2760-
}));
2751+
expect(cmp.event.triggerName).toEqual('myAnimation2');
2752+
expect(cmp.event.phaseName).toEqual('start');
2753+
expect(cmp.event.totalTime).toEqual(1000);
2754+
expect(cmp.event.fromState).toEqual('void');
2755+
expect(cmp.event.toState).toEqual('TRUE');
2756+
}));
27612757

27622758
it('should always fire callbacks even when a transition is not detected', fakeAsync(() => {
27632759
@Component({

0 commit comments

Comments
 (0)