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

Conversation

@zombieJ
Copy link
Member

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

@pr-triage pr-triage bot added the PR: unreviewed label Aug 27, 2019

@tests-checker
Copy link

left a comment

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

@netlify

This comment has been minimized.

Copy link

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', () => {

This comment has been minimized.

Copy link
@afc163

This comment has been minimized.

Copy link
@zombieJ

zombieJ Aug 27, 2019

Author Member

😝

super(props);

warning(
'checked' in props || !('value' in props),

This comment has been minimized.

Copy link
@afc163

afc163 Aug 27, 2019

Member

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

This comment has been minimized.

Copy link
@zombieJ

zombieJ Aug 27, 2019

Author Member

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

This comment has been minimized.

Copy link
@afc163

afc163 Aug 27, 2019

Member

怕有人这么写

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

This comment has been minimized.

Copy link

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.

@zombieJ zombieJ merged commit 19cc7e7 into master Aug 27, 2019

27 of 30 checks passed

Build
Details
License Compliance FOSSA is analyzing this commit
Details
Header rules - ant-design No header rules processed
Details
Pages changed - ant-design 214 new files uploaded
Details
LGTM analysis: JavaScript No new or fixed alerts
Details
Mixed content - ant-design No mixed content detected
Details
Redirect rules - ant-design 18 redirect rules processed
Details
Semantic Pull Request ready to be squashed
Details
WIP Ready for review
Details
ant-design.ant-design #ant design succeeded
Details
buildsize No change
Details
ci/circleci: check_metadata Your tests passed on CircleCI!
Details
ci/circleci: compile Your tests passed on CircleCI!
Details
ci/circleci: dist Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: test_dist Your tests passed on CircleCI!
Details
ci/circleci: test_dist_15 Your tests passed on CircleCI!
Details
ci/circleci: test_dom Your tests passed on CircleCI!
Details
ci/circleci: test_dom_15 Your tests passed on CircleCI!
Details
ci/circleci: test_es Your tests passed on CircleCI!
Details
ci/circleci: test_es_15 Your tests passed on CircleCI!
Details
ci/circleci: test_lib Your tests passed on CircleCI!
Details
ci/circleci: test_lib_15 Your tests passed on CircleCI!
Details
ci/circleci: test_node Your tests passed on CircleCI!
Details
ci/circleci: test_node_15 Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 96.41%)
Details
codecov/project 96.41% (+<.01%) compared to 0a2c610
Details
netlify/ant-design/deploy-preview Deploy preview ready!
Details
security/snyk - package.json (paranoidjk) No manifest changes detected

@zombieJ zombieJ deleted the warning branch Aug 27, 2019

@pr-triage pr-triage bot added PR: merged and removed PR: unreviewed labels Aug 27, 2019

@chenshuai2144 chenshuai2144 referenced this pull request Sep 2, 2019
5 of 14 tasks complete
@keithort keithort referenced this pull request Sep 6, 2019
0 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.