8000 Add regression tests for moving/appending slot children in realms by edoardocavazza · Pull Request #206 · chialab/dna · GitHub
[go: up one dir, main page]

Skip to content

Add regression tests for moving/appending slot children in realms - #206

Merged
edoardocavazza merged 3 commits into
mainfrom
claude/realm-move-regression-test
Sep 29, 2026
Merged

edoardocavazza merged 3 commits into
mainfrom
claude/realm-move-regression-test

Conversation

@edoardocavazza
@edoardocavazza edoardocavazza commented Sep 29, 2026 •
Copy link
Copy Markdown
Member

Summary

  1. Regression test for 318f8f3 ("Correctly move children across the realm"): a child slotted in an outer component, moved into a nested component's realm and moved again must not be duplicated in the nested realm's childNodes.
  2. New bug fix + regression test: Realm.append('text') (or any string) dropped the last slotted child. importNodes adopts the new text node, then adoptNodes sees parentRealm === this, calls indexOf (-1) and splice(-1, 1), removing the last child. Now the splice is guarded, and insertNodesBefore dedupes nodes so append(c, c) inserts c once (as the DOM does). Includes a patch changeset.

Verification

  • Both new tests fail on the code without the respective fix and pass with it.
  • Full test/component.spec.tsx on Chromium: 84 passed. biome check and tsc clean.
  • WebKit/Firefox and the other spec files were not run locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D8BqaBWWbTy75iFWfdbAHr

Covers the fix in 318f8f3: a node adopted by an ancestor realm and then
moved into a nested one must not be duplicated in the nested realm's
childNodes when it is moved again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8BqaBWWbTy75iFWfdbAHr
@changeset-bot
changeset-bot Bot commented Sep 29, 2026 •
Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9d990dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chialab/dna Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
codecov Bot commented Sep 29, 2026 •
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.55%. Comparing base (4030485) to head (9d990dc).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/Realm.ts 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #206      +/-   ##
==========================================
+ Coverage   75.27%   75.55%   +0.27%     
==========================================
  Files          15       15              
  Lines        1986     1988       +2     
  Branches      548      549       +1     
==========================================
+ Hits         1495     1502       +7     
+ Misses        136      130       -6     
- Partials      355      356       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

adoptNodes spliced childNodes with index -1 for nodes already adopted but
not yet inserted (text nodes created from strings), removing the last child.
Also dedupe nodes in insertNodesBefore.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8BqaBWWbTy75iFWfdbAHr
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8BqaBWWbTy75iFWfdbAHr
@edoardocavazza edoardocavazza changed the title Add regression test for moving children across nested realms Add regression tests for moving/appending slot children in realms Sep 29, 2026
@edoardocavazza
edoardocavazza marked this pull request as ready for review September 29, 2026 05:35
@edoardocavazza
edoardocavazza merged commit b12a0f2 into main Sep 29, 2026
13 of 14 checks passed
@edoardocavazza
edoardocavazza deleted the claude/realm-move-regression-test branch September 29, 2026 05:35
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.

2 participants

0