Skip to content

Commit

Permalink
test: add case
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Jan 6, 2023
1 parent 0dc7815 commit 2991e93
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions components/menu/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1047,4 +1047,34 @@ describe('Menu', () => {
);
errorSpy.mockRestore();
});

it('expandIconClassName', () => {
const Demo = ({ expandIcon }: Pick<MenuProps, 'expandIcon'>) => (
<Menu
expandIcon={expandIcon}
inlineCollapsed
items={[
{
label: 'Option 1',
key: '1',
icon: '112',
children: [
{
label: 'Option 1-1',
key: '1-1',
},
],
},
]}
/>
);

const { container, rerender } = render(
<Demo expandIcon={<span className="custom-expand-icon" />} />,
);
expect(container.querySelector('.custom-expand-icon')).toBeTruthy();

rerender(<Demo expandIcon={() => <span className="function-custom-expand-icon" />} />);
expect(container.querySelector('.function-custom-expand-icon')).toBeTruthy();
});
});

0 comments on commit 2991e93

Please sign in to comment.