Skip to content

Commit 708722c

Browse files
authored
fix: Group title warning (#765)
1 parent de5d98d commit 708722c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/OptionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ const OptionList: React.ForwardRefRenderFunction<RefOptionListProps, OptionListP
292292

293293
// Group
294294
if (group) {
295-
const groupTitle = data.title ?? (isTitleType(label) && label);
295+
const groupTitle = data.title ?? (isTitleType(label) ? label.toString() : undefined);
296296

297297
return (
298298
<div

tests/Group.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,15 @@ describe('Select.Group', () => {
5555

5656
expect(wrapper.find('.rc-select-item-group').prop('title')).toEqual('bamboo');
5757
});
58+
59+
it('title as undefined', () => {
60+
const wrapper = mount(
61+
<Select open>
62+
<OptGroup label={<span>zombiej</span>} />
63+
</Select>,
64+
);
65+
66+
expect(wrapper.find('.rc-select-item-group').prop('title')).toBeUndefined();
67+
});
5868
});
5969
});

0 commit comments

Comments
 (0)