Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nova1751/select
Browse files Browse the repository at this point in the history
  • Loading branch information
nova1751 committed Mar 2, 2024
2 parents 9692325 + 640f7f3 commit 4a730b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/Selector/MultipleSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ const SelectSelector: React.FC<SelectorProps> = (props) => {
? searchValue
: '';
const inputEditable: boolean =
mode === 'tags' ||
(mode === 'multiple' && autoClearSearchValue === false) ||
(showSearch && (open || focused));
mode === 'tags' || (mode === 'multiple' && showSearch) || (showSearch && (open || focused));

// We measure width and set to the input immediately
useLayoutEffect(() => {
Expand Down
11 changes: 11 additions & 0 deletions tests/Multiple.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -681,5 +681,16 @@ describe('Select.Multiple', () => {
toggleOpen(wrapper);
expect(wrapper.find('input').props().value).toBe('');
});
it('input should be readonly when autoClearSearchValue and showSearch are both false', () => {
const wrapper = mount(
<Select
mode="multiple"
autoClearSearchValue={false}
showSearch={false}
searchValue="test"
/>,
);
expect(wrapper.find('input').props().readOnly).toBe(true);
});
});
});

0 comments on commit 4a730b7

Please sign in to comment.