- Move Kiwi serialization fix tests into one file per regression area - Share codec setup and Kiwi helpers from serialize-fixes/helpers.ts - Remove serialize fixes from max-lines exceptions
33 lines
1 KiB
TypeScript
33 lines
1 KiB
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
|
|
import { exportFigFile, parseFigFile, SceneGraph } from '@open-pencil/core'
|
|
|
|
import { pageId } from './helpers'
|
|
|
|
describe('Directionality plugin fallback', () => {
|
|
test('text and layout direction roundtrip through export/parse', async () => {
|
|
const graph = new SceneGraph()
|
|
const frame = graph.createNode('FRAME', pageId(graph), {
|
|
name: 'RTL Row',
|
|
layoutMode: 'HORIZONTAL',
|
|
layoutDirection: 'RTL',
|
|
width: 240,
|
|
height: 80
|
|
})
|
|
graph.createNode('TEXT', frame.id, {
|
|
text: 'مرحبا',
|
|
textDirection: 'RTL',
|
|
width: 120,
|
|
height: 24
|
|
})
|
|
|
|
const bytes = await exportFigFile(graph)
|
|
const parsed = await parseFigFile(bytes.buffer as ArrayBuffer)
|
|
|
|
const parsedFrame = [...parsed.getAllNodes()].find((node) => node.name === 'RTL Row')
|
|
const parsedText = [...parsed.getAllNodes()].find((node) => node.type === 'TEXT')
|
|
expect(parsedFrame?.layoutDirection).toBe('RTL')
|
|
expect(parsedText?.textDirection).toBe('RTL')
|
|
})
|
|
})
|