Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #191 +/- ##
==========================================
- Coverage 99.05% 98.90% -0.16%
==========================================
Files 42 44 +2
Lines 1165 1185 +20
Branches 316 318 +2
==========================================
+ Hits 1154 1172 +18
- Misses 10 12 +2
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jperals
commented
Feb 2, 2026
| act(() => { | ||
| Object.defineProperty(window, 'innerWidth', { value: width }); | ||
| // Mock safeMatchMedia to return the result of a passed-in `max-width` query based on the width the window wasjust resized to | ||
| jest.spyOn(safeMatchMediaModule, 'safeMatchMedia').mockImplementation((element, query) => { |
Member
Author
There was a problem hiding this comment.
The test code was copied over from the components package, but here it didn't work because the implementation of getIsMobile behaves differenttly in one package vs the other when window.matchMedia is not present:
- In components, we fall back to the
getMatchingBreakpointfunction: https://github.com/cloudscape-design/components/blob/ea2b35b0ec1e6fd4dfb365542542a480bd75da01/src/internal/hooks/use-mobile/index.ts#L33 - In this package, we use
safeMatchMediawhich will returnfalsewithout resorting to fallbacks: https://github.com/cloudscape-design/component-toolkit/blob/main/src/internal/utils/safe-match-media.ts#L7
Fallbacks are not needed because matchMedia has very good browser support: https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia#browser_compatibility
pan-kot
approved these changes
Feb 3, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These tests were failing, but they were not run because the folder name was wrong (
_tests__instead of__tests__).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.