Harden the result animation tests against silent no-ops - #2327
Merged
Conversation
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.
Hardens the reduced-motion and stagger tests added in #2324. They pass today, but two of them can stop testing anything without ever failing.
The reduced-motion tests read the transition styles through
closest(...)?.getAttribute("style")and compare with?? "". If the selector stops matching (a Mantine class rename, orCarousel.Slideno longer carryingrole="group"),closestreturns null, the?? ""turns that into an empty string, and both assertions pass. I checked it onmain: renaming the selectors to.mantine-Stack-root-renamedand[role="grouped"]leaves all 15 tests green. So both tests now assert the wrapper was found before reading its style, and a singlenot.toContain("transition")replaces the two narrower checks.The stagger tests used 6 results, which put the old timing's last item at exactly 1000ms against a 1000ms timeout. They now use 15 (the default
searchResultsLimit), so the old timing would need 2800ms for the text list and 3500ms for the carousel.By the way,
testUtils.tshad two exported wrappers plus a private function for what is a single call, sosetReducedMotionPreferenceis now the only export andafterEachcalls it withfalse.How to test
npm test(357 tests pass).npm run lint(exits 0). The architectural linter wants a TSDoc block in any file with exports, so the doc comment intestUtils.tsstays, now describing what the mock actually overrides instead of restating the function name.Four tests fail, each giving up after ~1010ms.