Skip to content

Navigator: add more pattern matching tests, refine existing tests#47910

Merged
ciampo merged 7 commits into
trunkfrom
feat/navigator-more-tests
Feb 9, 2023
Merged

Navigator: add more pattern matching tests, refine existing tests#47910
ciampo merged 7 commits into
trunkfrom
feat/navigator-more-tests

Conversation

@ciampo

@ciampo ciampo commented Feb 9, 2023

Copy link
Copy Markdown
Contributor

What?

Following up the work in #47827, this PR adds more unit test to the suite of Navigator components (and refines some existing ones).

Why?

More tests, more confidence when making changes (especially in preparation for #47883)

How?

  • Added a few tests for the pattern matching using navigator components (on top of existing patternMatch unit tests)
  • Refined tests around focus restoration, to make sure that the correct behaviour is being effectively tests

Testing Instructions

No runtime changes.

Make sure that unit test changes look good, and that tests pass.

@ciampo ciampo self-assigned this Feb 9, 2023
@ciampo ciampo added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Feb 9, 2023
@ciampo ciampo marked this pull request as ready for review February 9, 2023 09:17
@ciampo ciampo requested a review from ajitbohra as a code owner February 9, 2023 09:17
);
}

function CustomNavigatorButtonWithFocusRestoration( {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in favour of using CustomNavigatorButton everywhere, since today there are basically no differences between the two

} );

it( 'should escape the value of the `path` prop', async () => {
const user = userEvent.setup();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved part of this test to a new test (should restore focus correctly even when the path needs to be escaped). Reviewing commit-by-commit should make this part easier to review.

@youknowriad youknowriad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great additions. This is going to give us much needed confidence with the goToParent work.

@github-actions

github-actions Bot commented Feb 9, 2023

Copy link
Copy Markdown

Flaky tests detected in dae7b0a.
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/4137292770
📝 Reported issues:

@ciampo ciampo enabled auto-merge (squash) February 9, 2023 09:39

@tyxla tyxla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work @ciampo 👍 It's a delight to be reading your test code 🥇

@ciampo ciampo force-pushed the feat/navigator-more-tests branch 2 times, most recently from 447e3cd to 2f3c758 Compare February 9, 2023 14:54
@ciampo ciampo disabled auto-merge February 9, 2023 17:16
@ciampo ciampo force-pushed the feat/navigator-more-tests branch from 2f3c758 to dae7b0a Compare February 9, 2023 18:27
@ciampo ciampo merged commit 81bac1d into trunk Feb 9, 2023
@ciampo ciampo deleted the feat/navigator-more-tests branch February 9, 2023 19:05
@github-actions github-actions Bot added this to the Gutenberg 15.2 milestone Feb 9, 2023
ntsekouras pushed a commit that referenced this pull request Feb 13, 2023
…7910)

* Add one extra button to improve quality of focus restoration tests

* Fix typo

* Add screens with pattern matching to test component

* Add named arguments tests

* Refine invalid HTML attribute tests, split focus restoration part to new test

* Remove reduntant component

* CHANGELOG
@ntsekouras

Copy link
Copy Markdown
Contributor

Cherry-picked this PR to the wp/6.2 branch.

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.

4 participants