Skip to content

Commit f142f36

Browse files
fix(test): Update Item and Card native test variable
Consistency based on element being tested
1 parent 962baac commit f142f36

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

core/src/components/card/test/a11y/card.e2e.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ configs({ directions: ['ltr'] }).forEach(({ title, config }) => {
4949
);
5050

5151
const host = page.locator('ion-card');
52-
const nativeItem = host.locator('[part="native"]');
52+
const nativeCard = host.locator('[part="native"]');
5353

54-
await expect(nativeItem).toHaveAttribute('aria-label', 'label');
54+
await expect(nativeCard).toHaveAttribute('aria-label', 'label');
5555

5656
await host.evaluate((el) => el.setAttribute('aria-label', 'updated'));
5757

58-
await expect(nativeItem).toHaveAttribute('aria-label', 'updated');
58+
await expect(nativeCard).toHaveAttribute('aria-label', 'updated');
5959
});
6060

6161
test('preserves inherited aria-label after detach and reattach', async ({ page }) => {
@@ -74,9 +74,9 @@ configs({ directions: ['ltr'] }).forEach(({ title, config }) => {
7474
);
7575

7676
const host = page.locator('ion-card');
77-
const nativeItem = host.locator('[part="native"]');
77+
const nativeCard = host.locator('[part="native"]');
7878

79-
await expect(nativeItem).toHaveAttribute('aria-label', 'label');
79+
await expect(nativeCard).toHaveAttribute('aria-label', 'label');
8080

8181
// Detach, reattach, and force a render via a prop change.
8282
await host.evaluate((itemEl) => {
@@ -87,7 +87,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, config }) => {
8787
});
8888

8989
// Assert the original value survived
90-
await expect(nativeItem).toHaveAttribute('aria-label', 'label');
90+
await expect(nativeCard).toHaveAttribute('aria-label', 'label');
9191
});
9292

9393
test('syncs aria-label updates and removal after initial inheritance', async ({ page }) => {
@@ -103,26 +103,26 @@ configs({ directions: ['ltr'] }).forEach(({ title, config }) => {
103103
);
104104

105105
const host = page.locator('ion-card');
106-
const nativeButton = host.locator('[part="native"]');
106+
const nativeCard = host.locator('[part="native"]');
107107

108108
// Initial inheritance moves the value from the host to the native button.
109109
await expect(host).not.toHaveAttribute('aria-label');
110-
await expect(nativeButton).toHaveAttribute('aria-label', 'initial');
110+
await expect(nativeCard).toHaveAttribute('aria-label', 'initial');
111111

112112
// Post-load writes remain on the host and are synchronized to native
113113
await host.evaluate((el) => el.setAttribute('aria-label', 'second'));
114114
await expect(host).toHaveAttribute('aria-label');
115-
await expect(nativeButton).toHaveAttribute('aria-label', 'second');
115+
await expect(nativeCard).toHaveAttribute('aria-label', 'second');
116116

117117
// An empty string is a valid ARIA attribute value and remains synchronized.
118118
await host.evaluate((el) => el.setAttribute('aria-label', ''));
119119
await expect(host).toHaveAttribute('aria-label');
120-
await expect(nativeButton).toHaveAttribute('aria-label', '');
120+
await expect(nativeCard).toHaveAttribute('aria-label', '');
121121

122122
// Native MutationObserver behavior sees a real removal after a post-load write.
123123
await host.evaluate((el) => el.removeAttribute('aria-label'));
124124
await expect(host).not.toHaveAttribute('aria-label');
125-
await expect(nativeButton).not.toHaveAttribute('aria-label');
125+
await expect(nativeCard).not.toHaveAttribute('aria-label');
126126
});
127127
});
128128
});

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,26 +224,26 @@ configs({ directions: ['ltr'] }).forEach(({ title, config }) => {
224224
);
225225

226226
const host = page.locator('ion-item');
227-
const nativeButton = host.locator('[part="native"]');
227+
const nativeItem = host.locator('[part="native"]');
228228

229229
// Initial inheritance moves the value from the host to the native button.
230230
await expect(host).not.toHaveAttribute('aria-label');
231-
await expect(nativeButton).toHaveAttribute('aria-label', 'initial');
231+
await expect(nativeItem).toHaveAttribute('aria-label', 'initial');
232232

233233
// Post-load writes remain on the host and are synchronized to native
234234
await host.evaluate((el) => el.setAttribute('aria-label', 'second'));
235235
await expect(host).toHaveAttribute('aria-label');
236-
await expect(nativeButton).toHaveAttribute('aria-label', 'second');
236+
await expect(nativeItem).toHaveAttribute('aria-label', 'second');
237237

238238
// An empty string is a valid ARIA attribute value and remains synchronized.
239239
await host.evaluate((el) => el.setAttribute('aria-label', ''));
240240
await expect(host).toHaveAttribute('aria-label');
241-
await expect(nativeButton).toHaveAttribute('aria-label', '');
241+
await expect(nativeItem).toHaveAttribute('aria-label', '');
242242

243243
// Native MutationObserver behavior sees a real removal after a post-load write.
244244
await host.evaluate((el) => el.removeAttribute('aria-label'));
245245
await expect(host).not.toHaveAttribute('aria-label');
246-
await expect(nativeButton).not.toHaveAttribute('aria-label');
246+
await expect(nativeItem).not.toHaveAttribute('aria-label');
247247
});
248248
});
249249
});

0 commit comments

Comments
 (0)