AI-native design editor. Open-source Figma alternative.
feat(demo): showcase text decoration fidelity
Danila Poyarkov842cfe74f452
diff --git a/src/app/demo/sections/standalone.ts b/src/app/demo/sections/standalone.tsindex ce64126f3..256b8fd8e 100644--- a/src/app/demo/sections/standalone.ts+++ b/src/app/demo/sections/standalone.ts@@ -65,9 +65,9 @@ export function createStandaloneShapes(store: EditorStore) {fills: [solid(DEMO_COLORS.white)]})- const typoFrame = store.createShape('FRAME', 700, 660, 320, 164)+ const typoFrame = store.createShape('FRAME', 700, 660, 320, 210)graph.updateNode(typoFrame, {- name: 'Typography & OpenType',+ name: 'Typography, OpenType & Decorations',cornerRadius: 12,fills: [solid(DEMO_COLORS.white)],strokes: thinStroke(DEMO_COLORS.gray200),@@ -98,6 +98,24 @@ export function createStandaloneShapes(store: EditorStore) {{ tag: 'DLIG', enabled: true },{ tag: 'KERN', enabled: false }]+ },+ {+ text: 'Wavy underline from imported .fig',+ size: 13,+ weight: 500,+ decoration: 'UNDERLINE' as const,+ decorationStyle: 'WAVY' as const,+ decorationFills: [solid(DEMO_COLORS.red)],+ decorationThickness: 1.6+ },+ {+ text: 'Dotted underline + custom thickness',+ size: 13,+ weight: 500,+ decoration: 'UNDERLINE' as const,+ decorationStyle: 'DOTTED' as const,+ decorationFills: [solid(DEMO_COLORS.blue)],+ decorationThickness: 2}]for (const t of typoItems) {@@ -108,6 +126,10 @@ export function createStandaloneShapes(store: EditorStore) {fontSize: t.size,fontWeight: t.weight,fontFeatures: t.features ?? [],+ textDecoration: t.decoration ?? 'NONE',+ textDecorationStyle: t.decorationStyle ?? 'SOLID',+ textDecorationFills: t.decorationFills ?? [],+ textDecorationThickness: t.decorationThickness ?? null,textAutoResize: 'HEIGHT',layoutAlignSelf: 'STRETCH',fills: [solid(DEMO_COLORS.black)]diff --git a/tests/engine/app/demo.test.ts b/tests/engine/app/demo.test.tsnew file mode 100644index 000000000..c4d4e1478--- /dev/null+++ b/tests/engine/app/demo.test.ts@@ -0,0 +1,36 @@+import { describe, expect, test } from 'bun:test'++import { createStandaloneShapes } from '@/app/demo/sections/standalone'+import { createEditorStore } from '@/app/editor/session'++describe('demo document', () => {+ test('showcases imported OpenType and text decoration features', () => {+ const store = createEditorStore()++ createStandaloneShapes(store)++ const nodes = [...store.graph.getAllNodes()]+ const ligatures = nodes.find((node) => node.name === 'Ligatures')+ const rawTags = nodes.find((node) => node.name === 'Raw')+ const wavy = nodes.find((node) => node.name === 'Wavy')+ const dotted = nodes.find((node) => node.name === 'Dotted')++ expect(ligatures?.fontFeatures).toEqual([{ tag: 'LIGA', enabled: false }])+ expect(rawTags?.fontFeatures).toEqual([+ { tag: 'DLIG', enabled: true },+ { tag: 'KERN', enabled: false }+ ])+ expect(wavy).toMatchObject({+ textDecoration: 'UNDERLINE',+ textDecorationStyle: 'WAVY',+ textDecorationThickness: 1.6+ })+ expect(wavy?.textDecorationFills[0]?.type).toBe('SOLID')+ expect(dotted).toMatchObject({+ textDecoration: 'UNDERLINE',+ textDecorationStyle: 'DOTTED',+ textDecorationThickness: 2+ })+ expect(dotted?.textDecorationFills[0]?.type).toBe('SOLID')+ })+})