Skip to content

Commit

Permalink
feat: [v6] Retire deprecated api for select (ant-design#52368)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiner-tang authored Jan 13, 2025
1 parent b9151e2 commit ff3bee9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
13 changes: 0 additions & 13 deletions components/select/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,6 @@ describe('Select', () => {
expect(asFragment().firstChild).toMatchSnapshot();
});

it('dropdownClassName', () => {
resetWarned();

const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const { container } = render(<Select dropdownClassName="legacy" open />);
expect(errSpy).toHaveBeenCalledWith(
'Warning: [antd: Select] `dropdownClassName` is deprecated. Please use `popupClassName` instead.',
);
expect(container.querySelector('.legacy')).toBeTruthy();

errSpy.mockRestore();
});

it('warning for legacy dropdownMatchSelectWidth', () => {
resetWarned();

Expand Down
14 changes: 7 additions & 7 deletions components/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@ export interface SelectProps<
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
> extends Omit<
InternalSelectProps<ValueType, OptionType>,
'mode' | 'getInputElement' | 'getRawInputElement' | 'backfill' | 'placement'
| 'mode'
| 'getInputElement'
| 'getRawInputElement'
| 'backfill'
| 'placement'
| 'dropdownClassName'
> {
placement?: SelectCommonPlacement;
mode?: 'multiple' | 'tags';
status?: InputStatus;
popupClassName?: string;
/** @deprecated Please use `popupClassName` instead */
dropdownClassName?: string;
/** @deprecated Please use `popupMatchSelectWidth` instead */
dropdownMatchSelectWidth?: boolean | number;
popupMatchSelectWidth?: boolean | number;
Expand All @@ -100,7 +103,6 @@ const InternalSelect = <
rootClassName,
getPopupContainer,
popupClassName,
dropdownClassName,
listHeight = 256,
placement,
listItemHeight: customListItemHeight,
Expand Down Expand Up @@ -205,7 +207,7 @@ const InternalSelect = <
const selectProps = omit(rest, ['suffixIcon', 'itemIcon' as any]);

const mergedPopupClassName = classNames(
popupClassName || dropdownClassName,
popupClassName,
{
[`${prefixCls}-dropdown-${direction}`]: direction === 'rtl',
},
Expand Down Expand Up @@ -251,8 +253,6 @@ const InternalSelect = <
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Select');

warning.deprecated(!dropdownClassName, 'dropdownClassName', 'popupClassName');

warning.deprecated(
dropdownMatchSelectWidth === undefined,
'dropdownMatchSelectWidth',
Expand Down

0 comments on commit ff3bee9

Please sign in to comment.