BorderBoxControl: migrate tests to TypeScript, remove act() call#47755
BorderBoxControl: migrate tests to TypeScript, remove act() call#47755
act() call#47755Conversation
|
Size Change: 0 B Total Size: 1.31 MB ℹ️ View Unchanged
|
|
Flaky tests detected in c1b1d9b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4105491572
|
There was a problem hiding this comment.
Thanks for finishing off the conversion of the BorderBoxControl to TypeScript @ciampo 👍
The changes look good.
✅ No typing errors
✅ Unit tests are passing locally.
✅ Updates look good. No runtime changes.
Regarding the remaining timeout error in the failed e2e, that looks related to a different test than the one commented on in this PR. I couldn't, however, replicate the problem locally. 🤔
There was a problem hiding this comment.
I've noticed that this test times out on CI (not locally though) so in bde3e09 I've split it to separate tests that target each button separately. This should distribute the effort and make tests run within the 5s limit.
There was a problem hiding this comment.
That fixed it, thank you!
tyxla
left a comment
There was a problem hiding this comment.
I've added a commit to fix the test timeout and left some thoughts, but this looks great IMHO 👍 🚀 Nice work
There was a problem hiding this comment.
We could be able to shorten this to a single query, where:
const solidButton = screen.queryByRole( 'button', {
name: 'Solid',
} );
const dashedButton = screen.queryByRole( 'button', {
name: 'Dashed',
} );
const dottedButton = screen.queryByRole( 'button', {
name: 'Dotted',
} );
expect( solidButton ).not.toBeInTheDocument();
expect( dashedButton ).not.toBeInTheDocument();
expect( dottedButton ).not.toBeInTheDocument();
to:
const styleButton = screen.queryByRole( 'button', {
name: /(Solid)|(Dashed)|(Dotted)/,
} );
expect( styleButton ).not.toBeInTheDocument();
This is totally optional since it's a suggestion on pre-existing code.
There was a problem hiding this comment.
Nice. You might also want to do it for the other should omit style options when requested test that has the same assertions.
07a6e71 to
fdbd422
Compare
fdbd422 to
c1b1d9b
Compare
What?
Part of #35744
Refactor
BorderBoxControl's tests to TypeScript (the rest of the component is already typed)Remove unnecessary
act()call in the processWhy?
Part of the TypeScript migration that we're doing in the
@wordpress/componentspackage, see #35744 for more infoHow?
Testing Instructions
No runtime changes. Make sure that the project compiles, and that tests make sense