Files
genoffice/apps/docs/tests/doc-style-css-borders.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

29 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import type { ParsedDocFull, StyleDisplay, StyleInfo } from '@genoffice/docx-engine'
import { docStyleCss } from '../src/renderer/doc-style-css'
;(globalThis as { CSS?: unknown }).CSS ??= { escape: (s: string) => s }
function parsedWith(styleId: string, display: StyleDisplay): ParsedDocFull {
const styles = new Map<string, StyleInfo>()
styles.set(styleId, { styleId, name: styleId, type: 'paragraph', display } as StyleInfo)
return { styles, docDefaults: {}, blocks: [] } as unknown as ParsedDocFull
}
describe('docStyleCss paragraph borders', () => {
it('draws style-level w:pBdr sides with the direct-border look', () => {
const css = docStyleCss(
parsedWith('HDR', { borderSides: { b: { color: '1F4E79', szPt: 6 }, t: {} } }),
)
expect(css).toContain(
'[data-style="HDR"] { border-top:1px solid #444;border-bottom:8px solid #1F4E79;padding:1px 4px }',
)
})
it('emits nothing for a side reset to none', () => {
const css = docStyleCss(parsedWith('Off', { borderSides: { b: null } }))
expect(css).not.toContain('border-')
expect(css).not.toContain('padding:1px 4px')
})
})