|
| 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 | +}); |
0 commit comments