Skip to content
Prev Previous commit
Don't export test story
  • Loading branch information
mirka committed Aug 26, 2025
commit bc50407ac4cd9929f0927613e3afe50301cdbcd8
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,17 @@ export const AsyncValidation: StoryObj< typeof ValidatedInputControl > = {
/>
);
},
args: {
label: 'Text',
help: 'The word "error" will trigger an error asynchronously.',
required: true,
},
};

// Not exported - Only for testing purposes.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const AsyncValidationWithTest: StoryObj< typeof ValidatedInputControl > = {
...AsyncValidation,
play: async ( { canvasElement } ) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice and weird 😅 The first time I encountered I felt it was a bug. It'd be nice to trigger this intentionally from a button instead of executing it on load.

It makes it impossible to test/learn how this component works: for example, due to having this setup, the first user validation will trigger on change, not on blur. So I think I'd rather not have this if this can't be triggered by users.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair 😅 Unfortunately there's no way to disable the autoplay on the individual story pages. I'll keep the story unexported so it's still available for test purposes (Jest was a bit unreliable for this one).

const canvas = within( canvasElement );
await userEvent.click( canvas.getByRole( 'textbox' ) );
Expand Down Expand Up @@ -277,8 +288,3 @@ export const AsyncValidation: StoryObj< typeof ValidatedInputControl > = {
);
},
};
AsyncValidation.args = {
label: 'Text',
help: 'The word "error" will trigger an error asynchronously.',
required: true,
};
Loading