8
8
import { AUTO_STYLE , AnimationEvent , AnimationOptions , AnimationPlayer , NoopAnimationPlayer , animate , animateChild , group , keyframes , query , state , style , transition , trigger , ɵPRE_STYLE as PRE_STYLE } from '@angular/animations' ;
9
9
import { AnimationDriver , ɵAnimationEngine , ɵNoopAnimationDriver as NoopAnimationDriver } from '@angular/animations/browser' ;
10
10
import { MockAnimationDriver , MockAnimationPlayer } from '@angular/animations/browser/testing' ;
11
- import { ChangeDetectorRef , Component , HostBinding , HostListener , RendererFactory2 , ViewChild } from '@angular/core' ;
11
+ import { ChangeDetectorRef , Component , HostBinding , HostListener , Inject , RendererFactory2 , ViewChild } from '@angular/core' ;
12
12
import { ɵDomRendererFactory2 } from '@angular/platform-browser' ;
13
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ;
13
+ import { ANIMATION_MODULE_TYPE , BrowserAnimationsModule , NoopAnimationsModule } from '@angular/platform-browser/animations' ;
14
14
import { getDOM } from '@angular/platform-browser/src/dom/dom_adapter' ;
15
15
16
16
import { TestBed , fakeAsync , flushMicrotasks } from '../../testing' ;
@@ -37,6 +37,34 @@ const DEFAULT_COMPONENT_ID = '1';
37
37
} ) ;
38
38
} ) ;
39
39
40
+ describe ( 'animation modules' , function ( ) {
41
+ it ( 'should hint at BrowserAnimationsModule being used' , ( ) => {
42
+ TestBed . resetTestingModule ( ) ;
43
+ TestBed . configureTestingModule (
44
+ { declarations : [ SharedAnimationCmp ] , imports : [ BrowserAnimationsModule ] } ) ;
45
+
46
+ const fixture = TestBed . createComponent ( SharedAnimationCmp ) ;
47
+ const cmp = fixture . componentInstance ;
48
+ expect ( cmp . animationType ) . toEqual ( 'BrowserAnimations' ) ;
49
+ } ) ;
50
+
51
+ it ( 'should hint at NoopAnimationsModule being used' , ( ) => {
52
+ TestBed . resetTestingModule ( ) ;
53
+ TestBed . configureTestingModule (
54
+ { declarations : [ SharedAnimationCmp ] , imports : [ NoopAnimationsModule ] } ) ;
55
+
56
+ const fixture = TestBed . createComponent ( SharedAnimationCmp ) ;
57
+ const cmp = fixture . componentInstance ;
58
+ expect ( cmp . animationType ) . toEqual ( 'NoopAnimations' ) ;
59
+ } ) ;
60
+ } ) ;
61
+
62
+ @Component ( { template : '<p>template text</p>' } )
63
+ class SharedAnimationCmp {
64
+ constructor ( @Inject ( ANIMATION_MODULE_TYPE ) public animationType : 'NoopAnimations' |
65
+ 'BrowserAnimations' ) { }
66
+ }
67
+
40
68
describe ( 'fakeAsync testing' , ( ) => {
41
69
it ( 'should only require one flushMicrotasks call to kick off animation callbacks' ,
42
70
fakeAsync ( ( ) => {
0 commit comments