Skip to content

Commit

Permalink
Merge branch 'next' into chromatic-ignore-stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld authored Aug 1, 2024
2 parents 0943829 + 2ebbeed commit 12f8343
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
11 changes: 8 additions & 3 deletions code/core/src/manager-api/modules/shortcuts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { global } from '@storybook/global';
import { FORCE_REMOUNT, PREVIEW_KEYDOWN } from '@storybook/core/core-events';
import {
FORCE_REMOUNT,
PREVIEW_KEYDOWN,
STORIES_COLLAPSE_ALL,
STORIES_EXPAND_ALL,
} from '@storybook/core/core-events';

import type { ModuleFn } from '../lib/types';

Expand Down Expand Up @@ -356,11 +361,11 @@ export const init: ModuleFn = ({ store, fullAPI, provider }) => {
break;
}
case 'collapseAll': {
fullAPI.collapseAll();
fullAPI.emit(STORIES_COLLAPSE_ALL);
break;
}
case 'expandAll': {
fullAPI.expandAll();
fullAPI.emit(STORIES_EXPAND_ALL);
break;
}
case 'remount': {
Expand Down
3 changes: 2 additions & 1 deletion code/core/src/manager/container/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { API, State } from '@storybook/core/manager-api';
import { shortcutToHumanString } from '@storybook/core/manager-api';
import { styled, useTheme } from '@storybook/core/theming';
import { CheckIcon, InfoIcon, ShareAltIcon, WandIcon } from '@storybook/icons';
import { STORIES_COLLAPSE_ALL } from '@storybook/core/core-events';

const focusableUIElements = {
storySearchField: 'storybook-explorer-searchfield',
Expand Down Expand Up @@ -222,7 +223,7 @@ export const useMenu = (
() => ({
id: 'collapse',
title: 'Collapse all',
onClick: () => api.collapseAll(),
onClick: () => api.emit(STORIES_COLLAPSE_ALL),
right: enableShortcuts ? <Shortcut keys={shortcutKeys.collapseAll} /> : null,
}),
[api, enableShortcuts, shortcutKeys]
Expand Down
4 changes: 4 additions & 0 deletions docs/api/portable-stories/portable-stories-jest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ sidebar:

Normally, Storybook composes a story and its [annotations](#annotations) automatically, as part of the [story pipeline](#story-pipeline). When using stories in Jest tests, you must handle the story pipeline yourself, which is what the [`composeStories`](#composestories) and [`composeStory`](#composestory) functions enable.

<Callout variant="info">
The API specified here is available in Storybook `8.2.7` and up. If you're using an older version of Storybook, you can upgrade to the latest version (`npx storybook@latest upgrade`) to use this API. If you're unable to upgrade, you can use previous API, which uses the `.play()` method instead of `.run()`, but is otherwise identical.
</Callout>

<If renderer="react">
<Callout variant="info">
**Using `Next.js`?** You need to do three things differently when using portable stories in Jest with Next.js projects:
Expand Down
4 changes: 4 additions & 0 deletions docs/api/portable-stories/portable-stories-vitest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ sidebar:

Normally, Storybook composes a story and its [annotations](#annotations) automatically, as part of the [story pipeline](#story-pipeline). When using stories in Vitest tests, you must handle the story pipeline yourself, which is what the [`composeStories`](#composestories) and [`composeStory`](#composestory) functions enable.

<Callout variant="info">
The API specified here is available in Storybook `8.2.7` and up. If you're using an older version of Storybook, you can upgrade to the latest version (`npx storybook@latest upgrade`) to use this API. If you're unable to upgrade, you can use previous API, which uses the `.play()` method instead of `.run()`, but is otherwise identical.
</Callout>

<If renderer="react">
<Callout variant="warning">
**Using `Next.js`?** Next.js requires specific configuration that is only available in [Jest](./portable-stories-jest.mdx). The portable stories API is not supported in Next.js with Vitest.
Expand Down

0 comments on commit 12f8343

Please sign in to comment.