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

Blocks: Treat RangeControl value as numeric #2339

Merged
merged 2 commits into from
Aug 11, 2017
Merged

Conversation

aduth
Copy link
Member

@aduth aduth commented Aug 10, 2017

This pull request seeks to update RangeControl in line with other block inspector controls to pass through the updated value on onChange instead of the original event, and in doing so treat the updated value as numeric. Since RangeControl is used for assigning numeric values, it was easy to overlook and assigning event.target.value would assign a string value, resulting in warnings:

parser.js:140 Expected attribute "columns" of type number for block type "core/gallery" but received string.

See: #1905

Testing instructions:

Verify there are no regressions or console warnings in changing...

  • Gallery columns
  • Latest posts columns
  • Text columns columns

Ensure unit tests pass:

npm test

@aduth aduth added the [Feature] Blocks Overall functionality of blocks label Aug 10, 2017
@codecov
Copy link

codecov bot commented Aug 10, 2017

Codecov Report

Merging #2339 into master will increase coverage by 0.04%.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2339      +/-   ##
==========================================
+ Coverage   24.69%   24.74%   +0.04%     
==========================================
  Files         152      152              
  Lines        4738     4745       +7     
  Branches      799      800       +1     
==========================================
+ Hits         1170     1174       +4     
- Misses       3014     3016       +2     
- Partials      554      555       +1
Impacted Files Coverage Δ
blocks/library/gallery/index.js 25% <0%> (ø) ⬆️
blocks/library/latest-posts/index.js 10% <0%> (ø) ⬆️
blocks/library/text-columns/index.js 33.33% <0%> (ø) ⬆️
blocks/inspector-controls/range-control/index.js 100% <100%> (+100%) ⬆️
editor/sidebar/post-status/index.js 0% <0%> (ø) ⬆️
blocks/inspector-controls/base-control/index.js 100% <0%> (+100%) ⬆️

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 ca1eeda...961c98d. Read the comment docs.

@aduth aduth merged commit a08dae6 into master Aug 11, 2017
@aduth aduth deleted the update/range-control-numeric branch August 11, 2017 12:17
ceyhun pushed a commit that referenced this pull request Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant