test: config-provider case rewrite js => ts (#37194)

This commit is contained in:
lijianan 2022-08-23 15:40:32 +08:00 committed by GitHub
parent 7f49d221a0
commit 5c61ea7f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -43,6 +43,7 @@ import Spin from '../../spin';
import Statistic from '../../statistic';
import Steps from '../../steps';
import Switch from '../../switch';
import type { ColumnsType } from '../../table';
import Table from '../../table';
import Tabs from '../../tabs';
import Tag from '../../tag';
@ -59,7 +60,7 @@ jest.mock('rc-util/lib/Portal');
describe('ConfigProvider', () => {
describe('components', () => {
function testPair(name, renderComponent) {
function testPair(name: string, renderComponent: (props?: any) => React.ReactElement): void {
const isArray = ['Menu', 'TimePicker', 'Tooltip'].includes(name);
describe(`${name}`, () => {
// normal
@ -303,8 +304,8 @@ describe('ConfigProvider', () => {
// Grid
testPair('Grid', props => {
const rowProps = {};
const colProps = {};
const rowProps: { prefixCls?: string } = {};
const colProps: { prefixCls?: string } = {};
if (props.prefixCls) {
rowProps.prefixCls = 'prefix-row';
colProps.prefixCls = 'prefix-col';
@ -334,10 +335,10 @@ describe('ConfigProvider', () => {
// Layout
testPair('Layout', props => {
const siderProps = {};
const headerProps = {};
const contentProps = {};
const footerProps = {};
const siderProps: { prefixCls?: string } = {};
const headerProps: { prefixCls?: string } = {};
const contentProps: { prefixCls?: string } = {};
const footerProps: { prefixCls?: string } = {};
if (props.prefixCls) {
siderProps.prefixCls = 'prefix-sider';
headerProps.prefixCls = 'prefix-header';
@ -494,7 +495,7 @@ describe('ConfigProvider', () => {
// Table
testPair('Table', props => {
const columns = [
const columns: ColumnsType<any> = [
{
title: 'Name',
dataIndex: 'name',