Skip to content

Commit 3d6f19b

Browse files
committed
test: fix slide-toggle e2e failures
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 3d6f19b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import {expectToExist} from '../util/index';
55
describe('slide-toggle', () => {
66
const getInput = () => element(by.css('#normal-slide-toggle input'));
77
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+
};
811

912
beforeEach(() => browser.get('slide-toggle'));
1013

@@ -21,8 +24,7 @@ describe('slide-toggle', () => {
2124

2225
expect(inputEl.getAttribute('checked')).toBeTruthy('Expect slide-toggle to be checked');
2326

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())));
2628
});
2729

2830
it('should change the checked state on click', async () => {
@@ -33,8 +35,7 @@ describe('slide-toggle', () => {
3335
getNormalToggle().click();
3436

3537
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())));
3839
});
3940

4041
it('should not change the checked state on click when disabled', async () => {
@@ -45,8 +46,7 @@ describe('slide-toggle', () => {
4546
element(by.css('#disabled-slide-toggle')).click();
4647

4748
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())));
5050
});
5151

5252
it('should move the thumb on state change', async () => {
@@ -60,8 +60,7 @@ describe('slide-toggle', () => {
6060

6161
expect(position.x).not.toBe(previousPosition.x);
6262

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())));
6564
});
6665

6766
it('should toggle the slide-toggle on space key', () => {

0 commit comments

Comments
 (0)