Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(DatePicker): RangePicker support rootClassName #44057

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion components/date-picker/__tests__/demo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';

demoTest('date-picker', { skip: ['locale.tsx'], testRootProps: false });

rootPropsTest('time-picker', (DatePicker, props) => <DatePicker {...props} value={dayjs()} />, {
rootPropsTest('date-picker', (DatePicker, props) => <DatePicker {...props} value={dayjs()} />, {
findRootElements: () => document.querySelectorAll('.ant-picker, .ant-picker-dropdown'),
expectCount: 2,
});

rootPropsTest(
'date-picker',
(DatePicker, props) => <DatePicker.RangePicker {...props} value={dayjs()} />,
{
findRootElements: () => document.querySelectorAll('.ant-picker-range, .ant-picker-dropdown'),
expectCount: 2,
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default function generateRangePicker<DateType>(generateConfig: GenerateCo
*/
dropdownClassName?: string;
popupClassName?: string;
rootClassName?: string;
};

const RangePicker = forwardRef<
Expand All @@ -56,6 +57,7 @@ export default function generateRangePicker<DateType>(generateConfig: GenerateCo
status: customStatus,
clearIcon,
allowClear,
rootClassName,
...restProps
} = props;

Expand Down Expand Up @@ -139,14 +141,15 @@ export default function generateRangePicker<DateType>(generateConfig: GenerateCo
hashId,
compactItemClassnames,
className,
rootClassName,
)}
locale={locale.lang}
prefixCls={prefixCls}
getPopupContainer={customGetPopupContainer || getPopupContainer}
generateConfig={generateConfig}
components={Components}
direction={direction}
dropdownClassName={classNames(hashId, popupClassName || dropdownClassName)}
dropdownClassName={classNames(hashId, popupClassName || dropdownClassName, rootClassName)}
allowClear={mergeAllowClear(allowClear, clearIcon, <CloseCircleFilled />)}
/>,
);
Expand Down