Skip to content

AI-native design editor. Open-source Figma alternative.

test(text): lock complex outline guards

Danila Poyarkov1b1c7e6409f9
diff --git a/tests/engine/editor/structure/boolean.test.ts b/tests/engine/editor/structure/boolean.test.ts
index 075323bb3..77f6f50e0 100644
--- a/tests/engine/editor/structure/boolean.test.ts
+++ b/tests/engine/editor/structure/boolean.test.ts
@@ -37,6 +37,22 @@ describe('booleanOperationSelected', () => {
expect(editor.state.selectedIds).toEqual(new Set([first.id, second.id]))
})
+ test('does not wrap complex script text without shaping support', () => {
+ const editor = createEditor()
+ const pageId = editor.state.currentPageId
+ const first = editor.graph.createNode('TEXT', pageId, {
+ text: 'مرحبا',
+ fontFamily: 'Inter'
+ })
+ const second = editor.graph.createNode('RECTANGLE', pageId)
+
+ editor.select([first.id, second.id])
+ const result = editor.booleanOperationSelected('UNION')
+
+ expect(result).toBeNull()
+ expect(editor.graph.getNode(pageId)?.childIds).toEqual([first.id, second.id])
+ })
+
test('does not wrap visible image fills', () => {
const editor = createEditor()
const pageId = editor.state.currentPageId
diff --git a/tests/engine/editor/structure/flatten.test.ts b/tests/engine/editor/structure/flatten.test.ts
index 6882e44f1..ac617785c 100644
--- a/tests/engine/editor/structure/flatten.test.ts
+++ b/tests/engine/editor/structure/flatten.test.ts
@@ -153,6 +153,27 @@ describe('flattenSelected', () => {
surface.delete()
})
+ test('does not flatten complex script text without shaping support', async () => {
+ await loadInterRegular()
+ const { editor, surface } = await createEditorWithRenderer()
+ const pageId = editor.state.currentPageId
+ const text = editor.graph.createNode('TEXT', pageId, {
+ text: 'مرحبا',
+ fontFamily: 'Inter',
+ fontWeight: 400,
+ fontSize: 32,
+ width: 120,
+ height: 40
+ })
+
+ editor.select([text.id])
+ const result = editor.flattenSelected()
+
+ expect(result).toBeNull()
+ expect(editor.graph.getNode(text.id)?.type).toBe('TEXT')
+ surface.delete()
+ })
+
test('does not flatten unsupported text nodes', async () => {
const { editor, surface } = await createEditorWithRenderer()
const pageId = editor.state.currentPageId