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

FieldNumber interprets null min/max as 0. #3177

Closed
RoboErikG opened this issue Oct 7, 2019 · 0 comments
Closed

FieldNumber interprets null min/max as 0. #3177

RoboErikG opened this issue Oct 7, 2019 · 0 comments
Labels
issue: bug Describes why the code or behaviour is wrong type: regression

Comments

@RoboErikG
Copy link
Contributor

Describe the bug

Converting to Number(value) in FieldNumber had the effect of causing nulls passed to the constructor for min/max to be interpreted as 0. We need to explicitly check for null and set them to +/- infinity as appropriate.

To Reproduce

Steps to reproduce the behavior:

  1. Select test blocks in the playground
  2. Drag out a rounding to 10 block from the validators category
  3. Try to set the value to anything other than 0

Expected behavior

value gets rounded to the nearest 10

Screenshots

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Stack Traces

Replace with error stack trace.

Additional context

@RoboErikG RoboErikG added issue: bug Describes why the code or behaviour is wrong type: regression labels Oct 7, 2019
@RoboErikG RoboErikG added this to the 2019_q3_release milestone Oct 7, 2019
RoboErikG added a commit to RoboErikG/blockly that referenced this issue Oct 7, 2019
null was being converted to 0 by Number() when it should cause the
default value to be set instead. This updates FieldNumber to handle
nulls correctly.

Fixes google#3177
RoboErikG added a commit to RoboErikG/blockly that referenced this issue Oct 7, 2019
null was being converted to 0 by Number() when it should cause the
default value to be set instead. This updates FieldNumber to handle
nulls correctly. Also update jsdoc.

Fixes google#3177
RoboErikG added a commit to RoboErikG/blockly that referenced this issue Oct 7, 2019
null was being converted to 0 by Number() when it should cause the
default value to be set instead. This updates FieldNumber and
FieldAngle to handle nulls correctly. Also update jsdoc.

Fixes google#3177
RoboErikG added a commit that referenced this issue Oct 7, 2019
null was being converted to 0 by Number() when it should cause the
default value to be set instead. This updates FieldNumber and
FieldAngle to handle nulls correctly. Also update jsdoc.

Fixes #3177
RoboErikG added a commit to RoboErikG/blockly that referenced this issue Oct 8, 2019
null was being converted to 0 by Number() when it should cause the
default value to be set instead. This updates FieldNumber and
FieldAngle to handle nulls correctly. Also update jsdoc.

Fixes google#3177
RoboErikG added a commit that referenced this issue Oct 8, 2019
null was being converted to 0 by Number() when it should cause the
default value to be set instead. This updates FieldNumber and
FieldAngle to handle nulls correctly. Also update jsdoc.

Fixes #3177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Describes why the code or behaviour is wrong type: regression
Projects
None yet
Development

No branches or pull requests

1 participant