Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add warning when use value of Switch, Checkbox, Upload #18497

Merged
merged 2 commits into from Aug 27, 2019
Merged

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Aug 27, 2019

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

ref #10945 #9611 #7481 #6261 #3142 #1550

📝 Changelog

Language Changelog
🇺🇸 English Add warning when use value of Switch, Checkbox, Upload
🇨🇳 Chinese Switch、Checkbox 和 Upload 使用 value 时会提示正确的属性名。

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

@tests-checker tests-checker bot left a comment

Could you please add tests to make sure this change works as expected?

@netlify
Copy link

netlify bot commented Aug 27, 2019

Deploy preview for ant-design ready!

Built with commit 812f860

https://deploy-preview-18497--ant-design.netlify.com

@zombieJ zombieJ requested a review from afc163 Aug 27, 2019

describe('Checkbox', () => {
describe('Checkbox.2333', () => {
Copy link
Member

@afc163 afc163 Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2333

Copy link
Member Author

@zombieJ zombieJ Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😝

super(props);

warning(
'checked' in props || !('value' in props),
Copy link
Member

@afc163 afc163 Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只要是指定了 value 就 warning 吧,不管有没有 checked

Copy link
Member Author

@zombieJ zombieJ Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为了保险一点,检查都是没填正确的 prop 且填了 value 才报错。免得误报,因为看我们自己测试用例也会用错。

Copy link
Member

@afc163 afc163 Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怕有人这么写

getDecorator({ name: 'xxx', initialValue: true })(
  <Switch checked={this.state.checked} />
)

@codecov
Copy link

codecov bot commented Aug 27, 2019

Codecov Report

Merging #18497 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18497      +/-   ##
==========================================
+ Coverage   96.41%   96.41%   +<.01%     
==========================================
  Files         280      280              
  Lines        7524     7531       +7     
  Branches     2090     2051      -39     
==========================================
+ Hits         7254     7261       +7     
  Misses        268      268              
  Partials        2        2
Impacted Files Coverage Δ
components/switch/index.tsx 100% <100%> (ø) ⬆️
components/upload/Upload.tsx 95.45% <100%> (+0.06%) ⬆️
components/checkbox/Checkbox.tsx 96.22% <100%> (+0.14%) ⬆️
components/table/Table.tsx 93.79% <0%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a2c610...812f860. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants