mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-12 04:13:13 +08:00
test: config-provider case rewrite js => ts (#37194)
This commit is contained in:
parent
7f49d221a0
commit
5c61ea7f57
@ -43,6 +43,7 @@ import Spin from '../../spin';
|
|||||||
import Statistic from '../../statistic';
|
import Statistic from '../../statistic';
|
||||||
import Steps from '../../steps';
|
import Steps from '../../steps';
|
||||||
import Switch from '../../switch';
|
import Switch from '../../switch';
|
||||||
|
import type { ColumnsType } from '../../table';
|
||||||
import Table from '../../table';
|
import Table from '../../table';
|
||||||
import Tabs from '../../tabs';
|
import Tabs from '../../tabs';
|
||||||
import Tag from '../../tag';
|
import Tag from '../../tag';
|
||||||
@ -59,7 +60,7 @@ jest.mock('rc-util/lib/Portal');
|
|||||||
|
|
||||||
describe('ConfigProvider', () => {
|
describe('ConfigProvider', () => {
|
||||||
describe('components', () => {
|
describe('components', () => {
|
||||||
function testPair(name, renderComponent) {
|
function testPair(name: string, renderComponent: (props?: any) => React.ReactElement): void {
|
||||||
const isArray = ['Menu', 'TimePicker', 'Tooltip'].includes(name);
|
const isArray = ['Menu', 'TimePicker', 'Tooltip'].includes(name);
|
||||||
describe(`${name}`, () => {
|
describe(`${name}`, () => {
|
||||||
// normal
|
// normal
|
||||||
@ -303,8 +304,8 @@ describe('ConfigProvider', () => {
|
|||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
testPair('Grid', props => {
|
testPair('Grid', props => {
|
||||||
const rowProps = {};
|
const rowProps: { prefixCls?: string } = {};
|
||||||
const colProps = {};
|
const colProps: { prefixCls?: string } = {};
|
||||||
if (props.prefixCls) {
|
if (props.prefixCls) {
|
||||||
rowProps.prefixCls = 'prefix-row';
|
rowProps.prefixCls = 'prefix-row';
|
||||||
colProps.prefixCls = 'prefix-col';
|
colProps.prefixCls = 'prefix-col';
|
||||||
@ -334,10 +335,10 @@ describe('ConfigProvider', () => {
|
|||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
testPair('Layout', props => {
|
testPair('Layout', props => {
|
||||||
const siderProps = {};
|
const siderProps: { prefixCls?: string } = {};
|
||||||
const headerProps = {};
|
const headerProps: { prefixCls?: string } = {};
|
||||||
const contentProps = {};
|
const contentProps: { prefixCls?: string } = {};
|
||||||
const footerProps = {};
|
const footerProps: { prefixCls?: string } = {};
|
||||||
if (props.prefixCls) {
|
if (props.prefixCls) {
|
||||||
siderProps.prefixCls = 'prefix-sider';
|
siderProps.prefixCls = 'prefix-sider';
|
||||||
headerProps.prefixCls = 'prefix-header';
|
headerProps.prefixCls = 'prefix-header';
|
||||||
@ -494,7 +495,7 @@ describe('ConfigProvider', () => {
|
|||||||
|
|
||||||
// Table
|
// Table
|
||||||
testPair('Table', props => {
|
testPair('Table', props => {
|
||||||
const columns = [
|
const columns: ColumnsType<any> = [
|
||||||
{
|
{
|
||||||
title: 'Name',
|
title: 'Name',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
Loading…
Reference in New Issue
Block a user