DOCX Primitives
5 requirements
·
17 scenarios
XML Round-Trip Fidelity
JR-docx-primitives-005
The XML engine SHALL parse and serialize OOXML without data loss, preserving elements, attributes, namespaces, and text content through round-trips.
4 test scenarios
- parse and serialize preserves element structure JR-docx-primitives-005.1
- namespaced XML preserved through round-trip JR-docx-primitives-005.2
- textContent returns concatenated text of nested elements JR-docx-primitives-005.3
- textContent returns empty string for null or undefined input JR-docx-primitives-005.4
Paragraph Bookmark Identity
JR-docx-primitives-006
The bookmark engine SHALL mint and persist stable
jr_para_* identifiers for paragraphs, ensuring unique addressability and idempotent allocation.
2 test scenarios
- insertParagraphBookmarks mints IDs matching expected pattern JR-docx-primitives-006.1
- getParagraphBookmarkId retrieves minted ID JR-docx-primitives-006.2
Comparator Round-Trip Semantic Invariants
JR-docx-primitives-007
The comparator SHALL enforce semantic round-trip invariants using the package read-text surface and structural diagnostics.
2 test scenarios
- Accept-all and reject-all preserve semantic read-text parity JR-docx-primitives-007.1
- Structural diagnostics remain equivalent across round-trip projections JR-docx-primitives-007.2
Tracked Change Acceptance Engine
JR-docx-primitives-010
The docx-primitives library SHALL programmatically accept all tracked changes in OOXML document body content, resolving each revision type into its accepted state.
6 test scenarios
- accept insertions by unwrapping w:ins wrappers JR-docx-primitives-010.1
- accept deletions by removing w:del elements and content JR-docx-primitives-010.2
- accept property changes by removing change records JR-docx-primitives-010.3
- accept moves by keeping destination and removing source JR-docx-primitives-010.4
- bottom-up processing resolves nested revisions JR-docx-primitives-010.5
- orphaned moves handled with safe fallback JR-docx-primitives-010.6
Redline Simplification with Author Constraint
JR-docx-primitives-012
The docx-primitives library SHALL consolidate adjacent tracked-change wrappers of the same type and author to reduce XML verbosity, without altering document semantics.
3 test scenarios
- merge adjacent same-author same-type tracked-change wrappers JR-docx-primitives-012.1
- never merge wrappers from different authors JR-docx-primitives-012.2
- never merge across different change types JR-docx-primitives-012.3