Skip to content

Commit 2699e3a

Browse files
committed
test(direction): pin SD-2778 migration via typed-path + broader-fallback cases
Two coverage gaps caught in review: - layout-resolved/src/resolveLayout.test.ts ("preserves increasing first-line marker anchor for nested RTL list levels") used attrs.direction: 'rtl'. The pre-migration code read attrs.direction directly, so that fixture would have passed against the old implementation. Switch to directionContext.inlineDirection so the test only passes through the new helper-driven typed path. - layout-bridge/test/position-hit.test.ts: switching isRtlBlock to getParagraphInlineDirection is strictly broader on fallback (the helper also picks up paragraphProperties.rightToLeft when no directionContext is present). Pin that case so the broadening is intentional and not a regression vector.
1 parent eb977f0 commit 2699e3a

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

packages/layout-engine/layout-bridge/test/position-hit.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,13 @@ describe('isRtlBlock', () => {
6161
),
6262
).toBe(true);
6363
});
64+
65+
// SD-2778: switching to getParagraphInlineDirection is strictly broader on
66+
// fallback than the prior inline read. Specifically, the helper picks up
67+
// paragraphProperties.rightToLeft when neither directionContext nor the legacy
68+
// scalar field is present. Pin that case so the broader fallback is intentional.
69+
it('falls back to paragraphProperties.rightToLeft when no other direction signal is present', () => {
70+
expect(isRtlBlock(paragraph({ paragraphProperties: { rightToLeft: true } }))).toBe(true);
71+
expect(isRtlBlock(paragraph({ paragraphProperties: { rightToLeft: false } }))).toBe(false);
72+
});
6473
});

packages/layout-engine/layout-resolved/src/resolveLayout.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,12 @@ describe('resolveLayout', () => {
17771777
id,
17781778
runs: [{ kind: 'text', text: 'RTL list item' }],
17791779
attrs: {
1780-
direction: 'rtl',
1780+
// SD-2778: use directionContext so this test only passes through the
1781+
// new helper-driven typed path. The pre-migration code read
1782+
// attrs.direction directly, so the prior `direction: 'rtl'` fixture
1783+
// would have passed against the old implementation too and didn't
1784+
// actually prove the migration.
1785+
directionContext: { inlineDirection: 'rtl', writingMode: 'horizontal-tb' },
17811786
indent: { right, hanging: -24 },
17821787
wordLayout: {
17831788
marker: {

0 commit comments

Comments
 (0)