Skip to content

Commit

Permalink
chore: Fix console warning typo (validate -> valid)
Browse files Browse the repository at this point in the history
Clean up the typos in the helpful console warning messages which get
emitted if the incorrect prop is passed to certain components.
  • Loading branch information
Evan Charlton committed Apr 14, 2020
1 parent 8c11676 commit 2f97cea
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/checkbox/Checkbox.tsx
Expand Up @@ -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`?',
);
}

Expand Down
2 changes: 1 addition & 1 deletion components/checkbox/__tests__/checkbox.test.js
Expand Up @@ -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();
});
Expand Down
7 changes: 2 additions & 5 deletions components/switch/__tests__/index.test.js
Expand Up @@ -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();
});
Expand All @@ -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();
});
Expand Down
2 changes: 1 addition & 1 deletion components/switch/index.tsx
Expand Up @@ -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`?',
);
}

Expand Down
2 changes: 1 addition & 1 deletion components/upload/Upload.tsx
Expand Up @@ -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`?',
);
}

Expand Down
2 changes: 1 addition & 1 deletion components/upload/__tests__/upload.test.js
Expand Up @@ -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();
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/previewEditor/umi.js
Expand Up @@ -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`?',
);
},
},
Expand Down

0 comments on commit 2f97cea

Please sign in to comment.