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

NumberControl: bolster tests #47246

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Draft

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Jan 18, 2023

What?

In preparation for the changes proposed in #45982, this PR improves the unit tests for NumberControl:

Why?

The changes in #45982 have the potential to introduces unwanted side effects, and therefore it's better to bolster unit tests in order to gain more confidence when making those changes.

How?

  • all tests now run against both the controlled and uncontrolled version of the component

[TODO]:

  • test both user input AND setting directly the value programmatically
  • add more tests around validation, eg.:
    • test number and string
    • adding non numbers
    • adding numbers outside of range
    • leaving the field empty
    • adding a value, and then deleting it
    • typing and pressing enter
    • typing and blurring the input
    • with and without pressEnterToChange
    • with and without required

Testing Instructions

This PR doesn't introduce runtime changes (the only changes are to the unit tests).

Review the tests code, make sure that all tests pass and expect the correct behaviour.

@ciampo ciampo added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Jan 18, 2023
@ciampo ciampo self-assigned this Jan 18, 2023
@ciampo ciampo force-pushed the feat/number-control-more-tests branch from 23f8641 to 17e668a Compare January 23, 2023 19:10
@github-actions
Copy link

Flaky tests detected in 17e668a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3989713275
📝 Reported issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant