From 4c26536e695afdd85209bb18fb721ff16ce2c4e0 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Thu, 11 Jun 2026 23:05:25 +0300 Subject: [PATCH] test: align render shard with package split --- .../render/canvas/silhouette-autopsy.test.ts | 2 +- tests/engine/render/jsx/render-tree.test.ts | 38 +++++++++++++++++-- tools/unit-tests/src/shards.ts | 3 +- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/tests/engine/render/canvas/silhouette-autopsy.test.ts b/tests/engine/render/canvas/silhouette-autopsy.test.ts index 2241cecc2..a33039897 100644 --- a/tests/engine/render/canvas/silhouette-autopsy.test.ts +++ b/tests/engine/render/canvas/silhouette-autopsy.test.ts @@ -37,7 +37,7 @@ const shadowsPath = coreSourcePath('canvas/shadows.ts') const effectsPath = coreSourcePath('canvas/effects.ts') const scenePath = coreSourcePath('canvas/scene.ts') const rendererPath = coreSourcePath('canvas/renderer.ts') -const sgTypesPath = coreSourcePath('scene-graph/types.ts') +const sgTypesPath = repoPath('packages/scene-graph/src/types.ts') const nodeExportPath = coreSourcePath('kiwi/fig/node-change/export-node.ts') const convertPath = coreSourcePath('kiwi/fig/node-change/paint.ts') const schemaPath = repoPath('packages/kiwi/src/fig/schema/fig.kiwi') diff --git a/tests/engine/render/jsx/render-tree.test.ts b/tests/engine/render/jsx/render-tree.test.ts index 744790420..234501cad 100644 --- a/tests/engine/render/jsx/render-tree.test.ts +++ b/tests/engine/render/jsx/render-tree.test.ts @@ -27,6 +27,33 @@ import { import { expectDefined, getNodeOrThrow, childIdAt } from '#tests/helpers/assert' import { makeSceneGraph } from '#tests/helpers/scene' +function addTestColorVariable( + graph: ReturnType, + id: string, + name: string, + value = { r: 1, g: 1, b: 1, a: 1 } +): void { + if (!graph.variableCollections.has('colors')) { + graph.addCollection({ + id: 'colors', + name: 'Colors', + modes: [{ modeId: 'light', name: 'Light' }], + defaultModeId: 'light', + variableIds: [] + }) + } + + graph.addVariable({ + id, + name, + type: 'COLOR', + collectionId: 'colors', + valuesByMode: { light: value }, + description: '', + hiddenFromPublishing: false + }) +} + describe('renderTree', () => { it('renders a simple frame', async () => { const g = makeSceneGraph() @@ -187,8 +214,10 @@ describe('renderTree', () => { expect(node.fills[0]?.type).toBe('SOLID') }) - it('supports explicit variable bindings for arbitrary paths', async () => { + it('supports explicit variable bindings for supported paths', async () => { const g = makeSceneGraph() + addTestColorVariable(g, 'var-shadow', 'Shadow', { r: 0, g: 0, b: 0, a: 1 }) + addTestColorVariable(g, 'var-bg', 'Background') const variable = designVar('var-shadow', '#000000') const result = await renderTree( g, @@ -196,17 +225,20 @@ describe('renderTree', () => { name: 'Bound explicit', w: 100, h: 100, - bind: { 'effects/0/color': variable, 'fills/0/color': 'var-bg' } + fill: '#ffffff', + stroke: '#000000', + bind: { 'strokes/0/color': variable, 'fills/0/color': 'var-bg' } }) ) const node = getNodeOrThrow(g, result.id) - expect(node.boundVariables['effects/0/color']).toBe('var-shadow') + expect(node.boundVariables['strokes/0/color']).toBe('var-shadow') expect(node.boundVariables['fills/0/color']).toBe('var-bg') }) it('binds variables from JSX strings', async () => { const g = makeSceneGraph() + addTestColorVariable(g, 'var-bg', 'Background') const [result] = await renderJSX( g, `` diff --git a/tools/unit-tests/src/shards.ts b/tools/unit-tests/src/shards.ts index 5f09e5706..758e810cf 100644 --- a/tools/unit-tests/src/shards.ts +++ b/tools/unit-tests/src/shards.ts @@ -41,7 +41,8 @@ export const HEAVY_UNIT_TEST_PATTERNS = [ 'tests/engine/io/fig/export/text.test.ts', 'tests/engine/io/fig/export/worker.test.ts', 'tests/engine/io/fig/import/group-reclassify.test.ts', - 'tests/engine/layout/auto-layout/text/measurement.test.ts' + 'tests/engine/layout/auto-layout/text/measurement.test.ts', + 'tests/engine/render/canvas/cache.test.ts' ] as const export function unitTestGroupNames(): UnitTestGroup[] {