1
- import { browser , element , by , Key , ExpectedConditions } from 'protractor' ;
1
+ import { browser , element , by , Key } from 'protractor' ;
2
2
import { expectToExist } from '../util/index' ;
3
3
4
4
@@ -13,59 +13,49 @@ describe('slide-toggle', () => {
13
13
} ) ;
14
14
15
15
it ( 'should change the checked state on click' , async ( ) => {
16
- let inputEl = getInput ( ) ;
16
+ const inputEl = getInput ( ) ;
17
17
18
18
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeFalsy ( 'Expect slide-toggle to be unchecked' ) ;
19
19
20
20
getNormalToggle ( ) . click ( ) ;
21
21
22
22
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeTruthy ( 'Expect slide-toggle to be checked' ) ;
23
-
24
- await browser . wait ( ExpectedConditions . not (
25
- ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) ) ;
26
23
} ) ;
27
24
28
25
it ( 'should change the checked state on click' , async ( ) => {
29
- let inputEl = getInput ( ) ;
26
+ const inputEl = getInput ( ) ;
30
27
31
28
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeFalsy ( 'Expect slide-toggle to be unchecked' ) ;
32
29
33
30
getNormalToggle ( ) . click ( ) ;
34
31
35
32
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
33
} ) ;
39
34
40
35
it ( 'should not change the checked state on click when disabled' , async ( ) => {
41
- let inputEl = getInput ( ) ;
36
+ const inputEl = getInput ( ) ;
42
37
43
38
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeFalsy ( 'Expect slide-toggle to be unchecked' ) ;
44
39
45
40
element ( by . css ( '#disabled-slide-toggle' ) ) . click ( ) ;
46
41
47
42
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' ) ) ) ) ) ;
50
43
} ) ;
51
44
52
45
it ( 'should move the thumb on state change' , async ( ) => {
53
- let slideToggleEl = getNormalToggle ( ) ;
54
- let thumbEl = element ( by . css ( '#normal-slide-toggle .mat-slide-toggle-thumb-container' ) ) ;
55
- let previousPosition = await thumbEl . getLocation ( ) ;
46
+ const slideToggleEl = getNormalToggle ( ) ;
47
+ const thumbEl = element ( by . css ( '#normal-slide-toggle .mat-slide-toggle-thumb-container' ) ) ;
48
+ const previousPosition = await thumbEl . getLocation ( ) ;
56
49
57
50
slideToggleEl . click ( ) ;
58
51
59
- let position = await thumbEl . getLocation ( ) ;
52
+ const position = await thumbEl . getLocation ( ) ;
60
53
61
54
expect ( position . x ) . not . toBe ( previousPosition . x ) ;
62
-
63
- await browser . wait ( ExpectedConditions . not (
64
- ExpectedConditions . presenceOf ( element ( by . css ( 'div.mat-ripple-element' ) ) ) ) ) ;
65
55
} ) ;
66
56
67
57
it ( 'should toggle the slide-toggle on space key' , ( ) => {
68
- let inputEl = getInput ( ) ;
58
+ const inputEl = getInput ( ) ;
69
59
70
60
expect ( inputEl . getAttribute ( 'checked' ) ) . toBeFalsy ( 'Expect slide-toggle to be unchecked' ) ;
71
61
0 commit comments