Skip to content

test(selection): behavior tests for drag selection across marks and tables (SD-2057)#2318

Open
tupizz wants to merge 1 commit intomainfrom
tadeu/sd-2057-selection-drag-behavior-tests
Open

test(selection): behavior tests for drag selection across marks and tables (SD-2057)#2318
tupizz wants to merge 1 commit intomainfrom
tadeu/sd-2057-selection-drag-behavior-tests

Conversation

@tupizz
Copy link
Contributor

@tupizz tupizz commented Mar 6, 2026

Summary

Adds 6 Playwright behavior tests covering the selection fixes from PR #2205 (SD-2024):

  • Selection across mark boundaries: Verifies the selection overlay remains visible when selecting across differently formatted text (bold, italic). Tests both programmatic selection and real mouse drag.
  • Drag flicker prevention: Samples the selection overlay at multiple points during a drag across mark boundaries to verify it never drops to zero rects mid-drag.
  • Table boundary clamping: Verifies drag selection from a paragraph into a table clamps at the table boundary instead of creating a CellSelection.
  • Wide selection spanning tables: Verifies a selection from before a table to after it produces visible overlay rects.

All tests pass on Chromium, Firefox, and WebKit.

Resolves SD-2057

Test plan

  • npx playwright test tests/selection/drag-selection-across-marks-and-tables.spec.ts — 6/6 pass on all 3 browsers

…nd tables (SD-2057)

Add 6 Playwright behavior tests covering the selection fixes from PR #2205:

- Selection overlay remains visible when selecting across mark boundaries
  (bold → italic, different formatting runs)
- Drag selection maintains continuous overlay without flicker mid-drag
- Drag from paragraph into table clamps at the table boundary
- Wide selection spanning past a table is allowed with visible overlay

All tests pass on Chromium, Firefox, and WebKit.
@linear
Copy link

linear bot commented Mar 6, 2026

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1fe21860ec

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

await superdoc.page.mouse.down();

// Drag across the line in small increments, sampling overlay at each step
let minRects = Infinity;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert that mid-drag sampling actually observed a selection

minRects starts as Infinity and is only updated inside if (sel.to - sel.from > 0). If a regression causes the drag to never produce a non-collapsed selection during sampled steps, minRects remains Infinity and expect(minRects).toBeGreaterThan(0) still passes, turning this into a false positive test. Add an explicit assertion that at least one non-collapsed sample was recorded before checking the minimum rect count.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant