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(progress-indicator): accept 0 as a valid value #2068

Merged

Conversation

gafortuno
Copy link
Contributor

What I did

  1. Updated the condition in removing the value attribute.
  2. When the value is set to 0, currently, without this fix, the value is being removed because the condition is !this.value || typeof this.value !== 'number' => !0 is equal to true that's why the progress bar value is being removed (this.removeAttribute('value'))
  3. I updated the condition to check if the value is 0, it will be accepted and the value attribute will not be removed.
  4. I also added and updated the unit test. The current unit test on setting the value of the value attribute to an empty string will fail because according to this documentation, on the convertion for Number (attribute to property) If the element has the corresponding attribute, set the property to Number(attributeValue). So, if the value is set to '', it will be Number('') which is equal to 0.

@changeset-bot
Copy link

changeset-bot bot commented Sep 1, 2023

🦋 Changeset detected

Latest commit: 92e286e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lion/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant
Copy link

CLAassistant commented Sep 1, 2023

CLA assistant check
All committers have signed the CLA.

@gafortuno
Copy link
Contributor Author

Before the fix:

If value is set to 0, it's taking the whole progress:
Screenshot 2023-09-01 at 6 58 10 PM

width is not being set properly because the value attribute is removed and it is considered indeterminate
Screenshot 2023-09-01 at 6 58 25 PM

value becomes null
Screenshot 2023-09-01 at 6 58 48 PM

After the fix:
Screenshot 2023-09-01 at 12 14 48 PM
Screenshot 2023-09-01 at 12 14 58 PM

@gerjanvangeest
Copy link
Member

Looks good to me, can you add a changeset npm run changeset, to add the change to the changelog?

@gafortuno
Copy link
Contributor Author

Added changeset thanks @gerjanvangeest

@gerjanvangeest gerjanvangeest merged commit b0a74f2 into ing-bank:master Sep 4, 2023
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.

3 participants