Markdown OKF-Schema Studio

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
InputOutcome
an untouched form, Apply pressedthe 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 pressedthe directive is written
boundaryUntouched parts are written back byte for byte
InputOutcome
a figure with unknown options and unusual spacing, only the width changedonly the width line is rewritten and the unknown options stay in their order
a figure written with a backtick or tilde fencethe fence style and the indentation are kept
a caption and a legend that were not editedthe original body is kept
an edited caption or legendthe edited text replaces the original body
an unmodified modelserialising it gives the original text
an option whose value did not changeits original line is kept
an unknown option with an empty valuenever dropped
boundaryOptions written
InputOutcome
the Width field emptiedthe 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 typedthe option line is added after the unknown ones and a blank line stays before the caption
options that are newappended after the unknown options
boundaryCaption, legend and outer fence
InputOutcome
a caption and a legend that were editedthe body is the caption, a blank line and the legend (two paragraphs)
a legend that holds a fence of three colonsthe 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 fencethe outer fence is unchanged
any outer fencethe fence character of the directive is kept

Implemented in 2

Tested by 2