2023-05-06 15:49:37 +08:00
|
|
|
import * as React from 'react';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2022-09-22 16:15:00 +08:00
|
|
|
import Divider from '..';
|
|
|
|
import mountTest from '../../../tests/shared/mountTest';
|
2023-06-03 18:16:28 +08:00
|
|
|
import { render } from '../../../tests/utils';
|
2022-09-22 16:15:00 +08:00
|
|
|
|
|
|
|
describe('Divider', () => {
|
|
|
|
mountTest(Divider);
|
|
|
|
|
|
|
|
it('not show children when vertical', () => {
|
2023-06-07 21:59:21 +08:00
|
|
|
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
2022-09-22 16:15:00 +08:00
|
|
|
|
|
|
|
const { container } = render(<Divider type="vertical">Bamboo</Divider>);
|
2023-06-03 18:16:28 +08:00
|
|
|
expect(container.querySelector<HTMLSpanElement>('.ant-divider-inner-text')).toBeFalsy();
|
2022-09-22 16:15:00 +08:00
|
|
|
|
|
|
|
errSpy.mockRestore();
|
|
|
|
});
|
2023-06-03 18:16:28 +08:00
|
|
|
|
|
|
|
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,
|
|
|
|
});
|
|
|
|
});
|
2024-06-30 17:09:51 +08:00
|
|
|
|
|
|
|
it('support bool dashed', () => {
|
|
|
|
const { container } = render(
|
|
|
|
<Divider dashed>
|
|
|
|
test test test
|
|
|
|
</Divider>,
|
|
|
|
);
|
|
|
|
expect(container?.querySelector<HTMLSpanElement>('.ant-divider-dashed')).toHaveStyle({
|
|
|
|
borderStyle: 'dashed',
|
|
|
|
});
|
|
|
|
});
|
2024-07-01 23:17:48 +08:00
|
|
|
|
|
|
|
it('support string variant', () => {
|
|
|
|
const { container } = render(
|
|
|
|
<Divider variant="dotted">
|
|
|
|
test dotted
|
|
|
|
</Divider>,
|
|
|
|
);
|
|
|
|
expect(container?.querySelector<HTMLSpanElement>('.ant-divider-dotted')).toHaveStyle({
|
|
|
|
borderStyle: 'dotted',
|
|
|
|
});
|
|
|
|
});
|
2022-09-22 16:15:00 +08:00
|
|
|
});
|