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

Support empty string for maxlength #595

Merged
merged 4 commits into from Mar 18, 2021

Conversation

Aprillion
Copy link
Contributor

@Aprillion Aprillion commented Mar 18, 2021

What:

An input's maxlength can be an empty string, which should NOT limit typing.

Why:

Browsers work that way.

How:

Use || instead of ?? operator to convert "" into -1 instead of 0.

ph-fritsche introduced a new function getSanitizedMaxLength to handle multiple edge cases

Checklist:

  • Documentation N/A
  • Tests
  • Typings N/A
  • Ready to be merged

An input's maxlength can be an empty string, which should NOT limit typing.
@codecov
Copy link

codecov bot commented Mar 18, 2021

Codecov Report

Merging #595 (72016b2) into master (0ffb5f3) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #595   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           47        47           
  Lines          857       862    +5     
  Branches       325       327    +2     
=========================================
+ Hits           857       862    +5     
Impacted Files Coverage Δ
src/utils/edit/calculateNewValue.ts 100.00% <100.00%> (ø)

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 0ffb5f3...72016b2. Read the comment docs.

@Aprillion Aprillion marked this pull request as ready for review March 18, 2021 10:27
Copy link
Member

@ph-fritsche ph-fritsche left a comment

Choose a reason for hiding this comment

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

Opened a PR with code suggestions at Aprillion#1

src/utils/edit/calculateNewValue.ts Outdated Show resolved Hide resolved
fix: sanitize maxLength attribute
@ph-fritsche ph-fritsche merged commit 2180430 into testing-library:master Mar 18, 2021
@github-actions
Copy link

🎉 This PR is included in version 13.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

This was referenced Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants