Skip to content

Commit 85bd281

Browse files
committed
chore(painter): drop unused imports and skipped legacy tests (SD-2836)
renderer.ts: drop unused Layout, Page, Measure, FlowBlock, ParagraphBorder type imports left over from the migration. index.test.ts: delete the skipped 'decoration item synthesis' describe block (it was protecting the synthesis path that has been removed).
1 parent 20ffc04 commit 85bd281

2 files changed

Lines changed: 0 additions & 179 deletions

File tree

packages/layout-engine/painters/dom/src/index.test.ts

Lines changed: 0 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -10857,181 +10857,6 @@ describe('applyRunDataAttributes', () => {
1085710857
});
1085810858
});
1085910859

10860-
describe.skip('decoration item synthesis (legacy, deleted in PR2 of SD-2836)', () => {
10861-
let mount: HTMLElement;
10862-
10863-
beforeEach(() => {
10864-
mount = document.createElement('div');
10865-
document.body.appendChild(mount);
10866-
});
10867-
10868-
afterEach(() => {
10869-
document.body.removeChild(mount);
10870-
});
10871-
10872-
it('synthesizes missing header items from legacy setData bridge data', () => {
10873-
const mainBlock: FlowBlock = {
10874-
kind: 'paragraph',
10875-
id: 'main-block',
10876-
runs: [{ text: 'Main', fontFamily: 'Arial', fontSize: 16, pmStart: 0, pmEnd: 4 }],
10877-
};
10878-
const mainMeasure: Measure = {
10879-
kind: 'paragraph',
10880-
lines: [{ fromRun: 0, fromChar: 0, toRun: 0, toChar: 4, width: 40, ascent: 12, descent: 4, lineHeight: 20 }],
10881-
totalHeight: 20,
10882-
};
10883-
const headerBlock: FlowBlock = {
10884-
kind: 'paragraph',
10885-
id: 'hf-header-synth',
10886-
runs: [{ text: 'Synth Header', fontFamily: 'Arial', fontSize: 14, pmStart: 0, pmEnd: 12 }],
10887-
};
10888-
const headerMeasure: Measure = {
10889-
kind: 'paragraph',
10890-
lines: [{ fromRun: 0, fromChar: 0, toRun: 0, toChar: 12, width: 90, ascent: 10, descent: 3, lineHeight: 16 }],
10891-
totalHeight: 16,
10892-
};
10893-
const layout: Layout = {
10894-
pageSize: { w: 400, h: 500 },
10895-
pages: [{ number: 1, fragments: [] }],
10896-
};
10897-
10898-
const painter = createDomPainter({
10899-
blocks: [mainBlock],
10900-
measures: [mainMeasure],
10901-
headerProvider: () => ({
10902-
height: 16,
10903-
offset: 0,
10904-
fragments: [{ kind: 'para', blockId: 'hf-header-synth', fromLine: 0, toLine: 1, x: 0, y: 0, width: 120 }],
10905-
}),
10906-
});
10907-
10908-
painter.setData([mainBlock], [mainMeasure], [headerBlock], [headerMeasure]);
10909-
painter.paint(layout, mount);
10910-
10911-
expect(mount.querySelector('.superdoc-page-header')?.textContent).toContain('Synth Header');
10912-
expect(mount.querySelector('.render-error-placeholder')).toBeNull();
10913-
});
10914-
10915-
it('synthesizes missing footer items from direct DomPainterInput bridge data', () => {
10916-
const footerBlock: FlowBlock = {
10917-
kind: 'paragraph',
10918-
id: 'hf-footer-synth',
10919-
runs: [{ text: 'Synth Footer', fontFamily: 'Arial', fontSize: 14, pmStart: 0, pmEnd: 12 }],
10920-
};
10921-
const footerMeasure: Measure = {
10922-
kind: 'paragraph',
10923-
lines: [{ fromRun: 0, fromChar: 0, toRun: 0, toChar: 12, width: 88, ascent: 10, descent: 3, lineHeight: 16 }],
10924-
totalHeight: 16,
10925-
};
10926-
const layout: Layout = {
10927-
pageSize: { w: 400, h: 500 },
10928-
pages: [{ number: 1, fragments: [] }],
10929-
};
10930-
10931-
const painter = createDomPainter({
10932-
footerProvider: () => ({
10933-
height: 16,
10934-
offset: 460,
10935-
fragments: [{ kind: 'para', blockId: 'hf-footer-synth', fromLine: 0, toLine: 1, x: 0, y: 0, width: 120 }],
10936-
}),
10937-
});
10938-
10939-
painter.paint(
10940-
{
10941-
resolvedLayout: emptyResolved,
10942-
sourceLayout: layout,
10943-
footerBlocks: [footerBlock],
10944-
footerMeasures: [footerMeasure],
10945-
},
10946-
mount,
10947-
);
10948-
10949-
expect(mount.querySelector('.superdoc-page-footer')?.textContent).toContain('Synth Footer');
10950-
expect(mount.querySelector('.render-error-placeholder')).toBeNull();
10951-
});
10952-
10953-
it('validates optional decoration block/measure pairs on direct input', () => {
10954-
const painter = createDomPainter({});
10955-
const layout: Layout = {
10956-
pageSize: { w: 400, h: 500 },
10957-
pages: [{ number: 1, fragments: [] }],
10958-
};
10959-
10960-
expect(() =>
10961-
painter.paint(
10962-
{
10963-
resolvedLayout: emptyResolved,
10964-
sourceLayout: layout,
10965-
headerBlocks: [
10966-
{
10967-
kind: 'paragraph',
10968-
id: 'hf-header-invalid',
10969-
runs: [{ text: 'Invalid', fontFamily: 'Arial', fontSize: 12, pmStart: 0, pmEnd: 7 }],
10970-
},
10971-
],
10972-
},
10973-
mount,
10974-
),
10975-
).toThrow('headerBlocks and headerMeasures must both be provided or both be omitted.');
10976-
});
10977-
10978-
it('validates optional decoration block/measure pairs in setData', () => {
10979-
const painter = createDomPainter({});
10980-
10981-
expect(() =>
10982-
painter.setData(
10983-
[
10984-
{
10985-
kind: 'paragraph',
10986-
id: 'body',
10987-
runs: [{ text: 'Body', fontFamily: 'Arial', fontSize: 12, pmStart: 0, pmEnd: 4 }],
10988-
},
10989-
],
10990-
[
10991-
{
10992-
kind: 'paragraph',
10993-
lines: [
10994-
{ fromRun: 0, fromChar: 0, toRun: 0, toChar: 4, width: 30, ascent: 10, descent: 3, lineHeight: 16 },
10995-
],
10996-
totalHeight: 16,
10997-
},
10998-
],
10999-
[
11000-
{
11001-
kind: 'paragraph',
11002-
id: 'hf-header-invalid',
11003-
runs: [{ text: 'Invalid', fontFamily: 'Arial', fontSize: 12, pmStart: 0, pmEnd: 7 }],
11004-
},
11005-
],
11006-
),
11007-
).toThrow('headerBlocks and headerMeasures must both be provided or both be omitted.');
11008-
});
11009-
11010-
it('uses setResolvedLayout for legacy layout paints', () => {
11011-
const painter = createDomPainter({});
11012-
const layout: Layout = {
11013-
pageSize: { w: 400, h: 500 },
11014-
pages: [{ number: 1, fragments: [] }],
11015-
};
11016-
11017-
painter.setResolvedLayout(emptyResolved);
11018-
11019-
expect(() => painter.paint(layout, mount)).not.toThrow();
11020-
expect(mount.querySelector('.superdoc-page')).toBeTruthy();
11021-
});
11022-
11023-
it('creates an empty resolved layout for legacy paints without block data', () => {
11024-
const painter = createDomPainter({});
11025-
const layout: Layout = {
11026-
pageSize: { w: 400, h: 500 },
11027-
pages: [{ number: 1, fragments: [] }],
11028-
};
11029-
11030-
expect(() => painter.paint(layout, mount)).not.toThrow();
11031-
expect(mount.querySelector('.superdoc-page')).toBeTruthy();
11032-
});
11033-
});
11034-
1103510860
describe('footer alignment logic', () => {
1103610861
let mount: HTMLElement;
1103710862

packages/layout-engine/painters/dom/src/renderer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,15 @@ import type {
1717
ImageFragment,
1818
ImageHyperlink,
1919
ImageRun,
20-
Layout,
2120
Line,
2221
LineSegment,
2322
ListBlock,
2423
ListItemFragment,
2524
ListMeasure,
26-
Measure,
27-
Page,
2825
PageMargins,
2926
ParaFragment,
3027
ParagraphAttrs,
3128
ParagraphBlock,
32-
ParagraphBorder,
3329
ParagraphMeasure,
3430
PositionedDrawingGeometry,
3531
Run,

0 commit comments

Comments
 (0)