mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
Fix default viewports
This commit is contained in:
parent
51f64f6c10
commit
6c4651b5ae
@ -3,7 +3,7 @@ import { UnsupportedViewportDimensionError } from 'storybook/internal/preview-er
|
||||
|
||||
import { page } from '@vitest/browser/context';
|
||||
|
||||
import { INITIAL_VIEWPORTS } from '../../../viewport/src/defaults';
|
||||
import { MINIMAL_VIEWPORTS } from '../../../viewport/src/defaults';
|
||||
import type { ViewportMap, ViewportStyles } from '../../../viewport/src/types';
|
||||
|
||||
declare global {
|
||||
@ -50,12 +50,12 @@ const parseDimension = (value: string, dimension: 'width' | 'height') => {
|
||||
export const setViewport = async (viewportsParam: ViewportsParam = {} as ViewportsParam) => {
|
||||
const defaultViewport = viewportsParam.defaultViewport;
|
||||
|
||||
if (!page || !globalThis.__vitest_browser__ || !defaultViewport) {
|
||||
if (!page || !globalThis.__vitest_browser__) {
|
||||
return;
|
||||
}
|
||||
|
||||
const viewports = {
|
||||
...INITIAL_VIEWPORTS,
|
||||
...MINIMAL_VIEWPORTS,
|
||||
...viewportsParam.viewports,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user