You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
588 lines
16 KiB
588 lines
16 KiB
6 years ago
|
import moment from 'moment';
|
||
3 years ago
|
import React from 'react';
|
||
6 years ago
|
import ConfigProvider from '..';
|
||
|
import Alert from '../../alert';
|
||
|
import Anchor from '../../anchor';
|
||
|
import AutoComplete from '../../auto-complete';
|
||
|
import Avatar from '../../avatar';
|
||
|
import BackTop from '../../back-top';
|
||
|
import Badge from '../../badge';
|
||
|
import Breadcrumb from '../../breadcrumb';
|
||
|
import Button from '../../button';
|
||
|
import Calendar from '../../calendar';
|
||
|
import Card from '../../card';
|
||
|
import Carousel from '../../carousel';
|
||
|
import Cascader from '../../cascader';
|
||
|
import Checkbox from '../../checkbox';
|
||
|
import Collapse from '../../collapse';
|
||
|
import Comment from '../../comment';
|
||
|
import DatePicker from '../../date-picker';
|
||
|
import Divider from '../../divider';
|
||
|
import Drawer from '../../drawer';
|
||
|
import Dropdown from '../../dropdown';
|
||
5 years ago
|
import Empty from '../../empty';
|
||
6 years ago
|
import Form from '../../form';
|
||
3 years ago
|
import { Col, Row } from '../../grid';
|
||
6 years ago
|
import Input from '../../input';
|
||
|
import InputNumber from '../../input-number';
|
||
|
import Layout from '../../layout';
|
||
|
import List from '../../list';
|
||
|
import Menu from '../../menu';
|
||
|
import Modal from '../../modal';
|
||
5 years ago
|
import PageHeader from '../../page-header';
|
||
3 years ago
|
import Pagination from '../../pagination';
|
||
6 years ago
|
import Popconfirm from '../../popconfirm';
|
||
|
import Popover from '../../popover';
|
||
|
import Progress from '../../progress';
|
||
|
import Radio from '../../radio';
|
||
|
import Rate from '../../rate';
|
||
|
import Select from '../../select';
|
||
|
import Skeleton from '../../skeleton';
|
||
|
import Slider from '../../slider';
|
||
|
import Spin from '../../spin';
|
||
|
import Statistic from '../../statistic';
|
||
|
import Steps from '../../steps';
|
||
|
import Switch from '../../switch';
|
||
2 years ago
|
import type { ColumnsType } from '../../table';
|
||
6 years ago
|
import Table from '../../table';
|
||
|
import Tabs from '../../tabs';
|
||
|
import Tag from '../../tag';
|
||
|
import TimePicker from '../../time-picker';
|
||
|
import Timeline from '../../timeline';
|
||
|
import Tooltip from '../../tooltip';
|
||
|
import Transfer from '../../transfer';
|
||
|
import Tree from '../../tree';
|
||
|
import TreeSelect from '../../tree-select';
|
||
|
import Upload from '../../upload';
|
||
2 years ago
|
import { render } from '../../../tests/utils';
|
||
6 years ago
|
|
||
|
jest.mock('rc-util/lib/Portal');
|
||
|
|
||
|
describe('ConfigProvider', () => {
|
||
|
describe('components', () => {
|
||
2 years ago
|
function testPair(name: string, renderComponent: (props?: any) => React.ReactElement): void {
|
||
2 years ago
|
const isArray = ['Menu', 'TimePicker', 'Tooltip'].includes(name);
|
||
6 years ago
|
describe(`${name}`, () => {
|
||
6 years ago
|
// normal
|
||
|
it('normal', () => {
|
||
2 years ago
|
const { container } = render(renderComponent({}));
|
||
|
expect(isArray ? Array.from(container.children) : container.firstChild).toMatchSnapshot();
|
||
6 years ago
|
});
|
||
|
|
||
|
// prefixCls
|
||
|
it('prefixCls', () => {
|
||
2 years ago
|
const { container } = render(renderComponent({ prefixCls: `prefix-${name}` }));
|
||
|
expect(isArray ? Array.from(container.children) : container.firstChild).toMatchSnapshot();
|
||
6 years ago
|
});
|
||
|
|
||
|
// configProvider
|
||
|
it('configProvider', () => {
|
||
2 years ago
|
const { container } = render(
|
||
|
<ConfigProvider pageHeader={{ ghost: false }} prefixCls="config">
|
||
|
{renderComponent({})}
|
||
|
</ConfigProvider>,
|
||
|
);
|
||
|
expect(isArray ? Array.from(container.children) : container.firstChild).toMatchSnapshot();
|
||
6 years ago
|
});
|
||
5 years ago
|
|
||
|
it('configProvider componentSize large', () => {
|
||
2 years ago
|
const { container } = render(
|
||
|
<ConfigProvider componentSize="large" prefixCls="config">
|
||
|
{renderComponent({})}
|
||
|
</ConfigProvider>,
|
||
|
);
|
||
|
expect(isArray ? Array.from(container.children) : container.firstChild).toMatchSnapshot();
|
||
5 years ago
|
});
|
||
|
|
||
|
it('configProvider componentSize middle', () => {
|
||
2 years ago
|
const { container } = render(
|
||
|
<ConfigProvider componentSize="middle" prefixCls="config">
|
||
|
{renderComponent({})}
|
||
|
</ConfigProvider>,
|
||
|
);
|
||
|
expect(isArray ? Array.from(container.children) : container.firstChild).toMatchSnapshot();
|
||
5 years ago
|
});
|
||
5 years ago
|
|
||
3 years ago
|
it('configProvider componentDisabled', () => {
|
||
2 years ago
|
const { container } = render(
|
||
|
<ConfigProvider componentDisabled prefixCls="config">
|
||
|
{renderComponent({})}
|
||
|
</ConfigProvider>,
|
||
|
);
|
||
|
expect(isArray ? Array.from(container.children) : container.firstChild).toMatchSnapshot();
|
||
3 years ago
|
});
|
||
|
|
||
5 years ago
|
it('configProvider virtual and dropdownMatchSelectWidth', () => {
|
||
|