Skip to content

fix(tests): build the detached registration the sweep cannot reach - #26

Merged
66Ton99 merged 1 commit into
Svaroh:mainfrom
Web20:fix/teardown-test-matches-eager-sweep
Aug 28, 2026
Merged

fix(tests): build the detached registration the sweep cannot reach#26
66Ton99 merged 1 commit into
Svaroh:mainfrom
Web20:fix/teardown-test-matches-eager-sweep

Conversation

@66Ton99

@66Ton99 66Ton99 commented Aug 28, 2026

Copy link
Copy Markdown

Problem

main is red: removeDetachedForms drops the registrations of nodes that left the document fails, and with it the JavaScript and Coverage jobs of every open pull request.

registerForm() now drops the registrations of a model whose markup has left the document. The test set its two registrations up as render, remove the node, render again — and the second registration sweeps the first away, so the array it expected to hold two holds one.

The behaviour is right; the test was written against the version without the sweep.

Change

The test now builds the pair the sweep cannot reach: both forms are registered while both are in the document, and only then does one node leave. That is the case removeDetachedForms() exists for — a registration that went stale after the last addModel() — and it is what a page swapping a region hits.

A second test covers the sweep itself: render, remove, render again leaves one registration, and removeDetachedForms() then has nothing to do.

src/Resources/doc/3_24.md still said the registry keeps growing until an application takes a registration out, which the sweep had already made untrue. It now says what the sweep covers, and what it does not: a form the page removed and did not render again, and every other model, still wait for an explicit removal.

No change to SvarohJsFormValidator.js.

Tests

npx jest — 633 tests pass. On main the same command fails one.

🤖 Generated with Claude Code

"registerForm" drops the registrations of a model whose markup has left
the document, so the two registrations the "removeDetachedForms" test
set up - render, remove, render again - became one, and the test failed
on main.

The test now removes the node after the last registration, which is the
only way a detached registration survives to be swept, and a second test
covers the sweep that registering does on its own. The documentation
said the registry keeps growing without an explicit removal, which that
sweep already made untrue.
@66Ton99
66Ton99 merged commit 77dc159 into Svaroh:main Aug 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant