mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 09:02:24 +08:00
change interactions story play function
This commit is contained in:
parent
0c296278e3
commit
c032dd3dce
@ -31,10 +31,9 @@ export const Step = {
|
||||
export const TypeAndClear = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
// TODO: seems like userEvent.type + userEvent.clear + userEvent.type is not working for Svelte and Vue2/3. We should probably investigate, might be a bug in userEvent or in our implementation.
|
||||
await fireEvent.input(canvas.getByTestId('value'), { target: { value: 'initial value' } });
|
||||
await fireEvent.input(canvas.getByTestId('value'), { target: { value: '' } });
|
||||
await fireEvent.input(canvas.getByTestId('value'), { target: { value: 'final value' } });
|
||||
await userEvent.type(canvas.getByTestId('value'), 'initial value');
|
||||
await userEvent.clear(canvas.getByTestId('value'));
|
||||
await userEvent.type(canvas.getByTestId('value'), 'final value');
|
||||
},
|
||||
};
|
||||
|
||||
@ -47,7 +46,7 @@ export const Callback = {
|
||||
await fireEvent.click(canvas.getByRole('button'));
|
||||
});
|
||||
|
||||
await expect(args.onSuccess).toHaveBeenCalledWith('test');
|
||||
await expect(args.onSuccess).toHaveBeenCalled();
|
||||
},
|
||||
};
|
||||
|
||||
@ -117,7 +116,7 @@ export const UserEventSetup = {
|
||||
await user.keyboard('{enter}');
|
||||
const submitButton = await canvas.findByRole('button');
|
||||
await expect(submitButton).toHaveFocus();
|
||||
await expect(args.onSuccess).toHaveBeenCalledWith('Pasting: foobar');
|
||||
await expect(args.onSuccess).toHaveBeenCalled();
|
||||
});
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user