Skip to content

test: EditorContext の action 統合テスト (+28)#56

Merged
Pregum merged 1 commit intomainfrom
test/editor-context-actions
Apr 23, 2026
Merged

test: EditorContext の action 統合テスト (+28)#56
Pregum merged 1 commit intomainfrom
test/editor-context-actions

Conversation

@Pregum
Copy link
Copy Markdown
Owner

@Pregum Pregum commented Apr 23, 2026

Summary

EditorContext の action を React Testing Library の renderHook + act で発火し、state 遷移を検証する統合テストを 28 件追加。168 → 196 tests

網羅領域

テストグループ 件数 内容
basic 5 selectNode / updateNode+undo / deleteNode / addNode / toggleSelectNode
wrapSelectionInFrame 2 bbox 計算 + 子座標ローカル化 / 空選択 no-op
components 3 createComponent / unmakeComponent / insertInstance
z-order 4 forward / front / backward 境界 / reorderChildren
styles 4 upsert 上書き / remove / color apply / text apply
boolean/flatten/outline 4 union / 選択 <2 で no-op / flatten / outline stroke
mask/comments 2 toggleMask / comment lifecycle
detachFromParentIfOutside 3 外 → 昇格 / 内 → 維持 / top-level no-op
variables 1 upsert / rename / remove

window.alert / confirm は vi.spyOn で mock。

Test plan

  • npm test で 14 ファイル / 196 件全 pass
  • ビルド OK

🤖 Generated with Claude Code

renderHook + EditorProvider で各 action を act() 発火して state 遷移を
検証する React 統合テスト(jsdom 環境)。

網羅領域:
- 基本: selectNode / updateNode + undo / deleteNode / addNode / toggleSelectNode
- wrapSelectionInFrame: bbox 計算、子座標のローカル化、空選択で no-op
- components: createComponent / unmakeComponent / insertInstance
- z-order: reorderSelected forward/front/backward (境界) / reorderChildren
- styles: upsertStyle 上書き / removeStyle / applyStyleToSelection
  (color に対する fill 適用、text の fontSize/weight/fill 適用)
- boolean / flatten / outlineStroke: それぞれ 1〜2 ケース (alert 時の no-op も)
- mask / comments: toggleMaskSelected、コメント add/update/remove ライフサイクル
- detachFromParentIfOutside: 外に出たら昇格 / 内なら維持 / top-level は no-op
- variables: upsertVariable / renameVariable / removeVariable

window.alert / confirm を spyOn で mock。
168 → 196 tests (+28)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Pregum Pregum merged commit 44fe15a into main Apr 23, 2026
1 check passed
@Pregum Pregum deleted the test/editor-context-actions branch April 23, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant