Add highlight annotations to csf4.ts and update e2e tests for a11y panel visibility

This commit is contained in:
Norbert de Langen 2025-03-28 23:24:56 +01:00
parent 9bacc23477
commit 098ae3e15c
2 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import type { NormalizedProjectAnnotations } from 'storybook/internal/types';
import actionAnnotations from 'storybook/actions/preview';
import backgroundsAnnotations from 'storybook/backgrounds/preview';
import highlightAnnotations from 'storybook/highlight/preview';
import measureAnnotations from 'storybook/measure/preview';
import outlineAnnotations from 'storybook/outline/preview';
import { composeConfigs, normalizeProjectAnnotations } from 'storybook/preview-api';
@ -38,6 +39,9 @@ export function __definePreview<TRenderer extends Renderer>(
(viewportAnnotations.default ?? viewportAnnotations)(),
// @ts-expect-error CJS fallback
(backgroundsAnnotations.default ?? backgroundsAnnotations)(),
// @ts-expect-error CJS fallback
(highlightAnnotations.default ?? highlightAnnotations)(),
// @ts-expect-error CJS fallback
(measureAnnotations.default ?? measureAnnotations)(),
// @ts-expect-error CJS fallback

View File

@ -237,7 +237,7 @@ test.describe('Manager UI', () => {
// panel is closed
await expect(mobileNavigationHeading).toHaveText('Example/Button/Secondary');
await expect(sbPage.page.locator('#tabbutton-addon-controls')).toBeHidden();
await expect(sbPage.page.locator('#list-item-storybook/a11y/panel')).toBeHidden();
// open panel
await sbPage.page.locator('[title="Open addon panel"]').click();
@ -247,14 +247,14 @@ test.describe('Manager UI', () => {
await addonsMenuButton.click();
// panel is open
await expect(sbPage.page.locator('#list-item-addon-controls')).toBeVisible();
await expect(sbPage.page.locator('#list-item-storybook/a11y/panel')).toBeVisible();
// close panel
await sbPage.page.locator('[title="Close addon panel"]').click();
// panel is closed
await expect(mobileNavigationHeading).toHaveText('Example/Button/Secondary');
await expect(sbPage.page.locator('#tabbutton-addon-controls')).toBeHidden();
await expect(sbPage.page.locator('#list-item-storybook/a11y/panel')).toBeHidden();
});
});
});