Skip to content

Commit f6c4aee

Browse files
committed
test(item-sliding): cleanup
1 parent b1df2e2 commit f6c4aee

5 files changed

Lines changed: 23 additions & 23 deletions

File tree

core/src/components/item-sliding/test/basic/item-sliding.e2e.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { configs, dragElementBy, test } from '@utils/test/playwright';
55
* Drag distances that reveal options without crossing the full swipe threshold
66
* (optsWidth + SWIPE_MARGIN). A narrower options panel requires a shorter drag.
77
*/
8-
const DRAG_DISTANCE_ONE_OPTION = 100;
9-
const DRAG_DISTANCE_TWO_OPTIONS = 150;
8+
const DRAG_DISTANCE_SINGLE_OPTION = 100;
9+
const DRAG_DISTANCE_MULTIPLE_OPTIONS = 150;
1010

1111
/**
1212
* item-sliding doesn't have mode-specific styling,
@@ -15,7 +15,7 @@ const DRAG_DISTANCE_TWO_OPTIONS = 150;
1515
* It is important to test all modes to ensure that the
1616
* child components are being rendered correctly.
1717
*/
18-
configs().forEach(({ title, screenshot, config }) => {
18+
configs({ modes: ['ios', 'md', 'ionic-md'] }).forEach(({ title, screenshot, config }) => {
1919
test.describe(title('item-sliding: basic'), () => {
2020
test.beforeEach(async ({ page }) => {
2121
await page.goto(`/src/components/item-sliding/test/basic`, config);
@@ -30,9 +30,9 @@ configs().forEach(({ title, screenshot, config }) => {
3030
* Positive dragByX value to drag element from the left to the right
3131
* to reveal the options on the left side.
3232
*/
33-
const dragByX = config.direction === 'rtl' ? -DRAG_DISTANCE_ONE_OPTION : DRAG_DISTANCE_ONE_OPTION;
33+
const dragByX = config.direction === 'rtl' ? -DRAG_DISTANCE_SINGLE_OPTION : DRAG_DISTANCE_SINGLE_OPTION;
3434

35-
await dragElementBy(item, page, dragByX, 0, undefined, undefined, undefined, 15);
35+
await dragElementBy(item, page, dragByX, 0, undefined, undefined, true, 15);
3636

3737
await expect(item).toHaveScreenshot(screenshot('item-sliding-start'));
3838
});
@@ -48,9 +48,9 @@ configs().forEach(({ title, screenshot, config }) => {
4848
* Positive dragByX value to drag element from the left to the right
4949
* to reveal the options on the left side.
5050
*/
51-
const dragByX = config.direction === 'rtl' ? DRAG_DISTANCE_TWO_OPTIONS : -DRAG_DISTANCE_TWO_OPTIONS;
51+
const dragByX = config.direction === 'rtl' ? DRAG_DISTANCE_MULTIPLE_OPTIONS : -DRAG_DISTANCE_MULTIPLE_OPTIONS;
5252

53-
await dragElementBy(item, page, dragByX, 0, undefined, undefined, undefined, 15);
53+
await dragElementBy(item, page, dragByX, 0, undefined, undefined, true, 15);
5454

5555
await expect(item).toHaveScreenshot(screenshot('item-sliding-end'));
5656
});
@@ -67,7 +67,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
6767
await page.goto(`/src/components/item-sliding/test/basic`, config);
6868
const item = page.locator('#item2');
6969

70-
await dragElementBy(item, page, -DRAG_DISTANCE_TWO_OPTIONS, 0, undefined, undefined, undefined, 15);
70+
await dragElementBy(item, page, -DRAG_DISTANCE_MULTIPLE_OPTIONS, 0, undefined, undefined, true, 15);
7171
await page.waitForChanges();
7272

7373
// item-sliding doesn't have an easy way to tell whether it's fully open so just screenshot it
@@ -111,7 +111,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
111111
* make sure the safe area padding is applied only to that side
112112
* regardless of direction
113113
*/
114-
configs().forEach(({ title, screenshot, config }) => {
114+
configs({ modes: ['ios', 'md', 'ionic-md'] }).forEach(({ title, screenshot, config }) => {
115115
test.describe(title('item-sliding: basic'), () => {
116116
test.describe('safe area left', () => {
117117
test('should have padding on the left only', async ({ page }) => {
@@ -146,8 +146,8 @@ configs().forEach(({ title, screenshot, config }) => {
146146
const direction = config.direction;
147147
const item = page.locator('ion-item-sliding');
148148

149-
const dragByX = direction == 'rtl' ? -DRAG_DISTANCE_TWO_OPTIONS : DRAG_DISTANCE_TWO_OPTIONS;
150-
await dragElementBy(item, page, dragByX, 0, undefined, undefined, undefined, 15);
149+
const dragByX = direction == 'rtl' ? -DRAG_DISTANCE_MULTIPLE_OPTIONS : DRAG_DISTANCE_MULTIPLE_OPTIONS;
150+
await dragElementBy(item, page, dragByX, 0, undefined, undefined, true, 15);
151151
await page.waitForChanges();
152152

153153
await expect(item).toHaveScreenshot(screenshot(`item-sliding-safe-area-left`));
@@ -187,8 +187,8 @@ configs().forEach(({ title, screenshot, config }) => {
187187
const direction = config.direction;
188188
const item = page.locator('ion-item-sliding');
189189

190-
const dragByX = direction == 'rtl' ? DRAG_DISTANCE_TWO_OPTIONS : -DRAG_DISTANCE_TWO_OPTIONS;
191-
await dragElementBy(item, page, dragByX, 0, undefined, undefined, undefined, 15);
190+
const dragByX = direction == 'rtl' ? DRAG_DISTANCE_MULTIPLE_OPTIONS : -DRAG_DISTANCE_MULTIPLE_OPTIONS;
191+
await dragElementBy(item, page, dragByX, 0, undefined, undefined, true, 15);
192192
await page.waitForChanges();
193193

194194
await expect(item).toHaveScreenshot(screenshot(`item-sliding-safe-area-right`));

core/src/components/item-sliding/test/icons/item-sliding.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { configs, test, dragElementBy } from '@utils/test/playwright';
55
* Drag distances that reveal options without crossing the full swipe threshold
66
* (optsWidth + SWIPE_MARGIN). A narrower options panel requires a shorter drag.
77
*/
8-
const DRAG_DISTANCE_TWO_OPTIONS = 150;
8+
const DRAG_DISTANCE_MULTIPLE_OPTIONS = 150;
99

1010
/**
1111
* item-sliding doesn't have mode-specific styling,
@@ -30,9 +30,9 @@ configs({ modes: ['ionic-md', 'ios', 'md'] }).forEach(({ title, screenshot, conf
3030
* Positive dragByX value to drag element from the left to the right
3131
* to reveal the options on the left side.
3232
*/
33-
const dragByX = config.direction === 'rtl' ? DRAG_DISTANCE_TWO_OPTIONS : -DRAG_DISTANCE_TWO_OPTIONS;
33+
const dragByX = config.direction === 'rtl' ? DRAG_DISTANCE_MULTIPLE_OPTIONS : -DRAG_DISTANCE_MULTIPLE_OPTIONS;
3434

35-
await dragElementBy(item, page, dragByX, 0, undefined, undefined, undefined, 15);
35+
await dragElementBy(item, page, dragByX, 0, undefined, undefined, true, 15);
3636
await page.waitForChanges();
3737

3838
// Convert camelCase ids to kebab-case for screenshot file names

core/src/components/item-sliding/test/scroll-target/item-sliding.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { configs, test, dragElementBy } from '@utils/test/playwright';
55
* Drag distances that reveal options without crossing the full swipe threshold
66
* (optsWidth + SWIPE_MARGIN). A narrower options panel requires a shorter drag.
77
*/
8-
const DRAG_DISTANCE_TWO_OPTIONS = 150;
8+
const DRAG_DISTANCE_MULTIPLE_OPTIONS = 150;
99

1010
/**
1111
* This behavior does not vary across modes/directions
@@ -22,7 +22,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
2222

2323
expect(await scrollEl.evaluate((el: HTMLElement) => el.scrollTop)).toEqual(0);
2424

25-
await dragElementBy(itemSlidingEl, page, -DRAG_DISTANCE_TWO_OPTIONS, 0, undefined, undefined, false);
25+
await dragElementBy(itemSlidingEl, page, -DRAG_DISTANCE_MULTIPLE_OPTIONS, 0, undefined, undefined, false);
2626

2727
/**
2828
* Do not use scrollToBottom() or other scrolling methods

core/src/components/item-sliding/test/shapes/item-sliding.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { configs, test, dragElementBy } from '@utils/test/playwright';
55
* Drag distances that reveal options without crossing the full swipe threshold
66
* (optsWidth + SWIPE_MARGIN). A narrower options panel requires a shorter drag.
77
*/
8-
const DRAG_DISTANCE_TWO_OPTIONS = 150;
8+
const DRAG_DISTANCE_MULTIPLE_OPTIONS = 150;
99

1010
/**
1111
* The shapes on the `item-option` do not vary by direction
@@ -25,9 +25,9 @@ configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screensh
2525
* Negative dragByX value to drag element from the right to the left
2626
* to reveal the options on the right side.
2727
*/
28-
const dragByX = -DRAG_DISTANCE_TWO_OPTIONS;
28+
const dragByX = -DRAG_DISTANCE_MULTIPLE_OPTIONS;
2929

30-
await dragElementBy(item, page, dragByX, 0, undefined, undefined, undefined, 15);
30+
await dragElementBy(item, page, dragByX, 0, undefined, undefined, true, 15);
3131
await page.waitForChanges();
3232

3333
await expect(item).toHaveScreenshot(screenshot(`item-sliding-${shape}`));

core/src/components/item-sliding/test/states/item-sliding.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { configs, test, dragElementBy } from '@utils/test/playwright';
55
* Drag distances that reveal options without crossing the full swipe threshold
66
* (optsWidth + SWIPE_MARGIN). A narrower options panel requires a shorter drag.
77
*/
8-
const DRAG_DISTANCE_TWO_OPTIONS = 150;
8+
const DRAG_DISTANCE_MULTIPLE_OPTIONS = 150;
99

1010
/**
1111
* This behavior does not vary across modes
@@ -22,7 +22,7 @@ configs({ modes: ['ionic-md', 'md', 'ios'], directions: ['ltr'] }).forEach(({ ti
2222
* Negative dragByX value to drag element from the right to the left
2323
* to reveal the options on the right side.
2424
*/
25-
const dragByX = -DRAG_DISTANCE_TWO_OPTIONS;
25+
const dragByX = -DRAG_DISTANCE_MULTIPLE_OPTIONS;
2626

2727
await dragElementBy(item, page, dragByX);
2828
await page.waitForChanges();

0 commit comments

Comments
 (0)