test(canvas): expect pending fonts to skip text

This commit is contained in:
Danila Poyarkov 2026-05-14 23:46:36 +03:00
parent a091ac7284
commit 834f369882

View file

@ -86,14 +86,14 @@ describe('renderText', () => {
expect(r._paragraph.delete).toHaveBeenCalledTimes(1) expect(r._paragraph.delete).toHaveBeenCalledTimes(1)
}) })
test('uses paragraph even when node font is NOT available (fallback to default)', () => { test('skips text while the node font is not available', () => {
const r = createMockRenderer({ isNodeFontLoaded: mock(() => false) }) const r = createMockRenderer({ isNodeFontLoaded: mock(() => false) })
const canvas = createMockCanvas() const canvas = createMockCanvas()
renderText(r, canvas as never, textNode()) renderText(r, canvas as never, textNode())
expect(r.buildParagraph).toHaveBeenCalledTimes(1) expect(r.buildParagraph).not.toHaveBeenCalled()
expect(canvas.drawParagraph).toHaveBeenCalledTimes(1) expect(canvas.drawParagraph).not.toHaveBeenCalled()
expect(canvas.drawText).not.toHaveBeenCalled() expect(canvas.drawText).not.toHaveBeenCalled()
}) })