-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/npm_and_yarn/packages/colors/exam…
…ples/sass-modules/next-13.5.0
- Loading branch information
Showing
14 changed files
with
292 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* Copyright IBM Corp. 2023 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const { expect, test } = require('@playwright/test'); | ||
const { visitStory } = require('../../test-utils/storybook'); | ||
|
||
test.describe('Menu @avt', () => { | ||
test('@avt-default-state', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Menu', | ||
id: 'components-menu--playground', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
await expect(page).toHaveNoACViolations('Menu @avt-default-state'); | ||
}); | ||
|
||
test('@avt-keyboard-nav Menu', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Menu', | ||
id: 'components-menu--playground', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
|
||
const firstItem = page.getByRole('menuitem', { name: 'Share with' }); | ||
const LastItem = page.getByRole('menuitem', { name: 'Delete' }); | ||
const nestedMenu = page.getByRole('menu', { name: 'Share with' }); | ||
const nestedMenuItem = page | ||
.getByRole('menuitemradio', { | ||
name: 'None', | ||
}) | ||
.first(); | ||
|
||
await expect(firstItem).toBeVisible(); | ||
await expect(LastItem).toBeVisible(); | ||
await expect(nestedMenu).not.toBeVisible(); | ||
await expect(firstItem).toBeFocused(); | ||
|
||
// Should go to last item when focused on the first item and arrow up is pressed | ||
await page.keyboard.press('ArrowUp'); | ||
await expect(LastItem).toBeFocused(); | ||
|
||
// Should open menu with ArrowRight and focus on first item | ||
await page.keyboard.press('ArrowDown'); | ||
await expect(firstItem).toBeFocused(); | ||
await page.keyboard.press('ArrowRight'); | ||
await expect(nestedMenu).toBeVisible(); | ||
await expect(nestedMenuItem).toBeVisible(); | ||
await expect(nestedMenuItem).toBeFocused(); | ||
await expect(nestedMenuItem).not.toBeChecked(); | ||
|
||
// Should select item with enter key | ||
await page.keyboard.press('Enter'); | ||
await expect(nestedMenuItem).toBeChecked(); | ||
|
||
// Should close menu with ArrowLeft | ||
await page.keyboard.press('ArrowLeft'); | ||
await expect(nestedMenu).not.toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2023 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import { expect, test } from '@playwright/test'; | ||
import { visitStory } from '../../test-utils/storybook'; | ||
|
||
test.describe('Toggletip @avt', () => { | ||
test('@avt-default-state Toggletip', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Toggletip', | ||
id: 'components-toggletip--default', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
await expect(page).toHaveNoACViolations('Toggletip'); | ||
}); | ||
|
||
test('@avt-keyboard-nav Toggletip', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Toggletip', | ||
id: 'components-toggletip--default', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
|
||
// Checking if the defaultOpen is working | ||
await expect(page.locator('.cds--popover--open')).toBeVisible(); | ||
|
||
// Checking first Toggletip interaction | ||
await page.keyboard.press('Tab'); | ||
await expect(page.getByLabel('Show information').first()).toBeFocused(); | ||
await page.keyboard.press('Enter'); | ||
await expect(page.locator('.cds--popover--open')).toBeVisible(); | ||
// Tabbing inside the popover | ||
await page.keyboard.press('Tab'); | ||
await expect(page.locator('.cds--link').first()).toBeFocused(); | ||
await page.keyboard.press('Tab'); | ||
await expect(page.getByRole('button', { name: 'Button' })).toBeFocused(); | ||
await page.keyboard.press('Tab'); | ||
await expect(page.locator('.cds--popover--open')).not.toBeVisible(); | ||
|
||
// Checking second Toggletip interaction and close on Escape key | ||
await expect(page.getByLabel('Show information').last()).toBeFocused(); | ||
await page.keyboard.press('Enter'); | ||
await expect(page.locator('.cds--popover--open')).toBeVisible(); | ||
await page.keyboard.press('Escape'); | ||
await expect(page.locator('.cds--popover--open')).not.toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.