@@ -3,6 +3,7 @@ import {BACKSPACE, DELETE, SPACE} from '@angular/cdk/keycodes';
3
3
import { createKeyboardEvent , dispatchFakeEvent } from '@angular/cdk/testing' ;
4
4
import { Component , DebugElement } from '@angular/core' ;
5
5
import { async , ComponentFixture , TestBed } from '@angular/core/testing' ;
6
+ import { MAT_RIPPLE_GLOBAL_OPTIONS , RippleGlobalOptions } from '@angular/material/core' ;
6
7
import { By } from '@angular/platform-browser' ;
7
8
import { Subject } from 'rxjs' ;
8
9
import { MatChip , MatChipEvent , MatChipSelectionChange , MatChipsModule } from './index' ;
@@ -13,19 +14,22 @@ describe('Chips', () => {
13
14
let chipDebugElement : DebugElement ;
14
15
let chipNativeElement : HTMLElement ;
15
16
let chipInstance : MatChip ;
17
+ let globalRippleOptions : RippleGlobalOptions ;
16
18
17
19
let dir = 'ltr' ;
18
20
19
21
beforeEach ( async ( ( ) => {
22
+ globalRippleOptions = { } ;
20
23
TestBed . configureTestingModule ( {
21
24
imports : [ MatChipsModule ] ,
22
25
declarations : [ BasicChip , SingleChip ] ,
23
- providers : [ {
24
- provide : Directionality , useFactory : ( ) => ( {
26
+ providers : [
27
+ { provide : MAT_RIPPLE_GLOBAL_OPTIONS , useFactory : ( ) => globalRippleOptions } ,
28
+ { provide : Directionality , useFactory : ( ) => ( {
25
29
value : dir ,
26
30
change : new Subject ( )
27
- } )
28
- } ]
31
+ } ) } ,
32
+ ]
29
33
} ) ;
30
34
31
35
TestBed . compileComponents ( ) ;
@@ -203,6 +207,13 @@ describe('Chips', () => {
203
207
subscription . unsubscribe ( ) ;
204
208
} ) ;
205
209
210
+ it ( 'should be able to disable ripples through ripple global options at runtime' , ( ) => {
211
+ expect ( chipInstance . rippleDisabled ) . toBe ( false , 'Expected chip ripples to be enabled.' ) ;
212
+
213
+ globalRippleOptions . disabled = true ;
214
+
215
+ expect ( chipInstance . rippleDisabled ) . toBe ( true , 'Expected chip ripples to be disabled.' ) ;
216
+ } ) ;
206
217
} ) ;
207
218
208
219
describe ( 'keyboard behavior' , ( ) => {
0 commit comments