Skip to content

Commit 49d0155

Browse files
authored
Merge branch 'next' into tom/23347-story-globals
2 parents 99fb271 + d419bc6 commit 49d0155

File tree

5 files changed

+35
-15
lines changed

5 files changed

+35
-15
lines changed

code/core/src/manager-api/modules/shortcuts.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
/* eslint-disable @typescript-eslint/naming-convention */
22
import { global } from '@storybook/global';
3-
import { FORCE_REMOUNT, PREVIEW_KEYDOWN } from '@storybook/core/core-events';
3+
import {
4+
FORCE_REMOUNT,
5+
PREVIEW_KEYDOWN,
6+
STORIES_COLLAPSE_ALL,
7+
STORIES_EXPAND_ALL,
8+
} from '@storybook/core/core-events';
49

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

@@ -356,11 +361,11 @@ export const init: ModuleFn = ({ store, fullAPI, provider }) => {
356361
break;
357362
}
358363
case 'collapseAll': {
359-
fullAPI.collapseAll();
364+
fullAPI.emit(STORIES_COLLAPSE_ALL);
360365
break;
361366
}
362367
case 'expandAll': {
363-
fullAPI.expandAll();
368+
fullAPI.emit(STORIES_EXPAND_ALL);
364369
break;
365370
}
366371
case 'remount': {

code/core/src/manager/components/preview/Iframe.stories.tsx

+17-11
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,23 @@ WorkingStory.parameters = {
6060
chromatic: { disable: true },
6161
};
6262

63-
export const MissingStory = () => (
64-
<IFrame
65-
active
66-
id="iframe"
67-
title="Missing"
68-
src="/iframe.html?id=missing"
69-
allowFullScreen
70-
style={style}
71-
scale={1.0}
72-
/>
73-
);
63+
export const MissingStory = {
64+
render: () => (
65+
<IFrame
66+
active
67+
id="iframe"
68+
title="Missing"
69+
src="/iframe.html?id=missing"
70+
allowFullScreen
71+
style={style}
72+
scale={1.0}
73+
/>
74+
),
75+
parameters: {
76+
// Raise the threshold to ignore monospace font inconsistencies
77+
chromatic: { diffThreshold: 0.65 },
78+
},
79+
};
7480

7581
export const PreparingStory = () => (
7682
<IFrame

code/core/src/manager/container/Menu.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { API, State } from '@storybook/core/manager-api';
66
import { shortcutToHumanString } from '@storybook/core/manager-api';
77
import { styled, useTheme } from '@storybook/core/theming';
88
import { CheckIcon, InfoIcon, ShareAltIcon, WandIcon } from '@storybook/icons';
9+
import { STORIES_COLLAPSE_ALL } from '@storybook/core/core-events';
910

1011
const focusableUIElements = {
1112
storySearchField: 'storybook-explorer-searchfield',
@@ -222,7 +223,7 @@ export const useMenu = (
222223
() => ({
223224
id: 'collapse',
224225
title: 'Collapse all',
225-
onClick: () => api.collapseAll(),
226+
onClick: () => api.emit(STORIES_COLLAPSE_ALL),
226227
right: enableShortcuts ? <Shortcut keys={shortcutKeys.collapseAll} /> : null,
227228
}),
228229
[api, enableShortcuts, shortcutKeys]

docs/api/portable-stories/portable-stories-jest.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ sidebar:
1818

1919
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.
2020

21+
<Callout variant="info">
22+
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.
23+
</Callout>
24+
2125
<If renderer="react">
2226
<Callout variant="info">
2327
**Using `Next.js`?** You need to do three things differently when using portable stories in Jest with Next.js projects:

docs/api/portable-stories/portable-stories-vitest.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ sidebar:
2222

2323
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.
2424

25+
<Callout variant="info">
26+
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.
27+
</Callout>
28+
2529
<If renderer="react">
2630
<Callout variant="warning">
2731
**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.

0 commit comments

Comments
 (0)