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
parent
commit
58c6900175
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      components/checkbox/Checkbox.tsx
  2. 2
      components/checkbox/__tests__/checkbox.test.js
  3. 7
      components/switch/__tests__/index.test.js
  4. 2
      components/switch/index.tsx
  5. 2
      components/upload/Upload.tsx
  6. 2
      components/upload/__tests__/upload.test.js
  7. 2
      scripts/previewEditor/umi.js

2
components/checkbox/Checkbox.tsx

@ -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`?',
);
}

2
components/checkbox/__tests__/checkbox.test.js

@ -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();
});

7
components/switch/__tests__/index.test.js

@ -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();
});

2
components/switch/index.tsx

@ -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`?',
);
}

2
components/upload/Upload.tsx

@ -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`?',
);
}

2
components/upload/__tests__/upload.test.js

@ -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();
});

2
scripts/previewEditor/umi.js

@ -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`?',
);
},
},

Loading…
Cancel
Save