Files
genoffice/apps/docs/tests/dom-range.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

28 lines
764 B
TypeScript

import { describe, expect, it } from 'vitest'
import { rangeSlot } from '../src/renderer/dom-range'
describe('rangeSlot', () => {
it('hands out one Range per slot and keeps slots independent', () => {
const a = rangeSlot()
const b = rangeSlot()
const r1 = a()
expect(a()).toBe(r1)
expect(b()).not.toBe(r1)
expect(b()).toBe(b())
})
it('creates the Range lazily and reuses it after repositioning', () => {
const slot = rangeSlot()
const t = document.createTextNode('hello world')
document.body.appendChild(t)
const r = slot()
r.setStart(t, 0)
r.setEnd(t, 5)
expect(r.toString()).toBe('hello')
slot().setStart(t, 6)
slot().setEnd(t, 11)
expect(r.toString()).toBe('world')
t.remove()
})
})