You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should improve the documentation of portable stories to provide different use cases, such as:
Reusing the play function
Using loaders
Overwriting globals (e.g. rendering in english/spanish)
Asserting spies from mocked args e.g.
it('onclick handler is called',async()=>{constonClickSpy=vi.fn();render(<SecondaryonClick={onClickSpy}/>);constbuttonElement=screen.getByRole('button');buttonElement.click();expect(onClickSpy).toHaveBeenCalled();});// orit('onclick handler is called',async()=>{render(<Secondary/>);
constbuttonElement=screen.getByRole('button');buttonElement.click();expect(Secondary.args.onClick).toHaveBeenCalled();});// the example above will work as long as the story has a vi.fn defined like so:import{fn}from'@storybook/test';CSF2Secondary.args={onClick: fn(),};
- Asserting events emitted (vue)
As well as limitations, such as: - Story native formats (vue, svelte) are not supported
The text was updated successfully, but these errors were encountered:
We should improve the documentation of portable stories to provide different use cases, such as:
- Asserting events emitted (vue)As well as limitations, such as:- Story native formats (vue, svelte) are not supportedThe text was updated successfully, but these errors were encountered: