test: add test case (#42800)

This commit is contained in:
lijianan 2023-06-03 18:16:28 +08:00 committed by GitHub
parent 26ab02f38a
commit 71c155f043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { render } from '../../../tests/utils';
import Divider from '..';
import mountTest from '../../../tests/shared/mountTest';
import { render } from '../../../tests/utils';
describe('Divider', () => {
mountTest(Divider);
@ -10,8 +10,19 @@ describe('Divider', () => {
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const { container } = render(<Divider type="vertical">Bamboo</Divider>);
expect(container.querySelector('.ant-divider-inner-text')).toBeFalsy();
expect(container.querySelector<HTMLSpanElement>('.ant-divider-inner-text')).toBeFalsy();
errSpy.mockRestore();
});
it('support string orientationMargin', () => {
const { container } = render(
<Divider orientation="right" orientationMargin="10">
test test test
</Divider>,
);
expect(container?.querySelector<HTMLSpanElement>('.ant-divider-inner-text')).toHaveStyle({
marginRight: 10,
});
});
});