Files
genoffice/apps/docs/tests/wordwrap-keepall.test.ts
T
merrick-2002andGenOffice 69b4ce0560 Sync snapshot (2026-09-06) (#243)
- Docs: Word-style dark page, phased fast open for long documents, fonts embedded in the DOCX, spellcheck toggle, hyperlink editing, and ~80 Word fidelity fixes (CJK/JP metrics, header/footer, tables, anchored pictures)
- Sheets: hold formula recalculation while file data streams in, large-workbook scroll/load performance, combo charts, duplicate/unique conditional formatting by display text, RTL frozen-pane fix, workbooks whose ZIP entries carry a leading slash
- Slides: MTX-compressed embedded font support, CJK/Latin face selection and PowerPoint script fallbacks, theme colors kept on paragraph defaults and bullets, more reliable AI edits with a layout audit after each batch
- PDF: AI page ops, text block move/align, notes and markup editing, watermark and header/footer, form check boxes, metadata; the cloud Export as Word fallback is removed, conversion is always on-device
- AI: Gemini tool schema translation, OpenCode Zen/Go providers, markdown tables and code blocks in chat, current date in the system prompt
- Shell: Office-style ribbon collapse across all editors, native Windows ARM64 installer, BUILD_DIR override for packaging

Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
2026-09-07 00:18:14 +08:00

44 lines
1.5 KiB
TypeScript

/**
* Word keeps hangul words whole (the renderer's word-break:keep-all) unless the
* paragraph turns w:wordWrap off, when lines may break between syllables
* (Word probe 2026-09-03: "방위|군의"; Latin words still stay whole, which is
* Chromium's word-break:normal).
*/
import { describe, expect, it } from 'vitest'
import { DOMSerializer } from '@tiptap/pm/model'
import type { TableModel } from '@genoffice/docx-engine'
import { renderTableSpec } from '../src/renderer/editor/protected-render'
const render = (spec: unknown): HTMLElement =>
DOMSerializer.renderSpec(document, spec as never).dom as HTMLElement
function cellStyle(wordWrap: boolean | undefined): string {
const model: TableModel = {
rows: [
[
{
paras: ['가맹점 PG사'],
richParas: [
{ runs: [{ text: '가맹점 PG사' }], ...(wordWrap === undefined ? {} : { wordWrap }) },
],
},
],
],
}
return render(renderTableSpec(model)).querySelector('td div')!.getAttribute('style') ?? ''
}
describe('hangul word breaking follows w:wordWrap', () => {
it('keeps words whole by default', () => {
expect(cellStyle(undefined)).toMatch(/word-break:\s*keep-all/)
})
it('drops keep-all when the paragraph allows character-level breaking', () => {
expect(cellStyle(false)).not.toContain('keep-all')
})
it('an explicit on keeps words whole', () => {
expect(cellStyle(true)).toMatch(/word-break:\s*keep-all/)
})
})