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: 2 additions & 0 deletions src/SelectInput/Content/SingleContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ const SingleContent = React.forwardRef<HTMLInputElement, SharedContentProps>(
className={clsx(
`${prefixCls}-content`,
displayValue && `${prefixCls}-content-has-value`,
mergedSearchValue && `${prefixCls}-content-has-search-value`,
hasOptionStyle && `${prefixCls}-content-has-option-style`,
classNames?.content,
)}
style={styles?.content}
Expand Down
18 changes: 18 additions & 0 deletions tests/Select.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,24 @@ describe('Select.Basic', () => {
);
});

it('should add -content-has-search-value className when searching', () => {
const { container } = render(<Select showSearch />);
const input = container.querySelector('input')!;
fireEvent.change(input, { target: { value: 'test' } });
expect(container.querySelector('.rc-select-content-has-search-value')).toBeTruthy();
});

it('should add -content-has-option-style when option has style', () => {
const { container } = render(
<Select defaultValue="1">
<Option value="1" style={{ color: 'red' }}>
One
</Option>
</Select>,
);
expect(container.querySelector('.rc-select-content-has-option-style')).toBeTruthy();
});

it('should default select the right option', () => {
const { container } = render(
<Select defaultValue="2">
Expand Down
Loading