Skip to content

Commit

Permalink
Merge pull request #608 from sebgroup/develop
Browse files Browse the repository at this point in the history
new beta release
  • Loading branch information
mario-subo authored May 5, 2021
2 parents b4c2b4b + 436f2fc commit 3f96f3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ describe("Component: Dropdown", () => {
act(() => Simulate.change(searchField, { target: { value: "second" } as any }));

expect(document.body.querySelectorAll(".custom-control")).toHaveLength(1);

// if the searchable prop is changed back to false
act(() => {
render(<Dropdown>{testOptions}</Dropdown>, container);
});

// The search field should be reset to empty string
// so all the elements should be visible again
expect(document.body.querySelectorAll(".custom-control")).toHaveLength(4);
});

it("Should allow the value to be cleared when clearable is enabled", () => {
Expand Down
4 changes: 4 additions & 0 deletions lib/src/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ export const Dropdown: React.FC<DropdownProps> = React.forwardRef(
!isMobile && props.multiple && setAllSelected(isAllSelected());
}, [props.value]);

React.useEffect(() => {
!searchable && setSearchKeyword("");
}, [searchable]);

React.useEffect(() => {
if (!isMobile) {
const detectBlur = (event: MouseEvent) => {
Expand Down

0 comments on commit 3f96f3d

Please sign in to comment.