Adds src/test-utils/editorHarness.tsx mounting a REAL Craft.js <Editor>+<Frame> in jsdom (no @craftjs/core mock; ResizeObserver/matchMedia/innerText shims), plus 3 integration suites for the flows whose MOCKED unit tests silently let real bugs ship: duplicate/paste (useNodeActions/useKeyboardShortcuts), template load (real TemplateModal tree-build vs SaaS Landing), AI apply-response (real useApplyAiResponse).
RED-PROOF: reverting regenerateTreeIds to the historical structuredClone(oldNode.data) makes the duplicate suite fail with the exact DataCloneError (silent no-op) — restored → green. So these tests genuinely have teeth. Test-only (no runtime/bundle change). 622 tests.
Adds `src/test-utils/editorHarness.tsx` mounting a REAL Craft.js `<Editor>`+`<Frame>` in jsdom (no `@craftjs/core` mock; ResizeObserver/matchMedia/innerText shims), plus 3 integration suites for the flows whose MOCKED unit tests silently let real bugs ship: duplicate/paste (`useNodeActions`/`useKeyboardShortcuts`), template load (real TemplateModal tree-build vs SaaS Landing), AI apply-response (real `useApplyAiResponse`).
RED-PROOF: reverting `regenerateTreeIds` to the historical `structuredClone(oldNode.data)` makes the duplicate suite fail with the exact `DataCloneError` (silent no-op) — restored → green. So these tests genuinely have teeth. Test-only (no runtime/bundle change). 622 tests.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Mocked unit tests for regenerateTreeIds, TemplateModal.addTemplateComponents,
and buildNodeTree each let a real bug ship (DataCloneError on duplicate/paste,
dropped template children, no-op AI section-replace/insert) because their
fake @craftjs/core query/actions never exercised Craft's real node shape
(data.type as a live component reference) or real parseFreshNode validation.
Adds src/test-utils/editorHarness.tsx, which mounts a REAL <Editor>+<Frame>
(no vi.mock('@craftjs/core') anywhere) via react-dom/client + act, plus the
jsdom shims Craft/this component library actually needs (ResizeObserver,
matchMedia, and an HTMLElement.prototype.innerText polyfill -- jsdom has no
native innerText, which Heading/TextBlock rely on to paint their text).
Adds 3 integration suites under src/test-utils/integration/ driving the real
useNodeActions/useKeyboardShortcuts, TemplateModal's real tree-build pipeline,
and the real useApplyAiResponse hook against a live EditorStore, asserting on
both the real rendered DOM and query.serialize()/exportBodyHtml output.
Red-proofed the duplicate/paste suite: temporarily reverted
regenerateTreeIds to structuredClone(oldNode.data) and confirmed both tests
fail with the historical DataCloneError before restoring the fix.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jknapp
merged commit f80811318b into main2026-07-14 00:12:49 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Adds
src/test-utils/editorHarness.tsxmounting a REAL Craft.js<Editor>+<Frame>in jsdom (no@craftjs/coremock; ResizeObserver/matchMedia/innerText shims), plus 3 integration suites for the flows whose MOCKED unit tests silently let real bugs ship: duplicate/paste (useNodeActions/useKeyboardShortcuts), template load (real TemplateModal tree-build vs SaaS Landing), AI apply-response (realuseApplyAiResponse).RED-PROOF: reverting
regenerateTreeIdsto the historicalstructuredClone(oldNode.data)makes the duplicate suite fail with the exactDataCloneError(silent no-op) — restored → green. So these tests genuinely have teeth. Test-only (no runtime/bundle change). 622 tests.🤖 Generated with Claude Code
Mocked unit tests for regenerateTreeIds, TemplateModal.addTemplateComponents, and buildNodeTree each let a real bug ship (DataCloneError on duplicate/paste, dropped template children, no-op AI section-replace/insert) because their fake @craftjs/core query/actions never exercised Craft's real node shape (data.type as a live component reference) or real parseFreshNode validation. Adds src/test-utils/editorHarness.tsx, which mounts a REAL <Editor>+<Frame> (no vi.mock('@craftjs/core') anywhere) via react-dom/client + act, plus the jsdom shims Craft/this component library actually needs (ResizeObserver, matchMedia, and an HTMLElement.prototype.innerText polyfill -- jsdom has no native innerText, which Heading/TextBlock rely on to paint their text). Adds 3 integration suites under src/test-utils/integration/ driving the real useNodeActions/useKeyboardShortcuts, TemplateModal's real tree-build pipeline, and the real useApplyAiResponse hook against a live EditorStore, asserting on both the real rendered DOM and query.serialize()/exportBodyHtml output. Red-proofed the duplicate/paste suite: temporarily reverted regenerateTreeIds to structuredClone(oldNode.data) and confirmed both tests fail with the historical DataCloneError before restoring the fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>