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
{{ message }}
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.
Describe the bug
I am facing an issue with the keyboard or type methods of userEvent.
TagsField.play=async({ canvasElement })=>{constcanvas=within(canvasElement);// wait for scripts to loadawaitnewPromise((resolve)=>setTimeout(resolve,1500));constevent=canvas.getByLabelText("Included brands",{selector: "input"});awaituserEvent.type(event," ");awaitnewPromise((resolve)=>setTimeout(resolve,1500));awaituserEvent.keyboard("{backspace}{backspace}");awaituserEvent.keyboard("{backspace}");};
I have this piece of code that plays the story. And I have also modified the functionalities for backspace to something else. Basically, a span is created upon pressing enter and when backspace is pressed, the whole span is removed and this functionality is achieved through javascript and I am also injecting that javascript code into the story as well. It's working fine with locally run webpack with human interaction, but when it's tested on storybook with testing-library, it doesn't seem to be doing its functionality. In fact, {backspace} doesn't remove any character at all.
FYI: I am using Storybook v7.4.3 and @storybook/testing-library v^0.2.1
This functionality was working fine with storybook v6.5.x but after migrating to v7.4.2, it stopped working.
To Reproduce
Steps to reproduce the behavior:
Write any story that uses the above code.
Run the storybook.
Go to the story & see the error.
Expected behavior
Expected @storybook/testing-library to work fine even after updating the storybook version to 7.4.3
Screenshots
If applicable, add screenshots to help explain your problem.
System
Please paste the results of npx storybook@latest info here.
Environment Info:
Hello,
I also have issues with userEvent.keyboard after migrating @storybook/testing-library from 0.1.0 to 0.2.2.
After rollbacking this package to 0.1.0 it's working properly (and no regression with other storybook 7.4 packages).
0.2.X versions are using @testing-library/user-event v14 which bring breaking changes on keyboard events.
More information here: testing-library/user-event#946
Root cause: testing-library/user-event#842 (comment)
They removed "non-standard" or "deprecated" code but it's now impossible for example to do a simple userEvent.keyboard("[Enter]") on a focused element.
According to me it's better to use native standard Javascript instead of those kind of librairies. To trigger an enter key we can do instead:
const event = new KeyboardEvent("keydown", { key: "Enter" });
myElement.dispatchEvent(event);
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
I am facing an issue with the
keyboard
ortype
methods ofuserEvent
.I have this piece of code that plays the story. And I have also modified the functionalities for
backspace
to something else. Basically, aspan
is created upon pressingenter
and whenbackspace
is pressed, the wholespan
is removed and this functionality is achieved through javascript and I am also injecting that javascript code into the story as well. It's working fine with locally run webpack with human interaction, but when it's tested on storybook with testing-library, it doesn't seem to be doing its functionality. In fact,{backspace}
doesn't remove any character at all.FYI: I am using Storybook v7.4.3 and @storybook/testing-library v^0.2.1
This functionality was working fine with storybook v6.5.x but after migrating to v7.4.2, it stopped working.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expected
@storybook/testing-library
to work fine even after updating the storybook version to 7.4.3Screenshots
If applicable, add screenshots to help explain your problem.
System
Please paste the results of
npx storybook@latest info
here.Environment Info:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: