test(behavior): cover style-cascade bidiVisual round-trip preservation (SD-3171)#3356
Merged
Merged
Conversation
…(SD-3171) The SD-3171 fix in #3354 narrowed what visualDirection consults to inline-only, but said nothing about whether the importer/exporter still preserves a style-cascade w:bidiVisual in the exported XML. A future commit that "cleans up" the unused property could silently strip it from the style definition; renders would still pass (because we no longer read it), but round-trip integrity would be gone and a Word user opening the re-exported file would lose the property. This test pins both halves of the contract: 1. Re-importing the exported file still renders A B C (the fix holds). 2. The exported XML still contains a w:bidiVisual element somewhere in the style or document parts (the property survives export). Verified 3/3 browsers green (chromium, firefox, webkit).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9c5f0c0e9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… style Per Codex review on #3356: the loose substring check (documentXml.includes('w:bidiVisual') || stylesXml.includes(...)) passes even if export strips the style's true `w:bidiVisual` and emits an explicit-false `<w:bidiVisual w:val="0"/>` inline. Re-import would still render A B C (explicit-false produces no flip), so the test would pass while the property was silently lost from the style entry the fixture set it on. Tighten the assertion to parse the `RtlStyleTable` style block in word/styles.xml, locate `w:bidiVisual` inside its `w:tblPr`, and validate the boolean per OOXML §17.17.4 (truthy = no `w:val`, or `w:val` in {"1","true","on"}). The inline fallback is dropped because the contract is specifically about preserving the property on the style cascade.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SD-3171 (#3354) narrowed what
visualDirectionconsults to inline-only. The fix didn't say anything about whether the importer/exporter still preserves a style-cascadew:bidiVisualin the exported XML. A future commit that "cleans up" the unused property could silently strip it from the style definition; renders would still pass (because we no longer read it), but round-trip integrity would be gone and a Word user opening the re-exported file would lose the property.This test pins both halves of the contract:
w:bidiVisualin the style or document parts (the property survives export).Verified 3/3 browsers green locally (chromium, firefox, webkit).