2026-05-26 11:24:13 +00:00
|
|
|
import { describe, expect, test } from 'bun:test'
|
|
|
|
|
|
2026-07-24 12:29:43 +00:00
|
|
|
import { createStandaloneShapes } from '@/app/demo/sections/standalone'
|
2026-05-26 11:24:13 +00:00
|
|
|
import { createEditorStore } from '@/app/editor/session'
|
|
|
|
|
|
|
|
|
|
describe('demo document', () => {
|
2026-07-24 12:29:43 +00:00
|
|
|
test('showcases imported OpenType and text decoration features', () => {
|
2026-05-26 11:24:13 +00:00
|
|
|
const store = createEditorStore()
|
|
|
|
|
|
2026-07-24 12:29:43 +00:00
|
|
|
createStandaloneShapes(store)
|
2026-05-26 11:24:13 +00:00
|
|
|
|
|
|
|
|
const nodes = [...store.graph.getAllNodes()]
|
2026-07-24 12:29:43 +00:00
|
|
|
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')
|
2026-05-26 11:24:13 +00:00
|
|
|
})
|
|
|
|
|
})
|