-
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.
feat: added interactive tag (#15808)
* feat: added interactive tag * fix: fixed changes after meeting with team * test: added tests * fix: fixed typescript error using any like Toggletip does * test: fixed test * test: fixed avt test * test: fixed playwright test * fix: fixed snapshot and style for operational tag * fix: fixed TJ comments * fix: fixed nested button with operational tag * fix: fixed Lauren comments * fix: fixed operational tag with popover * fix: fixed overview page code * fix: fixed Lauren comments * test: fixed avt test * fix: fixed percy errors * test: removed skip from test * docs: fixed docs * fix: removed onClick from selectable tag * fix: fixed issue 15820 from toggletip a11y * fix: fixed typescript * fix: fixed typescript error
- Loading branch information
Showing
24 changed files
with
1,891 additions
and
149 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
e2e/components/InteractiveTag/InteractiveTag-test.avt.e2e.js
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,108 @@ | ||
/** | ||
* 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('@avt InteractiveTag', () => { | ||
test('@avt-advanced-states DismissibleTag', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Tag', | ||
id: 'experimental-unstable-interactivetag--dismissible', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
await expect(page).toHaveNoACViolations('DismissibleTag'); | ||
}); | ||
|
||
// Testing being skipped because it is failing in the ToggleTip that operational it's using | ||
test('@avt-advanced-states OperationalTag', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Tag', | ||
id: 'experimental-unstable-interactivetag--operational', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
await expect(page).toHaveNoACViolations('OperationalTag'); | ||
}); | ||
|
||
test('@avt-advanced-states SelectableTag', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Tag', | ||
id: 'experimental-unstable-interactivetag--selectable', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
await expect(page).toHaveNoACViolations('SelectableTag'); | ||
}); | ||
|
||
test('@avt-keyboard-nav DismissibleTag', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Tag', | ||
id: 'experimental-unstable-interactivetag--dismissible', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
const button = page.getByRole('button').first(); | ||
await expect(button).toBeVisible(); | ||
await page.keyboard.press('Tab'); | ||
await expect(button).toBeFocused(); | ||
}); | ||
|
||
test('@avt-keyboard-nav OperationalTag', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Tag', | ||
id: 'experimental-unstable-interactivetag--operational', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
const button = page.getByRole('button').first(); | ||
await expect(button).toBeVisible(); | ||
await page.keyboard.press('Tab'); | ||
await expect(button).toBeFocused(); | ||
await expect(button).toHaveClass(/cds--tag--red/); | ||
|
||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
await page.keyboard.press('Tab'); | ||
|
||
// Expecte the OperationalTag with tooltip be focusable and visible | ||
await expect(page.getByRole('button').nth(10)).toBeFocused(); | ||
await page.keyboard.press('Enter'); | ||
await expect(page.getByText('View More')).toBeVisible(); | ||
}); | ||
|
||
test('@avt-keyboard-nav SelectableTag', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'Tag', | ||
id: 'experimental-unstable-interactivetag--selectable', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
const tag = page.getByRole('button').first(); | ||
await expect(tag).toBeVisible(); | ||
await page.keyboard.press('Tab'); | ||
await expect(tag).toBeFocused(); | ||
await page.keyboard.press('Enter'); | ||
await expect(tag).toHaveClass(/cds--tag--selectable-selected/); | ||
}); | ||
}); |
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,42 @@ | ||
/** | ||
* 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 { test } from '@playwright/test'; | ||
import { themes } from '../../test-utils/env'; | ||
import { snapshotStory } from '../../test-utils/storybook'; | ||
|
||
test.describe('InteractiveTag', () => { | ||
themes.forEach((theme) => { | ||
test.describe(theme, () => { | ||
test('DismissibleTag @vrt', async ({ page }) => { | ||
await snapshotStory(page, { | ||
component: 'DismissibleTag', | ||
id: 'experimental-unstable-interactivetag--dismissible', | ||
theme, | ||
}); | ||
}); | ||
|
||
test('OperationalTag @vrt', async ({ page }) => { | ||
await snapshotStory(page, { | ||
component: 'OperationalTag', | ||
id: 'experimental-unstable-interactivetag--operational', | ||
theme, | ||
}); | ||
}); | ||
|
||
test('SelectableTag @vrt', async ({ page }) => { | ||
await snapshotStory(page, { | ||
component: 'SelectableTag', | ||
id: 'experimental-unstable-interactivetag--selectable', | ||
theme, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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.