Skip to content

Commit

Permalink
fix: use the right testing mode in Chromatic
Browse files Browse the repository at this point in the history
  • Loading branch information
haideralsh committed Dec 6, 2024
1 parent aecb78d commit d9fd903
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 13 deletions.
17 changes: 17 additions & 0 deletions .storybook/modes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const allModes = {
touch: {
locale: "en",
desktopScale: "standard",
theme: "touch",
},
desktop: {
locale: "en",
desktopScale: "standard",
theme: "touch",
},
experimental: {
locale: "en",
desktopScale: "experimental",
theme: "touch",
},
};
4 changes: 2 additions & 2 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { desktop as theme } from "../src/theme";
import { ALL_NDS_LOCALES, NDSProvider } from "../src";

const newViewports = {
const viewports = {
extraSmall: {
name: "Extra small",
styles: {
Expand Down Expand Up @@ -41,7 +41,7 @@ const newViewports = {
};

export const parameters = {
viewport: { viewports: newViewports },
viewport: { viewports },
layout: "padded",
options: {
storySort: {
Expand Down
2 changes: 1 addition & 1 deletion src/BottomSheet/stories/BottomSheet.actions.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import BottomSheet from "../BottomSheet";

export default {
title: "Components/BottomSheet/Actions",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
};

export const WithAHiddenCloseButton = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/BottomSheet/stories/BottomSheet.content.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import BottomSheet from "../BottomSheet";

export default {
title: "Components/BottomSheet/Content",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
};

export const WithHelpText = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/BottomSheet/stories/BottomSheet.features.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import BottomSheet from "../BottomSheet";

export default {
title: "Components/BottomSheet/Features",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
};

export const WithCustomWidths = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/BottomSheet/stories/BottomSheet.parts.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { BottomSheetParts as BottomSheet } from "../BottomSheet.parts";

export default {
title: "Components/BottomSheet/Parts",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
};

export const RenderedUsingCompositionalAPI = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/BottomSheet/stories/BottomSheet.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import BottomSheet from "../BottomSheet";

export default {
title: "Components/BottomSheet",
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
parameters: {
chromatic: { delay: 1000 },
},
decorators: [(storyFn) => <div style={{ width: "800px", height: "800px" }}>{storyFn()}</div>],
};

export const BasicUsage = () => {
Expand Down
7 changes: 5 additions & 2 deletions src/TopBar/stories/TopBar.backButton.story.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React from "react";
import { Link, BrowserRouter } from "react-router-dom";
import { TopBar } from "../TopBar";
import { allModes } from "../../../.storybook/modes";
import { legacy as theme } from "../../theme/theme";
import numberFromDimension from "../../utils/numberFromDimension";
import { TopBar } from "../TopBar";
import { menuItems } from "./fixtures";

export default {
parameters: {
layout: "fullscreen",
chromatic: {
viewports: [theme.breakpoints.small, theme.breakpoints.medium, theme.breakpoints.large].map(numberFromDimension),
delay: 1000,
modes: {
touch: allModes["touch"],
},
},
},
title: "Components/TopBar/BackLink",
Expand Down
8 changes: 6 additions & 2 deletions src/TopBar/stories/TopBar.menu.story.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import React from "react";
import { Link, BrowserRouter } from "react-router-dom";
import { TopBar } from "../TopBar";
import { allModes } from "../../../.storybook/modes";
import { legacy as theme } from "../../theme/theme";
import numberFromDimension from "../../utils/numberFromDimension";
import { TopBar } from "../TopBar";
import { menuItems } from "./fixtures";

export default {
parameters: {
layout: "fullscreen",
chromatic: {
viewports: [theme.breakpoints.small, theme.breakpoints.medium, theme.breakpoints.large].map(numberFromDimension),
delay: 1000,
viewports: [theme.breakpoints.small, theme.breakpoints.medium, theme.breakpoints.large].map(numberFromDimension),
modes: {
touch: allModes["touch"],
},
},
},
title: "Components/TopBar/Menu",
Expand Down
7 changes: 5 additions & 2 deletions src/TopBar/stories/TopBar.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ import { FormSection } from "../../Form";
import { Input } from "../../Input";
import { ApplicationFrame, Page } from "../../Layout";
import { TopBar } from "../TopBar";
import { allModes } from "../../../.storybook/modes";
import { legacy as theme } from "../../theme/theme";
import numberFromDimension from "../../utils/numberFromDimension";
import { menuItems } from "./fixtures";

export default {
title: "Components/TopBar",
parameters: {
layout: "fullscreen",
chromatic: {
viewports: [theme.breakpoints.small, theme.breakpoints.medium, theme.breakpoints.large].map(numberFromDimension),
delay: 1000,
modes: {
touch: allModes["touch"],
},
},
},
title: "Components/TopBar",
};

export const Default = () => (
Expand Down

0 comments on commit d9fd903

Please sign in to comment.