Skip to content

Commit

Permalink
[Listbox] Hide input that documentation claims is hidden (#570)
Browse files Browse the repository at this point in the history
* listbox: hide input (#569)

* listbox: simplify unit tests

* listbox: simplify another unit test
  • Loading branch information
ddanger committed May 11, 2020
1 parent e0e1b09 commit d8974d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/listbox/__tests__/listbox.test.tsx
Expand Up @@ -196,7 +196,7 @@ describe("<Listbox />", () => {
<ListboxOption value="lengua">Lengua</ListboxOption>
</Listbox>
);
expect(container.querySelector("input")).toBeTruthy();
expect(container.querySelector("input")).not.toBeVisible();
});
});

Expand All @@ -218,7 +218,8 @@ describe("<Listbox />", () => {
</Listbox>
</div>
);
expect(container.querySelector("input")).toBeTruthy();
// Make sure to get the second input (not the one added in the test)
expect(container.querySelectorAll("input")[1]).not.toBeVisible();
});
});

Expand All @@ -231,7 +232,7 @@ describe("<Listbox />", () => {
<ListboxOption value="lengua">Lengua</ListboxOption>
</Listbox>
);
expect(container.querySelector("input")).toBeTruthy();
expect(container.querySelector("input")).not.toBeVisible();
expect(container.querySelector("input")).toHaveAttribute("required");
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/listbox/src/index.tsx
Expand Up @@ -331,7 +331,7 @@ export const ListboxInput = forwardRef<
readOnly
required={required}
tabIndex={-1}
type="text"
type="hidden"
value={state.context.value || ""}
/>
)}
Expand Down

0 comments on commit d8974d6

Please sign in to comment.