Skip to content

editor: item-surface move test turns snapping off for every context - #1199

Merged
wass08 merged 1 commit into
mainfrom
fix/item-surface-move-snap-mode
Oct 30, 2026
Merged

wass08 merged 1 commit into
mainfrom
fix/item-surface-move-snap-mode

Conversation

@wass08

@wass08 wass08 commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

item-surface-move.test.ts asserts raw item poses, but it relied on whatever snapping state a previous test file left behind. In a different file order (private-editor's CI, which reruns the editor packages at a new pin) a leaked interaction scope put the move into a grid-snapped context, and three tests failed (0.7 → 0.5, -0.5 → -0.25, 4.33 → 4.14). The test now sets every snapping context off in beforeEach and restores them in afterEach. Test-only change.

How to test

  1. bun test src/components/tools/registry/item-surface-move.test.ts in packages/editor: 18 pass.
  2. Reproduced locally with a test file that leaves a room-divide scope running before it: 3 failures without this change, 0 with it.

Screenshots / screen recording

N/A — non-visual change

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

🤖 Generated with Claude Code


Note

Low Risk
Test harness isolation only; no application or editor runtime code paths change.

Overview
Fixes order-dependent failures in item-surface-move.test.ts by resetting editor snapping before each test and restoring it after.

The suite checks raw hosted item poses (e.g. grab math at 0.7, -0.5). When another file leaves an interaction scope with grid snapping on, those values get quantized and assertions break under different CI test order. beforeEach now forces snappingModeByContext to off for every known context; afterEach puts the prior map back so other suites are unaffected.

Test-only change—no production behavior.

Reviewed by Cursor Bugbot for commit f9e8aa4. Bugbot is set up for automated code reviews on this repo. Configure here.

Its poses are asserted raw, but it read whatever snapping a previous suite left
behind: in another file order (private-editor's CI) a leaked interaction scope
put the move in a grid-snapped context and three poses snapped. The test now
sets every context off and restores them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wass08
wass08 merged commit 9cbc76e into main Oct 30, 2026
4 checks passed
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