Skip to content

Commit 0285c3e

Browse files
committed
test: add unit test for editable Tabs component with custom classNames and styles
1 parent 2dce5f6 commit 0285c3e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/index.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,4 +775,28 @@ describe('Tabs.Basic', () => {
775775
expect(content).toHaveStyle({ background: 'green' });
776776
expect(header).toHaveStyle({ background: 'yellow' });
777777
});
778+
779+
it('support classnames and styles for editable', () => {
780+
const customClassNames = {
781+
close: 'custom-close',
782+
};
783+
const customStyles = {
784+
close: { background: 'red' },
785+
};
786+
787+
const { container } = render(
788+
<Tabs
789+
editable={{
790+
onEdit: () => {},
791+
}}
792+
tabPosition="left"
793+
items={[{ key: 'test', label: 'test', icon: 'test' }]}
794+
styles={customStyles}
795+
classNames={customClassNames}
796+
/>,
797+
);
798+
799+
expect(container.querySelector('.rc-tabs-tab-remove')).toHaveClass('custom-close');
800+
expect(container.querySelector('.rc-tabs-tab-remove')).toHaveStyle({ background: 'red' });
801+
});
778802
});

0 commit comments

Comments
 (0)