Repository navigation
Fix 3 failing tests: Header → Text reverse conversion not emitting events #418
Description
Problem
3 frontend tests in textarea-bidirectional-conversion.test.ts are failing. These tests validate that header nodes can convert back to text nodes when hashtags are removed.
Failing Tests
Location: packages/desktop-app/src/tests/components/textarea-bidirectional-conversion.test.ts
All in section: "Reverse Conversion: Header → Text"
- "should convert back to text when removing space from '## '"
- "should convert back to text when removing all hashtags"
- "should update internal nodeType after reverse conversion"
Error Pattern
AssertionError: expected [] to have a length of 1 but got +0
- Expected
+ Received
Root Cause: Tests expect node update events to be emitted, but none are being emitted (empty array).
Context
These tests were added in PR #284 and were passing. They broke after recent changes, likely PR #415 which modified:
base-node-viewer.svelteshared-node-store.tsreactive-node-service.svelte.ts
The changes likely affected how node type transitions are detected and how update events are emitted during pattern-based conversions.
Reproduction
bun run test src/tests/components/textarea-bidirectional-conversion.test.ts
# Result: 3 failures in "Reverse Conversion: Header → Text" sectionExpected Behavior
When a header node's content is edited to remove the header pattern (e.g., "## " → ""):
- Node should detect the pattern change
- Node type should convert from "header" to "text"
- An update event should be emitted
- The event should contain the node with updated type
Actual Behavior
- Pattern detection may not be triggering
- Node type conversion not happening
- No update events being emitted
- Tests receive empty array instead of update event
Acceptance Criteria
- All 3 tests in "Reverse Conversion: Header → Text" pass
- Header → Text conversion works when removing hashtags
- Update events properly emitted during type transitions
- nodeType properly updated in node object
- No regressions in other bidirectional conversion tests
- All tests pass:
bun run test src/tests/components/textarea-bidirectional-conversion.test.ts
Related Issues
- Implement HeaderNode component with textarea #284 (PR that added these tests - were passing then)
- Fix 3 Rust test race conditions (pass individually, fail concurrently) #415 (PR that likely broke them - modified event emission logic)
Priority
🔴 HIGH - Regression in core header/text conversion functionality.
Technical Specifications
Reference Files
packages/desktop-app/src/tests/components/textarea-bidirectional-conversion.test.tspackages/desktop-app/src/lib/design/components/base-node-viewer.svelte(likely cause)packages/desktop-app/src/lib/services/shared-node-store.ts(event emission)packages/desktop-app/src/lib/design/components/textarea-controller.ts(pattern detection)
Activity
Fix header → text reverse conversion event emission
Fix header → text reverse conversion event emission (#419)