Skip to content

refactor!: remove the default value for step - #4095

Merged
web-padawan merged 13 commits into
masterfrom
refactor/remove-default-value-for-step
Jul 5, 2022
Merged

web-padawan merged 13 commits into
masterfrom
refactor/remove-default-value-for-step

Conversation

@vursen

@vursen vursen commented Jun 26, 2022 •

Copy link
Copy Markdown
Contributor

Description

This PR removes the default value for the step property of number-field which makes it possible to throw away the custom validation logic entirely relying on the InputConstraintsMixin validation logic instead.

Breaking changes:

  1. The step property no longer has a default value and therefore undefined and null values are now allowed.
  2. Setting the step property no longer leads to setting the step attribute on the number-field host.

Related to #1224

Type of change

  • Refactor

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@vursen
vursen force-pushed the refactor/remove-default-value-for-step branch 2 times, most recently from a420b80 to b598277 Compare June 28, 2022 06:59
@vursen
vursen requested a review from web-padawan June 28, 2022 09:35
@vursen vursen changed the title refactor!: remove the default value for step (WIP) refactor!: remove the default value for step Jun 28, 2022
@vursen
vursen marked this pull request as ready for review June 28, 2022 09:35
@vursen
vursen force-pushed the refactor/remove-default-value-for-step branch from c959184 to 92c300b Compare June 28, 2022 09:52
@vursen
vursen force-pushed the refactor/remove-default-value-for-step branch from 92c300b to 2b2b64e Compare June 28, 2022 09:54
@vursen
vursen force-pushed the refactor/remove-default-value-for-step branch from 1616307 to 8b86abe Compare June 28, 2022 09:57

@web-padawan web-padawan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's remember to update corresponding ITs in the Flow components:

Also, the logic that uses 1 as a fallback step value needs to be replicated in the Flow component, see for example how it's implemented in the TimePicker.

@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2022

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vursen

vursen commented Jul 4, 2022

Copy link
Copy Markdown
Contributor Author

Let's remember to update corresponding ITs in the Flow components:

I checked on the Flow counterpart and looks like its step already defaults to 1 according to:

https://github.com/vaadin/flow-components/blob/d16cc31709b64be4dfc7e765c7e802b121c34253/vaadin-text-field-flow-parent/vaadin-text-field-flow/src/main/java/com/vaadin/flow/component/textfield/AbstractNumberField.java#L109

...so only tests will need to be updated. I'll take care of them during the next release.

@vursen
vursen requested a review from web-padawan July 5, 2022 06:53
@web-padawan
web-padawan merged commit 61d8f07 into master Jul 5, 2022
@web-padawan
web-padawan deleted the refactor/remove-default-value-for-step branch July 5, 2022 07:24
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.

2 participants