Browse Source

chore: add type test

pull/38380/head
afc163 2 years ago
parent
commit
9cc228f2af
  1. 7
      components/date-picker/__tests__/type.test.tsx
  2. 18
      components/date-picker/generatePicker/generateRangePicker.tsx
  3. 2
      components/date-picker/generatePicker/generateSinglePicker.tsx

7
components/date-picker/__tests__/type.test.tsx

@ -58,4 +58,11 @@ describe('DatePicker.typescript', () => {
);
expect(datePicker).toBeTruthy();
});
it('DatePicker and RangePicker supports popupClassName', () => {
const datePicker = <DatePicker popupClassName="popupClassName" />;
expect(datePicker).toBeTruthy();
const rangePicker = <DatePicker.RangePicker popupClassName="popupClassName" />;
expect(rangePicker).toBeTruthy();
});
});

18
components/date-picker/generatePicker/generateRangePicker.tsx

@ -21,18 +21,16 @@ import { getRangePlaceholder, transPlacement2DropdownAlign } from '../util';
import type { CommonPickerMethods, PickerComponentClass } from './interface';
import warning from '../../_util/warning';
export default function generateRangePicker<DateType>(
generateConfig: GenerateConfig<DateType>,
) {
export default function generateRangePicker<DateType>(generateConfig: GenerateConfig<DateType>) {
type InternalRangePickerProps = RangePickerProps<DateType> & {};
type DateRangePickerProps = RangePickerProps<DateType> & {
/**
* @deprecated `dropdownClassName` is deprecated which will be removed in next major
* version.Please use `popupClassName` instead.
*/
dropdownClassName: string;
popupClassName?: string;
}
/**
* @deprecated `dropdownClassName` is deprecated which will be removed in next major
* version.Please use `popupClassName` instead.
*/
dropdownClassName?: string;
popupClassName?: string;
};
const RangePicker = forwardRef<
InternalRangePickerProps | CommonPickerMethods,

2
components/date-picker/generatePicker/generateSinglePicker.tsx

@ -8,7 +8,7 @@ import type { PickerMode } from 'rc-picker/lib/interface';
import * as React from 'react';
import { forwardRef, useContext, useImperativeHandle } from 'react';
import { useCompactItemContext } from '../../space/Compact';
import type { PickerDateProps, PickerProps, PickerTimeProps } from '.';
import type { PickerProps, PickerTimeProps } from '.';
import { Components, getTimeProps } from '.';
import { ConfigContext } from '../../config-provider';
import DisabledContext from '../../config-provider/DisabledContext';

Loading…
Cancel
Save