Repository navigation
test(fake-dom): cover the four uncovered regions in the fake document - #708
Closed
hivecommons-hive[bot] wants to merge 1 commit into
Closed
hivecommons-hive[bot] wants to merge 1 commit into
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
tests/tools/fake-dom.mjs is the stand-in document every focus-trap test mounts against, and four of its sub-line regions were unexercised: the removeEventListener path for a type that was never registered, the empty fallbacks in keydownListenerCount and dispatchKeyDown, and the restore arm that puts back a document which existed before the install. The focus-trap suite never reaches them because it registers exactly one keydown listener and only runs where no global document exists. A regression there surfaces as a confusing failure in an unrelated suite, or as a leaked global document that quietly changes how a later test behaves. Region coverage for tests/tools/fake-dom.mjs goes from 92.00% to 100%. Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
This was referenced Sep 27, 2026
Member
|
Superseded by #750, which consolidates this and 14 other test-only coverage PRs into a single reviewable change (commit cherry-picked unmodified, authorship and DCO preserved). |
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.
Test Improvement
tests/tools/fake-dom.mjsis the stand-indocumentevery focus-trap testmounts against, and four of its sub-line regions were unexercised. This adds
tests/fake-dom-harness.test.mjswith one test per region:removing an unregistered handler leaves the registered one in place
keydownListenerCount()anddispatchKeyDown()behave on a document thatnever saw a listener
restore()puts back adocumentthat existed before the installrestore()deletes the global when none existedThe focus-trap suite cannot reach these: it registers exactly one keydown
listener and runs only where no global
documentexists. Therestorearm iswhat keeps a fake document from leaking into later tests under a DOM-providing
runner, and nothing proved it worked.
Files touched:
tests/fake-dom-harness.test.mjs(new) only. No productioncode, no changes to existing tests, so this is disjoint from the open test PRs
(#678, #680, #686, #688, #693, #702, #706), which claim
scripts/fixtures andtests/{import-architectures,svg-active-content,fetch-community-people,validate-*,collect-*,coverage-report-collect,react-harness}.Region coverage for
tests/tools/fake-dom.mjs: 92.00% -> 100.00%(
TZ=UTC node tests/tools/coverage-report.mjs). Line coverage was already100%, so this is a pure region gain.
Related Issue
Closes #707
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88