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
[Listbox] Hide input that documentation claims is hidden #570
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6e150dd:
|
@@ -197,6 +197,10 @@ describe("<Listbox />", () => { | |||
</Listbox> | |||
); | |||
expect(container.querySelector("input")).toBeTruthy(); | |||
expect(container.querySelector("input")).toHaveAttribute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we instead test that the input is visibly hidden with expect(container.querySelector("input")).not.toBeVisible()
? I'll probably change the implementation of this in the near future to address arrow form navigation on iOS.
expect(container.querySelector("input")).toBeTruthy(); | ||
// Be careful not to match the `input[type=text]` added in this test | ||
expect(container.querySelector("input[type=hidden]")).toBeTruthy(); | ||
expect(container.querySelector("input[type=hidden]")).toHaveAttribute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove these assertions, see comment above about future implementation changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Do you mean restoring the test to how it was? Or just removing all assertions in this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can revert these lines to the one line from before. Let's just keep the check for a standard input and use the not.toBeVisible
method to make sure it's hidden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 inputs, the first added by the test (<input type="text" name="name" />
not hidden) and the other added by listbox
(which is hidden).
So the test you propose fails.
Do you like this option which will work to get that second input?
expect(container.querySelectorAll("input")[1]).not.toBeVisible();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and pushed that up along with fixing the other line.
Thank you! Just a few small testing changes and I'll get this merged 👍 |
@chancestrickland Let me know if you're waiting on something from me. I think I've responded to your request for changes. |
This PR fixes #569.
Listbox is not hiding the generated
input
. But documentation and tests indicate the renderedinput
is hidden.type="hidden"
.With a Form
storybook.Thank you for contributing to Reach UI! Please fill in this template before submitting your PR to help us process your request more quickly.
yarn test
).yarn start
).This pull request:
If creating a new package:
examples
directorysrc
directory with anindex.tsx
entry filestyle.css
file (if needed by the new package)