diff --git a/src/Select.tsx b/src/Select.tsx
index 8ac3c8937..99e72bfe9 100644
--- a/src/Select.tsx
+++ b/src/Select.tsx
@@ -253,7 +253,7 @@ const Select = React.forwardRef(
rawDisabled = option?.disabled;
// Warning if label not same as provided
- if (process.env.NODE_ENV !== 'production' && !isRawValue(val)) {
+ if (process.env.NODE_ENV !== 'production' && !optionLabelProp) {
const optionLabel = option?.[mergedFieldNames.label];
if (optionLabel !== undefined && optionLabel !== rawLabel) {
warning(false, '`label` of `value` is not same as `label` in Select options.');
diff --git a/tests/Multiple.test.tsx b/tests/Multiple.test.tsx
index 6067287c1..a5e6f6b6e 100644
--- a/tests/Multiple.test.tsx
+++ b/tests/Multiple.test.tsx
@@ -475,31 +475,59 @@ describe('Select.Multiple', () => {
expect(wrapper.exists('.rc-select-selection-item-remove')).toBeFalsy();
});
- it('optionLabelProp', () => {
- const wrapper = mount(
- ,
- );
+ describe('optionLabelProp', () => {
+ it('basic', () => {
+ const wrapper = mount(
+ ,
+ );
- expect(findSelection(wrapper, 0).text()).toBe('BAMBOO');
- expect(findSelection(wrapper, 1).text()).toBe('LITTLE');
- expect(wrapper.find('div.rc-select-item-option-content').at(0).text()).toBe('Bamboo');
- expect(wrapper.find('div.rc-select-item-option-content').at(1).text()).toBe('Little');
+ expect(findSelection(wrapper, 0).text()).toBe('BAMBOO');
+ expect(findSelection(wrapper, 1).text()).toBe('LITTLE');
+ expect(wrapper.find('div.rc-select-item-option-content').at(0).text()).toBe('Bamboo');
+ expect(wrapper.find('div.rc-select-item-option-content').at(1).text()).toBe('Little');
+ });
+
+ it('select no warning', () => {
+ const wrapper = mount(
+ ,
+ );
+
+ // Select one
+ const errSpy = jest.spyOn(console, 'error');
+
+ toggleOpen(wrapper);
+ selectItem(wrapper);
+
+ expect(errSpy).not.toHaveBeenCalled();
+ errSpy.mockRestore();
+ });
});
});