Skip to content

Commit 1dd03cb

Browse files
committed
Revert "test(item-sliding): add a test for the CDN issue with side"
This reverts commit e681558.
1 parent e681558 commit 1dd03cb

File tree

3 files changed

+2
-104
lines changed

3 files changed

+2
-104
lines changed
Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { expect } from '@playwright/test';
22
import { configs, test } from '@utils/test/playwright';
33

4-
/**
5-
* This behavior does not vary across modes/directions
6-
*/
74
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
85
test.describe(title('item-sliding: async'), () => {
96
test.beforeEach(async ({ page }) => {
@@ -38,83 +35,5 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
3835

3936
await expect(itemSlidingEl).toHaveClass(/item-sliding-active-slide/);
4037
});
41-
42-
test('should not throw errors when adding multiple items with side="end" using the Ionic CDN', async ({ page }, testInfo) => {
43-
testInfo.annotations.push({
44-
type: 'issue',
45-
description: 'https://github.com/ionic-team/ionic-framework/issues/29499',
46-
});
47-
48-
const errors: string[] = [];
49-
page.on('console', msg => {
50-
if (msg.type() === 'error') {
51-
errors.push(msg.text());
52-
}
53-
});
54-
page.on('pageerror', error => {
55-
errors.push(error.message);
56-
});
57-
58-
// This issue only happens when using a CDN version of Ionic
59-
// so we need to use the CDN by passing the `importIonicFromCDN` option
60-
// to setContent.
61-
await page.setContent(`
62-
<ion-header>
63-
<ion-toolbar>
64-
<ion-title>Item Sliding</ion-title>
65-
<ion-buttons slot="end">
66-
<ion-button id="addItem" onclick="addItem()">ADD ITEM</ion-button>
67-
</ion-buttons>
68-
</ion-toolbar>
69-
</ion-header>
70-
<ion-content>
71-
<ion-list id="list"></ion-list>
72-
</ion-content>
73-
74-
<script>
75-
let itemList = [];
76-
function generateItem() {
77-
const currentItem = itemList.length + 1;
78-
const item = \`
79-
<ion-item-sliding id="item-\${currentItem}">
80-
<ion-item>
81-
<ion-label>Sliding Item \${currentItem}</ion-label>
82-
</ion-item>
83-
<ion-item-options side="end">
84-
<ion-item-option color="danger" id="delete-item-\${currentItem}">Delete</ion-item-option>
85-
</ion-item-options>
86-
</ion-item-sliding>
87-
\`;
88-
itemList.push(item);
89-
return item;
90-
}
91-
function addItem() {
92-
const list = document.getElementById('list');
93-
list.innerHTML += generateItem();
94-
const currentItem = itemList.length;
95-
const deleteId = \`#delete-item-\${currentItem}\`;
96-
const itemId = \`#item-\${currentItem}\`;
97-
document.querySelector(deleteId).addEventListener('click', (ev) => {
98-
document.querySelector(itemId).remove();
99-
});
100-
}
101-
</script>
102-
`, { ...config, importIonicFromCDN: true });
103-
104-
// Click the button enough times to reproduce the issue
105-
const addButton = page.locator('#addItem');
106-
await addButton.click();
107-
await addButton.click();
108-
await addButton.click();
109-
110-
await page.waitForChanges();
111-
112-
// Check that the items have been added
113-
const items = page.locator('ion-item-sliding');
114-
expect(await items.count()).toBe(3);
115-
116-
// Check that no errors have been logged
117-
expect(errors.length).toBe(0);
118-
});
11938
});
12039
});

core/src/utils/test/playwright/page/utils/set-content.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,18 @@ export const setContent = async (page: Page, html: string, testInfo: TestInfo, o
3333

3434
const baseUrl = process.env.PLAYWRIGHT_TEST_BASE_URL;
3535

36-
// The Ionic bundle is included locally by default unless the test
37-
// config passes in the importIonicFromCDN option. This is useful
38-
// when testing with the CDN version of Ionic.
39-
let ionicImports = `
40-
<link href="${baseUrl}/css/ionic.bundle.css" rel="stylesheet" />
41-
<script type="module" src="${baseUrl}/dist/ionic/ionic.esm.js"></script>
42-
`;
43-
44-
if (options?.importIonicFromCDN) {
45-
ionicImports = `
46-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core/css/ionic.bundle.css" />
47-
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.esm.js"></script>
48-
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.js"></script>
49-
`;
50-
}
51-
5236
const output = `
5337
<!DOCTYPE html>
5438
<html dir="${direction}" lang="en">
5539
<head>
5640
<title>Ionic Playwright Test</title>
5741
<meta charset="UTF-8" />
5842
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
43+
<link href="${baseUrl}/css/ionic.bundle.css" rel="stylesheet" />
5944
<link href="${baseUrl}/scripts/testing/styles.css" rel="stylesheet" />
6045
${palette !== 'light' ? `<link href="${baseUrl}/css/palettes/${palette}.always.css" rel="stylesheet" />` : ''}
6146
<script src="${baseUrl}/scripts/testing/scripts.js"></script>
62-
${ionicImports}
47+
<script type="module" src="${baseUrl}/dist/ionic/ionic.esm.js"></script>
6348
<script>
6449
window.Ionic = {
6550
config: {

core/src/utils/test/playwright/playwright-declarations.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ interface PageOptions {
3131
* - `'commit'` - consider operation to be finished when network response is received and the document started loading.
3232
*/
3333
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit';
34-
35-
/**
36-
* If true, the default Ionic imports will be included
37-
* via the CDN instead of the local bundle.
38-
*/
39-
importIonicFromCDN?: boolean;
4034
}
4135

4236
export interface E2EPage extends Page {

0 commit comments

Comments
 (0)