@@ -374,7 +374,6 @@ describe('Animation', () => {
374374 it ( 'should be host bindable' , fakeAsync ( ( ) => {
375375 @Component ( {
376376 selector : 'fade-cmp' ,
377- styles : styles ,
378377 host : { 'animate.leave' : 'fade' } ,
379378 template : '<p>I should fade</p>' ,
380379 encapsulation : ViewEncapsulation . None ,
@@ -383,6 +382,7 @@ describe('Animation', () => {
383382
384383 @Component ( {
385384 selector : 'test-cmp' ,
385+ styles : styles ,
386386 imports : [ FadeComponent ] ,
387387 template : '@if (show()) { <fade-cmp /> }' ,
388388 encapsulation : ViewEncapsulation . None ,
@@ -400,6 +400,7 @@ describe('Animation', () => {
400400 expect ( fixture . nativeElement . outerHTML ) . not . toContain ( 'class="fade"' ) ;
401401 cmp . show . set ( false ) ;
402402 fixture . detectChanges ( ) ;
403+ tickAnimationFrames ( 1 ) ;
403404 expect ( cmp . show ( ) ) . toBeFalsy ( ) ;
404405 expect ( fixture . nativeElement . outerHTML ) . toContain ( 'class="fade"' ) ;
405406 fixture . detectChanges ( ) ;
@@ -413,7 +414,6 @@ describe('Animation', () => {
413414 it ( 'should be host bindable with brackets' , fakeAsync ( ( ) => {
414415 @Component ( {
415416 selector : 'fade-cmp' ,
416- styles : styles ,
417417 host : { '[animate.leave]' : 'fade()' } ,
418418 template : '<p>I should fade</p>' ,
419419 encapsulation : ViewEncapsulation . None ,
@@ -424,6 +424,7 @@ describe('Animation', () => {
424424
425425 @Component ( {
426426 selector : 'test-cmp' ,
427+ styles : styles ,
427428 imports : [ FadeComponent ] ,
428429 template : '@if (show()) { <fade-cmp /> }' ,
429430 encapsulation : ViewEncapsulation . None ,
@@ -441,6 +442,7 @@ describe('Animation', () => {
441442 expect ( fixture . nativeElement . outerHTML ) . not . toContain ( 'class="fade"' ) ;
442443 cmp . show . set ( false ) ;
443444 fixture . detectChanges ( ) ;
445+ tickAnimationFrames ( 1 ) ;
444446 expect ( cmp . show ( ) ) . toBeFalsy ( ) ;
445447 expect ( fixture . nativeElement . outerHTML ) . toContain ( 'class="fade"' ) ;
446448 fixture . detectChanges ( ) ;
@@ -519,7 +521,6 @@ describe('Animation', () => {
519521 ` ;
520522 @Component ( {
521523 selector : 'child-cmp' ,
522- styles : multiple ,
523524 host : { '[animate.leave]' : 'slide()' } ,
524525 template : '<p>I should fade</p>' ,
525526 encapsulation : ViewEncapsulation . None ,
@@ -670,7 +671,6 @@ describe('Animation', () => {
670671 ` ;
671672 @Component ( {
672673 selector : 'child-cmp' ,
673- styles : multiple ,
674674 host : { 'animate.leave' : 'slide-out' } ,
675675 template : '<p>I should fade</p>' ,
676676 encapsulation : ViewEncapsulation . None ,
@@ -1202,11 +1202,20 @@ describe('Animation', () => {
12021202 } ) ) ;
12031203
12041204 it ( 'should be host bindable' , fakeAsync ( ( ) => {
1205+ @Component ( {
1206+ selector : 'child-cmp' ,
1207+ host : { 'animate.enter' : 'slide-in' } ,
1208+ template : '<p>I should fade</p>' ,
1209+ encapsulation : ViewEncapsulation . None ,
1210+ } )
1211+ class ChildComponent { }
1212+
12051213 @Component ( {
12061214 selector : 'test-cmp' ,
12071215 styles : styles ,
1216+ imports : [ ChildComponent ] ,
12081217 host : { 'animate.enter' : 'slide-in' } ,
1209- template : '<p>I should fade</p >' ,
1218+ template : '<child-cmp / >' ,
12101219 encapsulation : ViewEncapsulation . None ,
12111220 } )
12121221 class TestComponent { }
@@ -1227,15 +1236,23 @@ describe('Animation', () => {
12271236
12281237 it ( 'should be host bindable with brackets' , fakeAsync ( ( ) => {
12291238 @Component ( {
1230- selector : 'test-cmp' ,
1231- styles : styles ,
1239+ selector : 'child-cmp' ,
12321240 host : { '[animate.enter]' : 'slideIn()' } ,
12331241 template : '<p>I should fade</p>' ,
12341242 encapsulation : ViewEncapsulation . None ,
12351243 } )
1236- class TestComponent {
1244+ class ChildComponent {
12371245 slideIn = signal ( 'slide-in' ) ;
12381246 }
1247+
1248+ @Component ( {
1249+ selector : 'test-cmp' ,
1250+ styles : styles ,
1251+ imports : [ ChildComponent ] ,
1252+ template : '<child-cmp />' ,
1253+ encapsulation : ViewEncapsulation . None ,
1254+ } )
1255+ class TestComponent { }
12391256 TestBed . configureTestingModule ( { animationsEnabled : true } ) ;
12401257
12411258 const fixture = TestBed . createComponent ( TestComponent ) ;
@@ -1254,12 +1271,26 @@ describe('Animation', () => {
12541271 it ( 'should be host bindable with events' , fakeAsync ( ( ) => {
12551272 const slideInCalled = jasmine . createSpy ( 'slideInCalled' ) ;
12561273 @Component ( {
1257- selector : 'test-cmp' ,
1258- styles : styles ,
1274+ selector : 'child-cmp' ,
12591275 host : { '(animate.enter)' : 'slideIn($event)' } ,
12601276 template : '<p>I should fade</p>' ,
12611277 encapsulation : ViewEncapsulation . None ,
12621278 } )
1279+ class ChildComponent {
1280+ slideIn ( event : AnimationCallbackEvent ) {
1281+ slideInCalled ( ) ;
1282+ event . target . classList . add ( 'slide-in' ) ;
1283+ event . animationComplete ( ) ;
1284+ }
1285+ }
1286+
1287+ @Component ( {
1288+ selector : 'test-cmp' ,
1289+ styles : styles ,
1290+ imports : [ ChildComponent ] ,
1291+ template : '<child-cmp />' ,
1292+ encapsulation : ViewEncapsulation . None ,
1293+ } )
12631294 class TestComponent {
12641295 slideIn ( event : AnimationCallbackEvent ) {
12651296 slideInCalled ( ) ;
@@ -1277,7 +1308,6 @@ describe('Animation', () => {
12771308 it ( 'should compose class list when host binding and regular binding' , fakeAsync ( ( ) => {
12781309 @Component ( {
12791310 selector : 'child-cmp' ,
1280- styles : styles ,
12811311 host : { '[animate.enter]' : 'clazz' } ,
12821312 template : '<p>I should fade</p>' ,
12831313 encapsulation : ViewEncapsulation . None ,
@@ -1320,7 +1350,6 @@ describe('Animation', () => {
13201350 it ( 'should compose class list when host binding a string and regular class strings' , fakeAsync ( ( ) => {
13211351 @Component ( {
13221352 selector : 'child-cmp' ,
1323- styles : styles ,
13241353 host : { 'animate.enter' : 'slide-in' } ,
13251354 template : '<p>I should fade</p>' ,
13261355 encapsulation : ViewEncapsulation . None ,
0 commit comments