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

Components: add unit test __experimentalExpandOnFocus unit tests for FormTokenField #57122

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

chad1008
Copy link
Contributor

What?

Adds three new unit tests to FormTokenField for the __experimentalExpandOnFocus prop

Why?

Ensure the suggestion list expands (or not) appropriately depending on the value of this prop, and that it doesn't reopen when the component is blurred. See #57002

How?

The first two tests check that the suggestions respond properly to the logic updated in the above PR. This ensures that

  1. when __experimentalExpandOnFocus is true, selecting a visible suggestion will not close the suggestion list, because the component still has focus.
  2. When it's false, the suggestion list does close upon a selection, because focus alone is not enough to cause it to expand

A third test then confirms that clicking outside the bounds of the component does not cause the suggestion list to reopen, which was the specific regression addressed in the above PR.

Testing Instructions

Confirm the new tests pass

@chad1008 chad1008 added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Package] Components /packages/components labels Dec 15, 2023
@chad1008 chad1008 requested review from talldan and a team December 15, 2023 20:42
@chad1008 chad1008 self-assigned this Dec 15, 2023
@chad1008 chad1008 requested a review from ajitbohra as a code owner December 15, 2023 20:42
Copy link

Flaky tests detected in 333952b.
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/7226853842
📝 Reported issues:

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Thank you for working on it!

Tested by undoing the changes in #57002, and verifying that the last test fails

@chad1008 chad1008 merged commit c0f6e23 into trunk Dec 19, 2023
57 checks passed
@chad1008 chad1008 deleted the form-token-field-blur-test branch December 19, 2023 22:40
@github-actions github-actions bot added this to the Gutenberg 17.4 milestone Dec 19, 2023
@talldan
Copy link
Contributor

talldan commented Dec 20, 2023

Thanks for adding the test! 😄

artemiomorales pushed a commit that referenced this pull request Jan 4, 2024
…r `FormTokenField` (#57122)

* add unit test

* add tests for suggestion visibility after selection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants