Skip to content

test: add updateDOM integration tests for focus/typing #34

@adnaan

Description

@adnaan

Context

This follow-up task was identified during the review of PR #32.

Source PR: #32
PR Title: fix: skip patching focused form elements during DOM update
Suggested by: @Copilot (review comment)

Task Description

PR #32 added unit tests for shouldSkipUpdate but lacks integration tests that exercise the full updateDOM() path with morphdom. Add regression tests covering:

  1. Focused textarea is not modified during an update — type in a textarea, trigger updateDOM with server content, verify textarea value and cursor position are preserved
  2. After blur, server updates apply again — focus a textarea, trigger update (skipped), blur, trigger another update, verify server content is applied
  3. Unfocused textarea .value is updated from server-rendered content — verify the onElUpdated textContent→value sync works for dirty textareas

Implementation notes

  • These tests will need to instantiate LiveTemplateClient or at minimum call updateDOM directly with morphdom
  • May need to mock WebSocket transport
  • Should use real DOM focus/blur (not private field mutation)

This issue was automatically created from PR review comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upFollow-up task from PR reviewfrom-reviewIssue originated from PR review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions