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

fix: accept null values as valid for positive/negative validators #2986

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cromoteca
Copy link
Contributor

Addresses behavior of Positive, Negative, PositiveOrZero, and NegativeOrZero, which should accept null values as valid.

As API translates null to NaN, it should be accepted here.

Fixes #2826.

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.56%. Comparing base (56e1ab8) to head (1376322).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2986   +/-   ##
=======================================
  Coverage   92.56%   92.56%           
=======================================
  Files          84       84           
  Lines        3160     3162    +2     
  Branches      772      776    +4     
=======================================
+ Hits         2925     2927    +2     
  Misses        183      183           
  Partials       52       52           
Flag Coverage Δ
unittests 92.56% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@taefi taefi changed the title fix: accept null values as valid vor positive/negative validators fix: accept null values as valid for positive/negative validators Dec 11, 2024
Copy link
Contributor

@taefi taefi left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@Lodin Lodin left a comment

Choose a reason for hiding this comment

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

LGTM but I have a question here

packages/ts/lit-form/src/Validators.ts Show resolved Hide resolved
Copy link

sonarcloud bot commented Dec 11, 2024

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

Successfully merging this pull request may close these issues.

@PositiveOrZero annotation should not make ts fields not-nullable
3 participants