@ionic/core 7.4.1-nightly.20230920 → 7.4.2-dev.11695319270.1e2fa2e5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,16 +3,46 @@
3
3
  */
4
4
  import { expect } from "@playwright/test";
5
5
  import { configs, dragElementBy, test } from "../../../../utils/test/playwright/index";
6
- import { testSlidingItem } from "../test.utils";
7
6
  /**
8
- * item-sliding doesn't have mode-specific styling
7
+ * item-sliding doesn't have mode-specific styling,
8
+ * but the child components, item-options and item-option, do.
9
+ *
10
+ * It is important to test all modes to ensure that the
11
+ * child components are being rendered correctly.
9
12
  */
10
- configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
13
+ configs().forEach(({ title, screenshot, config }) => {
11
14
  test.describe(title('item-sliding: basic'), () => {
12
- test.fixme('should not have visual regressions', async ({ page }) => {
15
+ test.beforeEach(async ({ page }) => {
13
16
  await page.goto(`/src/components/item-sliding/test/basic`, config);
14
- await testSlidingItem(page, 'item2', 'start', screenshot, true);
15
- await testSlidingItem(page, 'item2', 'end', screenshot);
17
+ });
18
+ test.describe('start options', () => {
19
+ test('should not have visual regressions', async ({ page }) => {
20
+ const item = page.locator('#item2');
21
+ /**
22
+ * Negative dragByX value to drag element from the right to the left
23
+ * to reveal the options on the right side.
24
+ * Positive dragByX value to drag element from the left to the right
25
+ * to reveal the options on the left side.
26
+ */
27
+ const dragByX = config.direction === 'rtl' ? -150 : 150;
28
+ await dragElementBy(item, page, dragByX);
29
+ await page.waitForChanges();
30
+ await expect(item).toHaveScreenshot(screenshot('item-sliding-start'));
31
+ });
32
+ });
33
+ test.describe('end options', () => {
34
+ test('should not have visual regressions', async ({ page }) => {
35
+ const item = page.locator('#item2');
36
+ /**
37
+ * Negative dragByX value to drag element from the right to the left
38
+ * to reveal the options on the right side.
39
+ * Positive dragByX value to drag element from the left to the right
40
+ * to reveal the options on the left side.
41
+ */
42
+ const dragByX = config.direction === 'rtl' ? 150 : -150;
43
+ await dragElementBy(item, page, dragByX);
44
+ await expect(item).toHaveScreenshot(screenshot('item-sliding-end'));
45
+ });
16
46
  });
17
47
  });
18
48
  });
@@ -1,19 +1,34 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
- import { configs, test } from "../../../../utils/test/playwright/index";
5
- import { testSlidingItem } from "../test.utils";
6
- // TODO FW-3006
4
+ import { expect } from "@playwright/test";
5
+ import { configs, test, dragElementBy } from "../../../../utils/test/playwright/index";
7
6
  /**
8
- * item-sliding doesn't have mode-specific styling
7
+ * item-sliding doesn't have mode-specific styling,
8
+ * but the child components, item-options and item-option, do.
9
+ *
10
+ * It is important to test all modes to ensure that the
11
+ * child components are being rendered correctly.
9
12
  */
10
- configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
11
- test.describe.skip(title('item-sliding: icons'), () => {
13
+ configs().forEach(({ title, screenshot, config }) => {
14
+ test.describe(title('item-sliding: icons'), () => {
12
15
  test('should not have visual regressions', async ({ page }) => {
13
16
  await page.goto(`/src/components/item-sliding/test/icons`, config);
14
17
  const itemIDs = ['iconsOnly', 'iconsStart', 'iconsEnd', 'iconsTop', 'iconsBottom'];
15
18
  for (const itemID of itemIDs) {
16
- await testSlidingItem(page, itemID, itemID, screenshot);
19
+ const item = page.locator(`#${itemID}`);
20
+ /**
21
+ * Negative dragByX value to drag element from the right to the left
22
+ * to reveal the options on the right side.
23
+ * Positive dragByX value to drag element from the left to the right
24
+ * to reveal the options on the left side.
25
+ */
26
+ const dragByX = config.direction === 'rtl' ? 150 : -150;
27
+ await dragElementBy(item, page, dragByX);
28
+ await page.waitForChanges();
29
+ // Convert camelCase ids to kebab-case for screenshot file names
30
+ const itemIDKebab = itemID.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
31
+ await expect(item).toHaveScreenshot(screenshot(`item-sliding-${itemIDKebab}`));
17
32
  }
18
33
  });
19
34
  });
@@ -2,25 +2,19 @@
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
4
  import { expect } from "@playwright/test";
5
- import { configs, test } from "../../../../utils/test/playwright/index";
5
+ import { configs, test, dragElementBy } from "../../../../utils/test/playwright/index";
6
6
  /**
7
7
  * This behavior does not vary across modes/directions
8
8
  */
9
9
  configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
10
10
  test.describe(title('item-sliding: scroll-target'), () => {
11
- // TODO FW-3006
12
- test.skip('should not scroll when the item-sliding is swiped in custom scroll target', async ({ page, skip }) => {
11
+ test('should not scroll when the item-sliding is swiped in custom scroll target', async ({ page, skip }) => {
13
12
  skip.browser('webkit', 'mouse.wheel is not available in WebKit');
14
13
  await page.goto(`/src/components/item-sliding/test/scroll-target`, config);
15
14
  const itemSlidingEl = page.locator('ion-item-sliding');
16
15
  const scrollEl = page.locator('.ion-content-scroll-host');
17
16
  expect(await scrollEl.evaluate((el) => el.scrollTop)).toEqual(0);
18
- const box = (await itemSlidingEl.boundingBox());
19
- const centerX = box.x + box.width / 2;
20
- const centerY = box.y + box.height / 2;
21
- await page.mouse.move(centerX, centerY);
22
- await page.mouse.down();
23
- await page.mouse.move(centerX - 30, centerY);
17
+ await dragElementBy(itemSlidingEl, page, -150, 0, undefined, undefined, false);
24
18
  /**
25
19
  * Do not use scrollToBottom() or other scrolling methods
26
20
  * on ion-content as those will update the scroll position.
@@ -2,6 +2,11 @@
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
4
  import { expect } from "@playwright/test";
5
+ /**
6
+ * Warning: This function will fail when in RTL mode.
7
+ * TODO(FW-3711): Remove the `directions` config when this issue preventing
8
+ * tests from passing in RTL mode is resolved.
9
+ */
5
10
  export const testSlidingItem = async (page, itemID, screenshotNameSuffix, screenshot, openStart = false) => {
6
11
  const item = page.locator(`#${itemID}`);
7
12
  // passing a param into the eval callback is tricky due to execution context
@@ -17,6 +22,9 @@ export const testSlidingItem = async (page, itemID, screenshotNameSuffix, screen
17
22
  });
18
23
  }
19
24
  // opening animation takes longer than waitForChanges accounts for
25
+ // especially if another item sliding is already open,
26
+ // so we wait to ensure the opened item is closed before
27
+ // opening another
20
28
  await page.waitForTimeout(500);
21
29
  await expect(item).toHaveScreenshot(screenshot(`item-sliding-${screenshotNameSuffix}`));
22
30
  await item.evaluate(async (el) => {
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-09-20T06:03:54",
2
+ "timestamp": "2023-09-21T18:03:43",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.3.0",
@@ -1,2 +1,7 @@
1
1
  import type { E2EPage, ScreenshotFn } from "../../../utils/test/playwright/index";
2
+ /**
3
+ * Warning: This function will fail when in RTL mode.
4
+ * TODO(FW-3711): Remove the `directions` config when this issue preventing
5
+ * tests from passing in RTL mode is resolved.
6
+ */
2
7
  export declare const testSlidingItem: (page: E2EPage, itemID: string, screenshotNameSuffix: string, screenshot: ScreenshotFn, openStart?: boolean) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/core",
3
- "version": "7.4.1-nightly.20230920",
3
+ "version": "7.4.2-dev.11695319270.1e2fa2e5",
4
4
  "description": "Base components for Ionic",
5
5
  "keywords": [
6
6
  "ionic",