diff --git a/src/Picker.tsx b/src/Picker.tsx index 6b1ecc670..e9124224e 100644 --- a/src/Picker.tsx +++ b/src/Picker.tsx @@ -49,6 +49,7 @@ export interface PickerSharedProps extends React.AriaAttributes { defaultOpen?: boolean; /** Make input readOnly to avoid popup keyboard in mobile */ inputReadOnly?: boolean; + id?: string; // Value format?: string | string[]; @@ -127,6 +128,7 @@ interface MergedPickerProps function InnerPicker(props: PickerProps) { const { prefixCls = 'rc-picker', + id, style, className, dropdownClassName, @@ -463,6 +465,7 @@ function InnerPicker(props: PickerProps) { >
( } export interface RangePickerSharedProps { + id?: string; value?: RangeValue; defaultValue?: RangeValue; defaultPickerValue?: [DateType, DateType]; @@ -136,6 +137,7 @@ interface MergedRangePickerProps function InnerRangePicker(props: RangePickerProps) { const { prefixCls = 'rc-picker', + id, style, className, popupStyle, @@ -887,6 +889,7 @@ function InnerRangePicker(props: RangePickerProps) { ref={startInputDivRef} > { expect(wrapper.find('input').props().value).toEqual(text); }); }); + + it('id', () => { + const wrapper = mount(); + expect(wrapper.find('input').props().id).toEqual('light'); + }); }); diff --git a/tests/range.spec.tsx b/tests/range.spec.tsx index 0c625b261..34f8d560c 100644 --- a/tests/range.spec.tsx +++ b/tests/range.spec.tsx @@ -1036,4 +1036,14 @@ describe('Picker.Range', () => { testOrderOnTime(false, '23:00:00', '02:00:00'); testOrderOnTime(true, '02:00:00', '23:00:00'); }); + + it('id', () => { + const wrapper = mount(); + expect( + wrapper + .find('input') + .first() + .props().id, + ).toEqual('bamboo'); + }); });