Skip to content

test(behavior): pin RTL bidiVisual derived from a table style (SD-2767 Wave 3)#3350

Merged
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-2767-wave3-style-bidivisual
May 16, 2026
Merged

test(behavior): pin RTL bidiVisual derived from a table style (SD-2767 Wave 3)#3350
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-2767-wave3-style-bidivisual

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Wave 3 coverage gap on SD-2767. The existing rtl-bidivisual-* fixtures all set w:bidiVisual inline on the table element. Style-cascade-derived bidiVisual (a custom table style that sets it, table references via w:tblStyle with no inline override) was not exercised at the behavior layer.

What lands

  • tests/behavior/tests/tables/fixtures/rtl-style-derived-bidivisual.docx: minimal DOCX fixture, verified in Word. styles.xml defines RtlStyleTable with w:tblPr/w:bidiVisual. document.xml has a 1x3 table that uses w:tblStyle="RtlStyleTable" and no inline w:bidiVisual. Word confirms Document.Tables(1).TableDirection === 1 (wdTableDirectionRtl) when opening it.
  • tests/behavior/tests/tables/rtl-style-derived-bidivisual.spec.ts: behavior spec asserting cell ordering. Logical cells A, B, C in document order must render visually as C, B, A (logical first on visual right).

Pipeline coverage

This validates the full chain:

  1. pm-adapter style cascade resolves w:bidiVisual from the style (SD-3138 Phase 1B foundation)
  2. DomPainter mirrors visual sides once at paint time

The test passes on chromium, firefox, webkit. SuperDoc already handles this correctly; the spec is regression coverage against future changes to pm-adapter style resolution or painter mirror logic for style-cascade bidiVisual.

Pure test addition. No production code changes.

@caio-pizzol caio-pizzol requested a review from a team as a code owner May 16, 2026 14:20
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 16, 2026

SD-2767

SD-2767 Wave 3 coverage gap. The existing rtl-bidivisual-* fixtures all
set w:bidiVisual inline on the table. Style-cascade-derived bidiVisual
(a custom table style that sets w:bidiVisual, with the table referencing
the style via w:tblStyle and no inline override) was not exercised at
the behavior layer.

Add a Word-native fixture where:
- styles.xml defines RtlStyleTable with w:tblPr/w:bidiVisual
- document.xml's table uses w:tblStyle="RtlStyleTable", no inline w:bidiVisual

Word confirms Document.Tables(1).TableDirection === 1 (wdTableDirectionRtl)
when opening this fixture.

The behavior spec asserts cell ordering: logical cells A, B, C in
document order must render visually as C, B, A (logical first on visual
right). Validates the full pipeline:
- pm-adapter style cascade resolves w:bidiVisual from the style
  (SD-3138 Phase 1B foundation)
- DomPainter mirrors visual sides once at paint time

Passes on chromium, firefox, webkit. Pure test addition - no production
code changes. Future regressions in pm-adapter style resolution or
painter mirror logic for style-cascade bidiVisual will fail this test.
@caio-pizzol caio-pizzol force-pushed the caio-pizzol/SD-2767-wave3-style-bidivisual branch from 79d8daf to bf77bfe Compare May 16, 2026 14:22
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@caio-pizzol caio-pizzol merged commit df091a7 into main May 16, 2026
29 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-2767-wave3-style-bidivisual branch May 16, 2026 14:40
msviderok pushed a commit to msviderok/superdoc that referenced this pull request May 17, 2026
…e cascade (SD-3171)

Update the rtl-style-derived-bidivisual.spec.ts assertion from C B A to
A B C - the Word-parity contract that the pm-adapter fix in the previous
commit installs. The original assertion in PR superdoc-dev#3350 pinned SuperDoc's
pre-fix behavior, not Word's.

Add rtl-inline-bidivisual.spec.ts as the positive control: a fixture
where w:bidiVisual is set INLINE on the table's tblPr. Word's renderer
visually flips cells here (TableDirection=wdTableDirectionRtl,
cells render C B A). SuperDoc must match. Both fixtures load a 1x3
table with logical cells A B C.

The pair proves the fix is direction-specific:
- style-cascade source -> no visual flip (Word-parity, both render A B C)
- inline source -> visual flip (Word-parity, both render C B A)

Both specs pass on chromium, firefox, webkit.

Inline fixture includes the default TableNormal style so the super-
converter can anchor its style cascade; the bare custom style version
without TableNormal triggered a docxImporter throw.
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.

2 participants