import React from 'react';
import ConfigProvider from '..';
import { render } from '../../../tests/utils';
import Divider from '../../divider';
import Image from '../../image';
import Segmented from '../../segmented';
import Space from '../../space';
import Spin from '../../spin';
import Steps from '../../steps';
import Typography from '../../typography';
describe('ConfigProvider support style and className props', () => {
it('Should Space classNames works', () => {
const { container } = render(
Text1
Text2
,
);
expect(container.querySelector('.ant-space-item')).toHaveClass('test-classNames');
});
it('Should Space className works', () => {
const { container } = render(
Text1
Text2
,
);
expect(container.querySelector('.ant-space')).toHaveClass('test-classNames');
});
it('Should Space styles works', () => {
const { container } = render(
Text1
Text2
,
);
expect(container.querySelector('.ant-space-item')).toHaveStyle(
'margin-right: 8px; color: red;',
);
});
it('Should Space style works', () => {
const { container } = render(
Text1
Text2
,
);
expect(container.querySelector('.ant-space')).toHaveStyle('color: red;');
});
it('Should Divider className works', () => {
const { container } = render(
,
);
expect(container.querySelector('.ant-divider')).toHaveClass('config-provider-className');
});
it('Should Divider style works', () => {
const { container } = render(
,
);
expect(container.querySelector('.ant-divider'))?.toHaveStyle({ color: 'red', height: '80px' });
});
it('Should Typography className & style works', () => {
const { container } = render(
test
,
);
const element = container.querySelector('.ant-typography');
expect(element).toHaveClass('cp-typography');
expect(element).toHaveStyle({ backgroundColor: 'red' });
});
it('Should Spin className & style works', () => {
const { container } = render(
,
);
const element = container.querySelector('.ant-spin');
expect(element).toHaveClass('config-provider-spin');
expect(element).toHaveStyle({ backgroundColor: 'red' });
});
it('Should Segmented className & style works', () => {
const { container } = render(
,
);
const element = container.querySelector('.ant-segmented');
expect(element).toHaveClass('config-provider-segmented');
expect(element).toHaveStyle({ backgroundColor: 'red' });
});
it('Should Steps className & style works', () => {
const { container } = render(
,
);
const element = container.querySelector('.ant-steps');
expect(element).toHaveClass('config-provider-steps');
expect(element).toHaveStyle({ backgroundColor: 'red' });
});
it('Should Image className & style works', () => {
const { container } = render(
,
);
const element = container
?.querySelector('.ant-image')
?.querySelector('img');
expect(element).toHaveClass('config-provider-image');
expect(element).toHaveStyle({ backgroundColor: 'red' });
});
});