Skip to content

test(chromatic): improve snapshots #5140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
padding: 0;
}

.chromaticPopoverContainer {
height: 500px;
width: 500px;
display: flex;
align-items: center;
}

.infoTable {
margin: 1rem 0;
border-spacing: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type Story = StoryObj<typeof meta>;

export const Default: Story = {
render(args) {
const [actionSheetOpen, setActionSheetOpen] = useState(isChromatic || args.open);
const [actionSheetOpen, setActionSheetOpen] = useState<boolean | undefined>(isChromatic || args.open);
const containerClass = isChromatic ? 'chromaticPopoverContainer' : undefined;
return (
<div>
<div className={containerClass}>
<Button
onClick={() => {
setActionSheetOpen(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ const meta = {
title: 'Modals & Popovers / SelectDialog',
component: OriginalSelectDialog,
argTypes: { children: { control: { disable: true } } },
args: { headerText: 'Select Product' }
args: { headerText: 'Select Product' },
parameters: {
chromatic: { delay: 1000 }
}
} satisfies Meta<typeof OriginalSelectDialog>;

export default meta;
Expand All @@ -35,7 +38,7 @@ const listItems = [
];
export const Default: Story = {
render: (args) => {
const [open, setOpen] = useState(isChromatic || args.open);
const [open, setOpen] = useState<boolean | undefined>(isChromatic || args.open);
const onButtonClick = () => {
setOpen(true);
};
Expand Down
3 changes: 3 additions & 0 deletions packages/main/src/components/Toolbar/Toolbar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const meta = {
args: {
design: ToolbarDesign.Auto,
toolbarStyle: ToolbarStyle.Standard
},
parameters: {
chromatic: { delay: 1000 }
}
} satisfies Meta<typeof Toolbar>;

Expand Down