Add tests for board rendering, drag and drop, and settings toggles
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
- 72/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- testing
Hướng nghiên cứu
Start with tests/ and the existing test setup, then read the referenced sections of js/utils.js, js/board.js, js/drag.js, and js/main.js. Run npm test and npm run lint to see current conventions and coverage. Add tests for each listed behavior and make the drag handlers importable; done when the acceptance criteria pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Drag and drop is the default input method and the most recently changed area, yet it has no automated check. js/drag.js has no CommonJS export and js/main.js is a single DOMContentLoaded handler, so neither can be loaded by the current tests.
Where
js/drag.js:285-288(onlywindow.initDragAndDropis exposed),js/drag.js:186-283js/main.js:7-80js/board.js:13,js/board.js:39,js/board.js:99,js/board.js:153js/utils.js:10-27,js/utils.js:60-82
Suggested fix
-
utils:algebraicToCoordsreturnsnullfor'i1','a9','a0','',null,'e44'and accepts'E4';coordsToAlgebraic(8,0)and(-1,0)returnnull;isWithinBoundsat 0, 7, -1, 8 -
deepClone: a nested board clone is independent of the source -
board:createBoardmakes 64 squares withdata-rowanddata-col;renderPiecesplaces 32 pieces at the start;updateBoardVisualsmarks the selected square, the possible moves and the king in check -
handleBoardClickEvent: a click on a piece inside a square selects it; it is ignored whilewindow.dragJustEndedis true -
drag: export the handlers for tests; mousedown, mousemove, mouseup over a legal square callsmakeMoveonce; a drop on an illegal square or outside the board leaves the position unchanged and clears the selection; mousedown without movement falls through to click selection (#23) -
main: toggles read and write their storage keys with the documented defaults - Optional: one browser smoke test, since jsdom has no layout for
elementsFromPoint
Acceptance criteria
-
drag.jshandlers are importable in tests - Each item above has a test
Getting started
- Relevant files:
js/drag.js,js/board.js,js/main.js,js/utils.js,tests/ - How to run tests:
npm install, thennpm testandnpm run lint - Related docs:
docs/ARCHITECTURE.md,.github/CONTRIBUTING.md
Filed by repo-audit/full-audit at 8a2c86c. Severity: low. Effort: M. audit-key: testing|js/drag.js|handleDragEnd
- Ngôn ngữ chính
- JavaScript
- Star
- 4
- Fork
- 2
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TMHSDigital/Static_Chess
-
enhancement good first issue severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/Static_Chess#53 ·
-
documentation good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
TMHSDigital/Static_Chess#49 ·
-
documentation good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
TMHSDigital/Static_Chess#48 ·
-
documentation severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/Static_Chess#47 ·
-
documentation good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/Static_Chess#46 ·
Tất cả issue của TMHSDigital/Static_Chess
Issue tương tự
-
good first issue tests
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Download a leaderboard as CSVĐang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
growilabs/growi#12246 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
TMHSDigital/Free-Game-Dev-Assets#301 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100