Behaviour SwRS-MDOKFSTUDIO-PALETTE-160
Apply rewrites the figure directive in one minimal edit
When the writer applies the figure form with a change, the extension SHALL replace the directive with the rewritten one in one edit that keeps every untouched part byte for byte, and keep the editor open.
Part of StRS-MDOKFSTUDIO-PALETTE-007, outside the paths drawn on its map.
Scenarios 6
The situations the tests check; open one to read it.
nominalChange
Givena figure whose width is changed
WhenApply is pressed
Thenthe directive is replaced in one edit and the editor stays open; the edit range is the whole directive found when the form opened
nominalConversion
Givena Markdown image converted to a figure
WhenConvert to figure is pressed
Thenthe image reference is replaced by the figure directive
boundaryNo change
| Input | Outcome |
|---|---|
| an untouched form, Apply pressed | the text is not written (no edit event, the document version does not move) and the focus returns to the text box with its selection |
| a changed width, Apply pressed | the directive is written |
boundaryUntouched parts are written back byte for byte
| Input | Outcome |
|---|---|
| a figure with unknown options and unusual spacing, only the width changed | only the width line is rewritten and the unknown options stay in their order |
| a figure written with a backtick or tilde fence | the fence style and the indentation are kept |
| a caption and a legend that were not edited | the original body is kept |
| an edited caption or legend | the edited text replaces the original body |
| an unmodified model | serialising it gives the original text |
| an option whose value did not change | its original line is kept |
| an unknown option with an empty value | never dropped |
boundaryOptions written
| Input | Outcome |
|---|---|
| the Width field emptied | the width line is gone (the options alt, width, align and name are dropped when empty) |
| a figure with no option and a caption, a width typed | the option line is added after the unknown ones and a blank line stays before the caption |
| options that are new | appended after the unknown options |
boundaryCaption, legend and outer fence
| Input | Outcome |
|---|---|
| a caption and a legend that were edited | the body is the caption, a blank line and the legend (two paragraphs) |
| a legend that holds a fence of three colons | the outer fence has four colons (one character more than a fence in the caption or legend that is as long as the outer fence) |
| a legend with a shorter fence | the outer fence is unchanged |
| any outer fence | the fence character of the directive is kept |