Skip to content

Commit 55bb7f3

Browse files
authored
test(Select): add @AVT tests (#14380)
* test(Select): add @AVT tests * fix(Select): update avt tests
1 parent e5c6a0d commit 55bb7f3

2 files changed

Lines changed: 67 additions & 10 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright IBM Corp. 2016, 2023
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
'use strict';
9+
10+
const { expect, test } = require('@playwright/test');
11+
const { visitStory } = require('../../test-utils/storybook');
12+
13+
test.describe('Select @avt', () => {
14+
test('accessibility-checker default', async ({ page }) => {
15+
await visitStory(page, {
16+
component: 'Select',
17+
id: 'components-select--default',
18+
globals: {
19+
theme: 'white',
20+
},
21+
});
22+
await expect(page).toHaveNoACViolations('components-select--default');
23+
});
24+
25+
test('accessibility-checker inline', async ({ page }) => {
26+
await visitStory(page, {
27+
component: 'Select',
28+
id: 'components-select--inline',
29+
globals: {
30+
theme: 'white',
31+
},
32+
});
33+
await expect(page).toHaveNoACViolations('components-select--inline');
34+
});
35+
36+
test('accessibility-checker skeleton', async ({ page }) => {
37+
await visitStory(page, {
38+
component: 'Select',
39+
id: 'components-select--skeleton',
40+
globals: {
41+
theme: 'white',
42+
},
43+
});
44+
await expect(page).toHaveNoACViolations('components-select--skeleton');
45+
});
46+
47+
test('select - keyboard nav', async ({ page }) => {
48+
await visitStory(page, {
49+
component: 'Select',
50+
id: 'components-select--default',
51+
globals: {
52+
theme: 'white',
53+
},
54+
});
55+
56+
const select = page.getByRole('combobox');
57+
await expect(select).toBeVisible();
58+
// Tab to Select
59+
await page.keyboard.press('Tab');
60+
await expect(select).toBeFocused();
61+
await expect(select).toHaveValue('');
62+
// Select Option 4
63+
await select.selectOption('Option 4');
64+
await expect(select).toHaveValue('Option 4');
65+
});
66+
});

packages/react/src/components/Select/Select.stories.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,7 @@ export const Inline = () => {
110110
);
111111
};
112112

113-
export const Skeleton = () => (
114-
<div
115-
aria-label="loading select"
116-
aria-live="assertive"
117-
role="status"
118-
tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
119-
>
120-
<SelectSkeleton />
121-
</div>
122-
);
113+
export const Skeleton = () => <SelectSkeleton />;
123114

124115
export const _WithLayer = () => (
125116
<WithLayer>

0 commit comments

Comments
 (0)