mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 13:18:04 +08:00
441ba5f5d1
* fix: Select style without hash * fix: common style logic * fix: lint * fix: menu style * chore: update checkbox demo * chore: fix test * chore: rm test
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { SearchOutlined } from '@ant-design/icons';
|
|
import React from 'react';
|
|
import Button from 'antd/es/button';
|
|
import ConfigProvider from '..';
|
|
import { render } from '../../../tests/utils';
|
|
|
|
describe('ConfigProvider.button', () => {
|
|
beforeEach(() => {
|
|
(global as any).triggerProps = null;
|
|
});
|
|
|
|
it('ConfigProvider button style', () => {
|
|
const { container } = render(
|
|
<ConfigProvider>
|
|
<Button style={{ fontSize: '14px' }} />
|
|
</ConfigProvider>,
|
|
);
|
|
|
|
const item = container.querySelector('button') as HTMLElement;
|
|
expect(getComputedStyle(item)?.fontSize).toBe('14px');
|
|
});
|
|
|
|
it('ConfigProvider button className', () => {
|
|
const { container } = render(
|
|
<ConfigProvider>
|
|
<Button className="custom-class" />
|
|
</ConfigProvider>,
|
|
);
|
|
|
|
expect(container.querySelector('button')?.className.includes('custom-class')).toBe(true);
|
|
});
|
|
|
|
it('ConfigProvider button styles', () => {
|
|
const { container } = render(
|
|
<ConfigProvider button={{ styles: { icon: { fontSize: 14 } } }}>
|
|
<Button icon={<SearchOutlined />} />
|
|
</ConfigProvider>,
|
|
);
|
|
|
|
const item = container.querySelector('.ant-btn-icon') as HTMLElement;
|
|
expect(getComputedStyle(item)?.fontSize).toBe('14px');
|
|
});
|
|
|
|
it('ConfigProvider button classNames', () => {
|
|
const { container } = render(
|
|
<ConfigProvider button={{ classNames: { icon: 'icon-custom-class' } }}>
|
|
<Button icon={<SearchOutlined />} />
|
|
</ConfigProvider>,
|
|
);
|
|
|
|
expect(container.querySelector('.ant-btn-icon')?.className.includes('custom-class')).toBe(true);
|
|
});
|
|
});
|