@@ -3,7 +3,6 @@ import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/f
33import { Component , DebugElement , ViewChild } from '@angular/core' ;
44import { By } from '@angular/platform-browser' ;
55import { dispatchFakeEvent } from '@angular/cdk/testing' ;
6- import { defaultRippleAnimationConfig } from '@angular/material/core' ;
76import { MatRadioButton , MatRadioChange , MatRadioGroup , MatRadioModule } from './index' ;
87
98describe ( 'MatRadio' , ( ) => {
@@ -197,25 +196,6 @@ describe('MatRadio', () => {
197196 expect ( changeSpy ) . toHaveBeenCalledTimes ( 1 ) ;
198197 } ) ;
199198
200- it ( 'should show a ripple when focusing via the keyboard' , fakeAsync ( ( ) => {
201- expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length )
202- . toBe ( 0 , 'Expected no ripples on init.' ) ;
203-
204- dispatchFakeEvent ( radioInputElements [ 0 ] , 'keydown' ) ;
205- dispatchFakeEvent ( radioInputElements [ 0 ] , 'focus' ) ;
206-
207- tick ( defaultRippleAnimationConfig . enterDuration ) ;
208-
209- expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length )
210- . toBe ( 1 , 'Expected one ripple after keyboard focus.' ) ;
211-
212- dispatchFakeEvent ( radioInputElements [ 0 ] , 'blur' ) ;
213- tick ( defaultRippleAnimationConfig . exitDuration ) ;
214-
215- expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length )
216- . toBe ( 0 , 'Expected no ripples on blur.' ) ;
217- } ) ) ;
218-
219199 it ( 'should update the group and radios when updating the group value' , ( ) => {
220200 expect ( groupInstance . value ) . toBeFalsy ( ) ;
221201
@@ -253,16 +233,21 @@ describe('MatRadio', () => {
253233 dispatchFakeEvent ( radioLabelElements [ 0 ] , 'mousedown' ) ;
254234 dispatchFakeEvent ( radioLabelElements [ 0 ] , 'mouseup' ) ;
255235
256- expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length )
257- . toBe ( 0 , 'Expected a disabled radio button to not show ripples' ) ;
236+ let rippleAmount = radioNativeElements [ 0 ]
237+ . querySelectorAll ( '.mat-ripple-element:not(.mat-radio-persistent-ripple)' ) . length ;
238+
239+ expect ( rippleAmount ) . toBe ( 0 , 'Expected a disabled radio button to not show ripples' ) ;
258240
259241 testComponent . isFirstDisabled = false ;
260242 fixture . detectChanges ( ) ;
261243
262244 dispatchFakeEvent ( radioLabelElements [ 0 ] , 'mousedown' ) ;
263245 dispatchFakeEvent ( radioLabelElements [ 0 ] , 'mouseup' ) ;
264246
265- expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length )
247+ rippleAmount = radioNativeElements [ 0 ]
248+ . querySelectorAll ( '.mat-ripple-element:not(.mat-radio-persistent-ripple)' ) . length ;
249+
250+ expect ( rippleAmount )
266251 . toBe ( 1 , 'Expected an enabled radio button to show ripples' ) ;
267252 } ) ;
268253
@@ -274,7 +259,10 @@ describe('MatRadio', () => {
274259 dispatchFakeEvent ( radioLabel , 'mousedown' ) ;
275260 dispatchFakeEvent ( radioLabel , 'mouseup' ) ;
276261
277- expect ( radioLabel . querySelectorAll ( '.mat-ripple-element' ) . length ) . toBe ( 0 ) ;
262+ const rippleAmount = radioNativeElements [ 0 ]
263+ . querySelectorAll ( '.mat-ripple-element:not(.mat-radio-persistent-ripple)' ) . length ;
264+
265+ expect ( rippleAmount ) . toBe ( 0 ) ;
278266 }
279267
280268 testComponent . disableRipple = false ;
@@ -284,7 +272,10 @@ describe('MatRadio', () => {
284272 dispatchFakeEvent ( radioLabel , 'mousedown' ) ;
285273 dispatchFakeEvent ( radioLabel , 'mouseup' ) ;
286274
287- expect ( radioLabel . querySelectorAll ( '.mat-ripple-element' ) . length ) . toBe ( 1 ) ;
275+ const rippleAmount = radioNativeElements [ 0 ]
276+ . querySelectorAll ( '.mat-ripple-element:not(.mat-radio-persistent-ripple)' ) . length ;
277+
278+ expect ( rippleAmount ) . toBe ( 1 ) ;
288279 }
289280 } ) ;
290281
0 commit comments