77 dispatchMouseEvent ,
88 dispatchTouchEvent ,
99} from '@angular/cdk/testing/private' ;
10- import { Component , ViewChild , ViewEncapsulation } from '@angular/core' ;
10+ import { Component , Provider , ViewChild , ViewEncapsulation } from '@angular/core' ;
1111import { ComponentFixture , TestBed } from '@angular/core/testing' ;
12- import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
1312import {
1413 MAT_RIPPLE_GLOBAL_OPTIONS ,
1514 MatRipple ,
@@ -18,6 +17,7 @@ import {
1817 RippleGlobalOptions ,
1918 RippleState ,
2019} from './index' ;
20+ import { MATERIAL_ANIMATIONS } from '../animation/animation' ;
2121
2222describe ( 'MatRipple' , ( ) => {
2323 let fixture : ComponentFixture < any > ;
@@ -494,14 +494,17 @@ describe('MatRipple', () => {
494494 function createTestComponent (
495495 rippleConfig : RippleGlobalOptions ,
496496 testComponent : any = BasicRippleContainer ,
497- extraImports : any [ ] = [ ] ,
497+ extraProviders : Provider [ ] = [ ] ,
498498 ) {
499499 // Reset the previously configured testing module to be able set new providers.
500500 // The testing module has been initialized in the root describe group for the ripples.
501501 TestBed . resetTestingModule ( ) ;
502502 TestBed . configureTestingModule ( {
503- imports : [ MatRippleModule , ...extraImports , testComponent ] ,
504- providers : [ { provide : MAT_RIPPLE_GLOBAL_OPTIONS , useValue : rippleConfig } ] ,
503+ imports : [ MatRippleModule , testComponent ] ,
504+ providers : [
505+ { provide : MAT_RIPPLE_GLOBAL_OPTIONS , useValue : rippleConfig } ,
506+ ...extraProviders ,
507+ ] ,
505508 } ) ;
506509
507510 fixture = TestBed . createComponent ( testComponent ) ;
@@ -585,10 +588,12 @@ describe('MatRipple', () => {
585588 expect ( rippleTarget . querySelectorAll ( '.mat-ripple-element' ) . length ) . toBe ( 0 ) ;
586589 } ) ;
587590
588- it ( 'should not mutate the global options when NoopAnimationsModule is present ' , ( ) => {
591+ it ( 'should not mutate the global options when animations are disabled ' , ( ) => {
589592 const options : RippleGlobalOptions = { } ;
590593
591- createTestComponent ( options , RippleContainerWithoutBindings , [ NoopAnimationsModule ] ) ;
594+ createTestComponent ( options , RippleContainerWithoutBindings , [
595+ { provide : MATERIAL_ANIMATIONS , useValue : { animationsDisabled : true } } ,
596+ ] ) ;
592597
593598 expect ( options . animation ) . toBeFalsy ( ) ;
594599 } ) ;
@@ -600,7 +605,8 @@ describe('MatRipple', () => {
600605 beforeEach ( ( ) => {
601606 TestBed . resetTestingModule ( ) ;
602607 TestBed . configureTestingModule ( {
603- imports : [ NoopAnimationsModule , MatRippleModule , BasicRippleContainer ] ,
608+ imports : [ MatRippleModule , BasicRippleContainer ] ,
609+ providers : [ { provide : MATERIAL_ANIMATIONS , useValue : { animationsDisabled : true } } ] ,
604610 } ) ;
605611
606612 fixture = TestBed . createComponent ( BasicRippleContainer ) ;
0 commit comments