Browse Source
chore: Fix console warning typo (validate -> valid) (#23240)
Clean up the typos in the helpful console warning messages which get
emitted if the incorrect prop is passed to certain components.
pull/23251/head
Evan Charlton
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
8 additions and
11 deletions
-
components/checkbox/Checkbox.tsx
-
components/checkbox/__tests__/checkbox.test.js
-
components/switch/__tests__/index.test.js
-
components/switch/index.tsx
-
components/upload/Upload.tsx
-
components/upload/__tests__/upload.test.js
-
scripts/previewEditor/umi.js
|
|
@ -63,7 +63,7 @@ class Checkbox extends React.PureComponent<CheckboxProps, {}> { |
|
|
|
warning( |
|
|
|
'checked' in this.props || this.context || !('value' in this.props), |
|
|
|
'Checkbox', |
|
|
|
'`value` is not validate prop, do you mean `checked`?', |
|
|
|
'`value` is not a valid prop, do you mean `checked`?', |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -30,7 +30,7 @@ describe('Checkbox', () => { |
|
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); |
|
|
|
mount(<Checkbox value />); |
|
|
|
expect(errorSpy).toHaveBeenCalledWith( |
|
|
|
'Warning: [antd: Checkbox] `value` is not validate prop, do you mean `checked`?', |
|
|
|
'Warning: [antd: Checkbox] `value` is not a valid prop, do you mean `checked`?', |
|
|
|
); |
|
|
|
errorSpy.mockRestore(); |
|
|
|
}); |
|
|
|
|
|
@ -13,10 +13,7 @@ describe('Switch', () => { |
|
|
|
|
|
|
|
it('should has click wave effect', async () => { |
|
|
|
const wrapper = mount(<Switch />); |
|
|
|
wrapper |
|
|
|
.find('.ant-switch') |
|
|
|
.getDOMNode() |
|
|
|
.click(); |
|
|
|
wrapper.find('.ant-switch').getDOMNode().click(); |
|
|
|
await new Promise(resolve => setTimeout(resolve, 0)); |
|
|
|
expect(wrapper.render()).toMatchSnapshot(); |
|
|
|
}); |
|
|
@ -27,7 +24,7 @@ describe('Switch', () => { |
|
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); |
|
|
|
mount(<Switch value />); |
|
|
|
expect(errorSpy).toHaveBeenCalledWith( |
|
|
|
'Warning: [antd: Switch] `value` is not validate prop, do you mean `checked`?', |
|
|
|
'Warning: [antd: Switch] `value` is not a valid prop, do you mean `checked`?', |
|
|
|
); |
|
|
|
errorSpy.mockRestore(); |
|
|
|
}); |
|
|
|
|
|
@ -41,7 +41,7 @@ export default class Switch extends React.Component<SwitchProps, {}> { |
|
|
|
warning( |
|
|
|
'checked' in props || !('value' in props), |
|
|
|
'Switch', |
|
|
|
'`value` is not validate prop, do you mean `checked`?', |
|
|
|
'`value` is not a valid prop, do you mean `checked`?', |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -64,7 +64,7 @@ class Upload extends React.Component<UploadProps, UploadState> { |
|
|
|
warning( |
|
|
|
'fileList' in props || !('value' in props), |
|
|
|
'Upload', |
|
|
|
'`value` is not validate prop, do you mean `fileList`?', |
|
|
|
'`value` is not a valid prop, do you mean `fileList`?', |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -495,7 +495,7 @@ describe('Upload', () => { |
|
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); |
|
|
|
mount(<Upload value={[]} />); |
|
|
|
expect(errorSpy).toHaveBeenCalledWith( |
|
|
|
'Warning: [antd: Upload] `value` is not validate prop, do you mean `fileList`?', |
|
|
|
'Warning: [antd: Upload] `value` is not a valid prop, do you mean `fileList`?', |
|
|
|
); |
|
|
|
errorSpy.mockRestore(); |
|
|
|
}); |
|
|
|
|
|
@ -34843,7 +34843,7 @@ |
|
|
|
lt( |
|
|
|
'checked' in this.props || this.context || !('value' in this.props), |
|
|
|
'Checkbox', |
|
|
|
'`value` is not validate prop, do you mean `checked`?', |
|
|
|
'`value` is not a valid prop, do you mean `checked`?', |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|