Testable Popup Tool - #4940
Open
azmy60 wants to merge 2 commits into
Open
Conversation
Cover Popup.show() across all five anchor positions, mouse-event and numeric origins, overflow rescues, and reversal state on reuse. Ten of these fail against current behaviour and document real bugs: reversal writes `right` instead of a normalised `left`, no left-edge clamp when the popup is wider than the space beside its anchor, `reversedX` never resetting for a reused popup, and the vertical bound widening to scrollHeight once the page is scrolled. Adds @babel/preset-typescript, typescript, and @types/jest so unit specs can be written in TS, plus a `typecheck` script and tsconfig. Upgrades jest to 30 for jsdom 26, which implements MouseEvent#pageX (jsdom/jsdom#3484) so event origins no longer need hand-defined properties. Popup no longer takes a container constructor argument; the specs exercise the document.body path via `popupContainer: false`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
rathboma
approved these changes
Aug 18, 2026
Collaborator
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.
The main goal of this PR is to make
src/js/core/tools/Popup.jsto be more testable by introducing these:Popup.offsetPopup.resolveCoordsByOriginThe tests expose some bugs which might be related to #4285 and later might be fixed by #4918.