test(app): restore stable offset observer ordering - #39901
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.
What
Restore the stable ordering for the reconnect-aware offset observer test that was previously landed in #38044 and later lost during a branch merge.
Before / After
Before: The test performed unrelated DOM mutations and awaited animation frames before its first reconnect. Happy DOM stores mutation callbacks weakly, so GC could collect the callback during that asynchronous gap and leave the reconnect assertion with no calls.
After: The test verifies the reconnect first, then performs unrelated DOM churn and confirms it adds no callback. Production behavior and coverage remain unchanged, without exposing the test to Happy DOM's weak-callback artifact before its positive assertion.
How
Reorder the existing test phases to match the proven ordering from #38044. A second reconnect still verifies equal offsets are ignored after the unrelated-mutation check.
Scope
Test-only change. No App runtime or timeline implementation changes.
Testing
bun test --preload ./happydom.ts ./src/pages/session/timeline/observe-element-offset.test.tsbun typecheck