- 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>
52 lines
2.0 KiB
TypeScript
52 lines
2.0 KiB
TypeScript
/**
|
|
* Floating shape stacking: the relativeHeight rank orders overlapping floats
|
|
* within the same z bands the image renderer uses (behind < -1 < text < 1 <=
|
|
* front), so a full-page background shape stays under later-ranked text boxes.
|
|
*/
|
|
import { describe, expect, it } from 'vitest'
|
|
import type { TextboxDisplay } from '@genoffice/docx-engine'
|
|
import { textboxBoxStyle } from '../src/renderer/editor/protected-render'
|
|
|
|
const box = (extra: Partial<TextboxDisplay>): TextboxDisplay => ({
|
|
paras: [],
|
|
fill: '00FF00',
|
|
floating: true,
|
|
...extra,
|
|
})
|
|
|
|
describe('textboxBoxStyle border', () => {
|
|
it('a stroked box always sets its border width (the CSS default reserves no edge)', () => {
|
|
expect(textboxBoxStyle(box({ borderColor: '000000' }))).toContain('border-width:1px')
|
|
expect(textboxBoxStyle(box({ borderColor: '000000', borderWidthPx: 2 }))).toContain(
|
|
'border-width:2px',
|
|
)
|
|
})
|
|
|
|
it('an unstroked fixed-size box keeps its full text rectangle', () => {
|
|
expect(textboxBoxStyle(box({ widthPx: 62, heightPx: 16 }))).not.toContain('border-width')
|
|
})
|
|
})
|
|
|
|
describe('textboxBoxStyle z bands', () => {
|
|
it('front floats rank above the text layer', () => {
|
|
expect(textboxBoxStyle(box({ z: 3 }))).toContain('z-index:5')
|
|
// rank floor: the front band never reaches the text layer at 0
|
|
expect(textboxBoxStyle(box({ z: -10 }))).toContain('z-index:1')
|
|
})
|
|
|
|
it('unranked floats keep DOM stacking (no z-index)', () => {
|
|
expect(textboxBoxStyle(box({}))).not.toContain('z-index')
|
|
})
|
|
|
|
it('behind floats stay in the negative band, ordered by rank', () => {
|
|
expect(textboxBoxStyle(box({ behind: true }))).toContain('z-index:-1000')
|
|
expect(textboxBoxStyle(box({ behind: true, z: 4 }))).toContain('z-index:-996')
|
|
// band ceiling: a huge rank must not lift a behind box above the text
|
|
expect(textboxBoxStyle(box({ behind: true, z: 5000 }))).toContain('z-index:-1')
|
|
})
|
|
|
|
it('non-floating boxes never get a z-index', () => {
|
|
expect(textboxBoxStyle(box({ floating: false, z: 3 }))).not.toContain('z-index')
|
|
})
|
|
})
|