- Docs: print dialog with live page preview and range selection; WYSIWYG print preview across apps - Docs: header/footer fidelity - alignment, color, size, images, and tab layout (w:tabs, w:ptab) - Docs: pagination and layout fixes - keepNext crash, blank pages, footnotes, line-height, font substitution, Tamil support - Sheets: import implicit cell addresses and row/column default styles; keep dialog inputs inside narrow grid columns - Slides: PowerPoint-style stage rulers, wheel page turning, and notes bar - Slides: insert 3-D pie and 3-D column charts; render 3-D chart variants as 2-D projections - PDF: comments margin with pin leader lines, note threads with replies, and selection-level text styles - PDF: searchable text insertion, page management, and auto-opening of extract/split output Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
26 lines
901 B
TypeScript
26 lines
901 B
TypeScript
import { describe, expect, it } from 'vitest'
|
||
import { parsePrintRange } from '../src/renderer/print-range'
|
||
|
||
describe('parsePrintRange', () => {
|
||
it('parses single pages and ranges into 0-based indices', () => {
|
||
expect(parsePrintRange('1,3,5-8', 10)).toEqual([0, 2, 4, 5, 6, 7])
|
||
})
|
||
|
||
it('dedupes overlaps and sorts', () => {
|
||
expect(parsePrintRange('5-6, 2, 5', 10)).toEqual([1, 4, 5])
|
||
})
|
||
|
||
it('accepts CJK separators and en-dash', () => {
|
||
expect(parsePrintRange('1,3、5–6', 6)).toEqual([0, 2, 4, 5])
|
||
})
|
||
|
||
it('rejects empty, malformed, reversed, and out-of-bounds input', () => {
|
||
expect(parsePrintRange('', 5)).toBeNull()
|
||
expect(parsePrintRange('a-b', 5)).toBeNull()
|
||
expect(parsePrintRange('4-2', 5)).toBeNull()
|
||
expect(parsePrintRange('0', 5)).toBeNull()
|
||
expect(parsePrintRange('6', 5)).toBeNull()
|
||
expect(parsePrintRange('1-9', 5)).toBeNull()
|
||
})
|
||
})
|