diff --git a/docs/examples/custom-icon.tsx b/docs/examples/custom-icon.tsx index 59daa7b8..ededd54b 100644 --- a/docs/examples/custom-icon.tsx +++ b/docs/examples/custom-icon.tsx @@ -22,10 +22,11 @@ const clearPath = ' 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-' + '28.7 64-64V306c0-35.3-28.7-64-64-64z'; -const menuItemSelectedIcon = (props) => { - const { ...p } = props; - return {p.isSelected ? '🌹' : '☑️'}; -}; +const menuItemSelectedIcon = (props) => ( + + {props.isSelected ? '🌹' : '☑️'} + +); const singleItemIcon = ( diff --git a/src/OptionList.tsx b/src/OptionList.tsx index dd4f034d..abef1726 100644 --- a/src/OptionList.tsx +++ b/src/OptionList.tsx @@ -372,7 +372,11 @@ const OptionList: React.ForwardRefRenderFunction = (_, r {selected ? '✓' : null} diff --git a/tests/Select.test.tsx b/tests/Select.test.tsx index 1a0634b2..2825097f 100644 --- a/tests/Select.test.tsx +++ b/tests/Select.test.tsx @@ -1489,6 +1489,7 @@ describe('Select.Basic', () => { it('dropdown selection item customize icon', () => { const menuItemSelectedIcon = jest.fn(); + mount( , + ); + expect(menuItemSelectedIcon).toHaveBeenCalledWith({ + value: '2', + disabled: true, + isSelected: false, + }); }); it('keyDown & KeyUp event', () => {