Files
genoffice/apps/docs/tests/para-border-reset.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

41 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { Editor } from '@tiptap/core'
import { editorExtensions } from '../src/renderer/editor/extensions'
function paraStyle(attrs: Record<string, unknown>): CSSStyleDeclaration {
const editor = new Editor({
element: document.createElement('div'),
extensions: editorExtensions,
content: {
type: 'doc',
content: [
{
type: 'docParagraph',
attrs: { docxIndex: null, ...attrs },
content: [{ type: 'text', text: 'x' }],
},
],
},
})
const style = editor.view.dom.querySelector('p')!.style
editor.destroy()
return style
}
describe('direct w:pBdr none over a style border', () => {
it('emits an inline border-none for the reset sides only', () => {
const style = paraStyle({ styleId: 'HDR', borderReset: 'b' })
expect(style.borderBottomStyle).toBe('none')
expect(style.borderTopStyle).toBe('')
expect(style.padding).toBe('')
})
it('keeps drawn sides next to reset ones', () => {
const style = paraStyle({ borders: 't', borderReset: 'b' })
expect(style.borderTopStyle).toBe('solid')
expect(style.borderTopWidth).toBe('1px')
expect(style.borderBottomStyle).toBe('none')
expect(style.padding).toBe('1px 4px')
})
})