Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Selector/SingleSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const SingleSelector: React.FC<SelectorProps> = (props) => {
}, [combobox, activeValue]);

// Not show text when closed expect combobox mode
const hasTextInput = mode !== 'combobox' && !open ? false : !!inputValue;
const hasTextInput = mode !== 'combobox' && !open && !showSearch ? false : !!inputValue;

const title =
item && (typeof item.label === 'string' || typeof item.label === 'number')
Expand Down
10 changes: 10 additions & 0 deletions tests/Select.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1775,4 +1775,14 @@ describe('Select.Basic', () => {
wrapper.simulate('click');
expect(onClick).toHaveBeenCalled();
});

it('should hide placeholder if force closed and showSearch with searchValue', () => {
const wrapper = mount(
<Select showSearch searchValue="search" open={false} placeholder="placeholder" />,
);
expect(
(wrapper.find('.rc-select-selection-placeholder').getDOMNode() as HTMLSpanElement).style
.visibility,
).toBe('hidden');
});
});