Skip to content

Commit 1c15df5

Browse files
authored
test(chromatic): improve snapshots (#5140)
1 parent 316d84b commit 1c15df5

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

.storybook/preview-head.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@
6464
padding: 0;
6565
}
6666

67+
.chromaticPopoverContainer {
68+
height: 500px;
69+
width: 500px;
70+
display: flex;
71+
align-items: center;
72+
}
73+
6774
.infoTable {
6875
margin: 1rem 0;
6976
border-spacing: 0;

packages/main/src/components/ActionSheet/ActionSheet.stories.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ type Story = StoryObj<typeof meta>;
4141

4242
export const Default: Story = {
4343
render(args) {
44-
const [actionSheetOpen, setActionSheetOpen] = useState(isChromatic || args.open);
44+
const [actionSheetOpen, setActionSheetOpen] = useState<boolean | undefined>(isChromatic || args.open);
45+
const containerClass = isChromatic ? 'chromaticPopoverContainer' : undefined;
4546
return (
46-
<div>
47+
<div className={containerClass}>
4748
<Button
4849
onClick={() => {
4950
setActionSheetOpen(true);

packages/main/src/components/SelectDialog/SelectDialog.stories.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const meta = {
1515
title: 'Modals & Popovers / SelectDialog',
1616
component: OriginalSelectDialog,
1717
argTypes: { children: { control: { disable: true } } },
18-
args: { headerText: 'Select Product' }
18+
args: { headerText: 'Select Product' },
19+
parameters: {
20+
chromatic: { delay: 1000 }
21+
}
1922
} satisfies Meta<typeof OriginalSelectDialog>;
2023

2124
export default meta;
@@ -35,7 +38,7 @@ const listItems = [
3538
];
3639
export const Default: Story = {
3740
render: (args) => {
38-
const [open, setOpen] = useState(isChromatic || args.open);
41+
const [open, setOpen] = useState<boolean | undefined>(isChromatic || args.open);
3942
const onButtonClick = () => {
4043
setOpen(true);
4144
};

packages/main/src/components/Toolbar/Toolbar.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ const meta = {
3333
args: {
3434
design: ToolbarDesign.Auto,
3535
toolbarStyle: ToolbarStyle.Standard
36+
},
37+
parameters: {
38+
chromatic: { delay: 1000 }
3639
}
3740
} satisfies Meta<typeof Toolbar>;
3841

0 commit comments

Comments
 (0)