Skip to content

Commit e2086b0

Browse files
committed
chore: add more cls
1 parent c7b5499 commit e2086b0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/SelectInput/Content/SingleContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ const SingleContent = React.forwardRef<HTMLInputElement, SharedContentProps>(
8989
className={clsx(
9090
`${prefixCls}-content`,
9191
displayValue && `${prefixCls}-content-has-value`,
92+
mergedSearchValue && `${prefixCls}-content-has-search-value`,
93+
hasOptionStyle && `${prefixCls}-content-has-option-style`,
9294
classNames?.content,
9395
)}
9496
style={styles?.content}

tests/Select.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,24 @@ describe('Select.Basic', () => {
255255
);
256256
});
257257

258+
it('should add -content-has-search-value className when searching', () => {
259+
const { container } = render(<Select showSearch />);
260+
const input = container.querySelector('input')!;
261+
fireEvent.change(input, { target: { value: 'test' } });
262+
expect(container.querySelector('.rc-select-content-has-search-value')).toBeTruthy();
263+
});
264+
265+
it('should add -content-value when option has style', () => {
266+
const { container } = render(
267+
<Select defaultValue="1">
268+
<Option value="1" style={{ color: 'red' }}>
269+
One
270+
</Option>
271+
</Select>,
272+
);
273+
expect(container.querySelector('.rc-select-content-value')).toBeTruthy();
274+
});
275+
258276
it('should default select the right option', () => {
259277
const { container } = render(
260278
<Select defaultValue="2">

0 commit comments

Comments
 (0)