Skip to content

Commit ac8339c

Browse files
crisbetommalerba
authored andcommitted
test: fix slide-toggle e2e failures (#12699)
Fixes some e2e failures in the slide toggle after the new design got in. The tests expect the ripples to go away at some point, however we introduced a permanent ripple.
1 parent b2247f8 commit ac8339c

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

e2e/components/slide-toggle-e2e.spec.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {browser, element, by, Key, ExpectedConditions} from 'protractor';
1+
import {browser, element, by, Key} from 'protractor';
22
import {expectToExist} from '../util/index';
33

44

@@ -13,59 +13,49 @@ describe('slide-toggle', () => {
1313
});
1414

1515
it('should change the checked state on click', async () => {
16-
let inputEl = getInput();
16+
const inputEl = getInput();
1717

1818
expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked');
1919

2020
getNormalToggle().click();
2121

2222
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')))));
2623
});
2724

2825
it('should change the checked state on click', async () => {
29-
let inputEl = getInput();
26+
const inputEl = getInput();
3027

3128
expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked');
3229

3330
getNormalToggle().click();
3431

3532
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')))));
3833
});
3934

4035
it('should not change the checked state on click when disabled', async () => {
41-
let inputEl = getInput();
36+
const inputEl = getInput();
4237

4338
expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked');
4439

4540
element(by.css('#disabled-slide-toggle')).click();
4641

4742
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')))));
5043
});
5144

5245
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();
5649

5750
slideToggleEl.click();
5851

59-
let position = await thumbEl.getLocation();
52+
const position = await thumbEl.getLocation();
6053

6154
expect(position.x).not.toBe(previousPosition.x);
62-
63-
await browser.wait(ExpectedConditions.not(
64-
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))));
6555
});
6656

6757
it('should toggle the slide-toggle on space key', () => {
68-
let inputEl = getInput();
58+
const inputEl = getInput();
6959

7060
expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked');
7161

0 commit comments

Comments
 (0)