diff --git a/src/Selector/MultipleSelector.tsx b/src/Selector/MultipleSelector.tsx index b6f385717..8cc214b1b 100644 --- a/src/Selector/MultipleSelector.tsx +++ b/src/Selector/MultipleSelector.tsx @@ -102,6 +102,11 @@ const SelectSelector: React.FC = (props) => { className={classNames(`${selectionPrefixCls}-item`, { [`${selectionPrefixCls}-item-disabled`]: itemDisabled, })} + title={ + typeof content === 'string' || typeof content === 'number' + ? content.toString() + : undefined + } > {content} {closable && ( diff --git a/tests/Multiple.test.tsx b/tests/Multiple.test.tsx index 2e2e784d9..320b96e1f 100644 --- a/tests/Multiple.test.tsx +++ b/tests/Multiple.test.tsx @@ -262,10 +262,7 @@ describe('Select.Multiple', () => { ); toggleOpen(wrapper); - wrapper - .find('div.rc-select-item-option') - .at(1) - .simulate('mouseMove'); + wrapper.find('div.rc-select-item-option').at(1).simulate('mouseMove'); wrapper.find('input').simulate('keyDown', { which: KeyCode.ENTER }); expectOpen(wrapper); @@ -283,16 +280,10 @@ describe('Select.Multiple', () => { ); toggleOpen(wrapper); - wrapper - .find('div.rc-select-item-option') - .first() - .simulate('mousemove'); + wrapper.find('div.rc-select-item-option').first().simulate('mousemove'); wrapper.find('input').simulate('keyDown', { which: KeyCode.ENTER }); - wrapper - .find('div.rc-select-item-option') - .first() - .simulate('mousemove'); + wrapper.find('div.rc-select-item-option').first().simulate('mousemove'); wrapper.find('input').simulate('keyDown', { which: KeyCode.ENTER }); expect(wrapper.find('Selector').props().values).toEqual([]); @@ -448,18 +439,24 @@ describe('Select.Multiple', () => { const wrapper = mount( , + ); + expect(wrapper.find('.rc-select-selection-item').first().prop('title')).toBe('title'); + }); + + it('should not render title defaultly when label is ReactNode', () => { + const wrapper = mount( +