Skip to content

Commit bbe1cae

Browse files
test(item): add test to check conditional interactivity
1 parent 1575647 commit bbe1cae

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

core/src/components/item/test/inputs/item.e2e.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,5 +252,46 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
252252

253253
await expect(list).toHaveScreenshot(screenshot(`item-inputs-div-with-inputs`));
254254
});
255+
256+
test('should update interactivity state when elements are conditionally rendered', async ({ page }, testInfo) => {
257+
testInfo.annotations.push({
258+
type: 'issue',
259+
description: 'https://github.com/ionic-team/ionic-framework/issues/29763',
260+
});
261+
262+
await page.setContent(
263+
`
264+
<ion-list>
265+
<ion-item>
266+
<ion-label>Conditional Checkbox</ion-label>
267+
</ion-item>
268+
</ion-list>
269+
`,
270+
config
271+
);
272+
273+
const item = page.locator('ion-item');
274+
275+
await page.evaluate(() => {
276+
const item = document.querySelector('ion-item');
277+
const checkbox = document.createElement('ion-checkbox');
278+
item?.appendChild(checkbox);
279+
});
280+
281+
await page.waitForChanges();
282+
283+
const checkbox = page.locator('ion-checkbox');
284+
await expect(checkbox).not.toBeChecked();
285+
286+
// Test that clicking on the left edge of the item toggles the checkbox
287+
await item.click({
288+
position: {
289+
x: 5,
290+
y: 5,
291+
},
292+
});
293+
294+
await expect(checkbox).toBeChecked();
295+
});
255296
});
256297
});

0 commit comments

Comments
 (0)