Skip to content

Fix 3 failing tests: Header → Text reverse conversion not emitting events #418

Closed

Description

@malibio

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"

  1. "should convert back to text when removing space from '## '"
  2. "should convert back to text when removing all hashtags"
  3. "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.svelte
  • shared-node-store.ts
  • reactive-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" section

Expected Behavior

When a header node's content is edited to remove the header pattern (e.g., "## " → ""):

  1. Node should detect the pattern change
  2. Node type should convert from "header" to "text"
  3. An update event should be emitted
  4. 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

Priority

🔴 HIGH - Regression in core header/text conversion functionality.

Technical Specifications

Reference Files

  • packages/desktop-app/src/tests/components/textarea-bidirectional-conversion.test.ts
  • packages/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

  1. self-assigned this
    on Nov 5, 2025
  2. added a commit that references this issue on Nov 5, 2025
    916fa31
  3. added a commit that references this issue on Nov 5, 2025
    ba3a9b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions