test(charts): real Legends overflow coverage - #36490
Draft
AKnassa wants to merge 1 commit into
Draft
Conversation
The Legends overflow scenario had only vacuous coverage: both packages asserted querySelectorAll(...).toBeDefined(), which always passes, against a selector that could never match. Replace it with meaningful tests. v8: pure-function coverage of the ResizeGroup reducers (_onReduceData/_onGrowData, including round-trip identity) plus rendered-overflow tests that drive the real ResizeGroup pipeline with mocked measurements to a deterministic 4-inline/13-overflow split, assert the '13 Overflow Items' indicator, aria state, and the HoverCard contents. v9: overflow-manager tests pinning a 3-visible/14-overflowed split, the '+14 Overflow Items' menu with menuitemcheckbox entries, and the no-overflow case. Inline+overflow arithmetic guards keep the tests durable if styling shifts the split. Non-vacuousness proven by mutating the overflow logic in each package and watching the new tests fail, then restoring. Full react-charting suite green (967); react-charts matches baseline (only the 6 pre-existing HeatMapChart snapshot failures). Closes microsoft#32121
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.
Previous Behavior
A charting maintainer asked for a test covering the "legends with overflow" scenario (legend items collapsing into an "N Overflow Items" button). The existing tests looked like coverage but weren't: they asserted that a DOM query result "is defined" — which is always true — against a CSS class that could never match anyway. Overflow could break entirely and no test would notice.
New Behavior
Real coverage in both charting packages. The tests drive the actual overflow machinery with controlled measurements to a deterministic split and then check what users see: the overflow button with its exact count, which legends stay inline, what opens when you click it, and the right accessibility attributes.
What changed
react-charting): pure tests for the overflow reducers (including a round-trip identity check) plus rendered tests pinning a 4-inline / 13-overflowed split, the "13 Overflow Items" button, and the hover-card contents.react-charts): tests pinning a 3-visible / 14-overflowed split, the "+14 Overflow Items" menu and its items, and the no-overflow case.Meaningfulness was proven the honest way: temporarily breaking the overflow logic in each package made the new tests fail, and restoring it made them pass. Full suites green / baseline-exact. Small note for reviewers: opening the v9 overflow menu logs a pre-existing dev warning from the Menu internals — observed, not caused, by these tests.
Related Issue(s)