Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor withViewportMatch to use useViewportMatch (#18950)
* Refactor withViewportMatch to use useViewportMatch * Update tests to mock useViewportMatch globally
- Loading branch information
1 parent
05de258
commit db52a91
Showing
5 changed files
with
79 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
jest.mock( '@wordpress/compose', () => { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return { | ||
...jest.requireActual( '@wordpress/compose' ), | ||
useViewportMatch: jest.fn(), | ||
}; | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It runs during the setup. Is it expected that it gets mocked for all tests and it won't be possible to use the original function? The recommended way of mocking is documented at https://jestjs.io/docs/en/manual-mocks/