@@ -5,6 +5,9 @@ import {expectToExist} from '../util/index';
5
5
describe ( 'slide-toggle' , ( ) => {
6
6
const getInput = ( ) => element ( by . css ( '#normal-slide-toggle input' ) ) ;
7
7
const getNormalToggle = ( ) => element ( by . css ( '#normal-slide-toggle' ) ) ;
8
+ const getTransientRipple = ( ) => {
9
+ return element ( by . css ( 'div.mat-ripple-element:not(.mat-slide-toggle-persistent-ripple)' ) ) ;
10
+ } ;
8
11
9
12
beforeEach ( ( ) => browser . get ( 'slide-toggle' ) ) ;
10
13
@@ -21,8 +24,7 @@ describe('slide-toggle', () => {
21
24
22
25
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeTruthy ( 'Expect slide-toggle to be checked' ) ;
23
26
24
- await browser . wait ( ExpectedConditions . not (
25
- ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) ) ;
27
+ await browser . wait ( ExpectedConditions . not ( ExpectedConditions . presenceOf ( getTransientRipple ( ) ) ) ) ;
26
28
} ) ;
27
29
28
30
it ( 'should change the checked state on click' , async ( ) => {
@@ -33,8 +35,7 @@ describe('slide-toggle', () => {
33
35
getNormalToggle ( ) . click ( ) ;
34
36
35
37
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeTruthy ( 'Expect slide-toggle to be checked' ) ;
36
- await browser . wait ( ExpectedConditions . not (
37
- ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) ) ;
38
+ await browser . wait ( ExpectedConditions . not ( ExpectedConditions . presenceOf ( getTransientRipple ( ) ) ) ) ;
38
39
} ) ;
39
40
40
41
it ( 'should not change the checked state on click when disabled' , async ( ) => {
@@ -45,8 +46,7 @@ describe('slide-toggle', () => {
45
46
element ( by . css ( '#disabled-slide-toggle' ) ) . click ( ) ;
46
47
47
48
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeFalsy ( 'Expect slide-toggle to be unchecked' ) ;
48
- await browser . wait ( ExpectedConditions . not (
49
- ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) ) ;
49
+ await browser . wait ( ExpectedConditions . not ( ExpectedConditions . presenceOf ( getTransientRipple ( ) ) ) ) ;
50
50
} ) ;
51
51
52
52
it ( 'should move the thumb on state change' , async ( ) => {
@@ -60,8 +60,7 @@ describe('slide-toggle', () => {
60
60
61
61
expect ( position . x ) . not . toBe ( previousPosition . x ) ;
62
62
63
- await browser . wait ( ExpectedConditions . not (
64
- ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) ) ;
63
+ await browser . wait ( ExpectedConditions . not ( ExpectedConditions . presenceOf ( getTransientRipple ( ) ) ) ) ;
65
64
} ) ;
66
65
67
66
it ( 'should toggle the slide-toggle on space key' , ( ) => {
0 commit comments