Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add browser test suite

Đang mở
#39 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github-actions, react, typescript
Lĩnh vực
testing-qa

Hướng nghiên cứu

Start with the hook source and the contentEditable editing paths it drives, then copy the browser-test setup from react-live (vitest.browser.mts and its stories/ folder). Add the npm run test script, keep it out of npm run check, and add a CI job that installs Chromium and runs the suite on the React 18.0.0 leg. Done when the checklist items are covered, the caret regression test for #37 passes, and CONTRIBUTING.md explains how to run the suite.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

use-editable has no tests. Add a browser test suite, following react-live's setup (vitest + @vitest/browser-playwright, stories run in real Chromium).

jsdom can't stand in here: it has no contentEditable editing model, so typing, selection, and caret behavior have to be exercised in a real browser.

Coverage to aim for

  • Typing: characters land in the right place, and onChange receives the right text and Position
  • Caret position: preserved across re-renders, including an unrelated parent re-render mid-keystroke (regression test for #37)
  • Undo / redo: Cmd/Ctrl+Z and Shift+Cmd/Ctrl+Z history
  • Indentation: opts.indentation Tab/Shift+Tab and backspace behavior
  • Edit API: update, insert (including negative offsets), move (offset and { row, column }), getState
  • opts.disabled: toggling it on and off
  • Line breaks: Enter, <br> handling, trailing newline

Setup

  • vitest browser config + Playwright Chromium (see react-live's vitest.browser.mts and stories/)
  • npm run test script (kept out of npm run check, like react-live, so the main check stays fast)
  • CI job that installs Chromium and runs the suite, including the React 18.0.0 compat leg
  • Document in CONTRIBUTING.md

Related: #38 (oxlint). Its hooks-order fix would benefit from these tests landing first.

Ngôn ngữ chính
TypeScript
Star
620
Fork
16
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FormidableLabs/use-editable

Tất cả issue của FormidableLabs/use-editable

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.