Uh oh!
There was an error while loading. Please reload this page.
fix(tests): build the detached registration the sweep cannot reach - #26
Merged
Merged
Conversation
"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.
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Problem
mainis red:removeDetachedForms drops the registrations of nodes that left the documentfails, 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 lastaddModel()— 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.mdstill 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. Onmainthe same command fails one.🤖 Generated with Claude Code