Behaviour SwRS-MDOKFSTUDIO-PALETTE-153
The figure form edits the options of a figure and checks them
When the writer opens the figure form, from the Edit figure button over a hovered figure in edit mode or from Figure with the caret in a figure, the extension SHALL show a dialog with the fields Source, Alt text, Caption, Legend, Width, Align and Name, check them when the form is applied, and show each problem under its field while the form stays open and unchanged.
Part of StRS-MDOKFSTUDIO-PALETTE-007, outside the paths drawn on its map.
Scenarios 10
The situations the tests check; open one to read it.
nominalEdit figure button
boundaryEdit figure button hidden
| Input | Outcome |
|---|---|
| edit mode off | the button is hidden |
| a scroll | the button is hidden |
| the pointer over another element | the button is hidden |
| a press on the button | the focus never moves |
The button is a child of the body placed with the CSSOM, so a content patch never removes it.
boundaryEdit figure button next to the preview controls
A figure with room below the controls keeps the button at its top right, below them.
nominalFields of the form
nominalForm after inserting a figure
nominalLone Markdown image
boundaryDirective found for the form
| Input | Outcome |
|---|---|
| a figure that holds another figure and the caret in the inner one | the inner directive is edited (the innermost figure that holds the caret) |
| the editor opened by Edit figure | the first figure of the text is edited |
| the caret in  alone in its paragraph | the form converts that image |
| an image with other text in its paragraph | not a lone image, no figure |
boundaryKeys that apply the form
| Input | Outcome |
|---|---|
| Enter in a one-line field (for example Width) | the form is applied |
| Cmd+Enter or Ctrl+Enter anywhere in the form | the form is applied |
| Enter in Caption or Legend | a line break is typed and the form is not applied |
| Enter on a button | keeps its own effect |
| Enter during an IME composition | ignored |
refusalProblems under the fields
| Input | Outcome |
|---|---|
| Width wide, applied | the message Use a number with px, %, em or rem, for example 60% or 300px. appears under Width (role alert), the field is aria-invalid and has the focus, the form stays open and the text is unchanged |
| widths 50, 50%, 12.5px, 3em, 2rem or an empty width | accepted, no problem reported (a non-negative number with an optional decimal part and the unit px, %, em, rem or none) |
| widths 50 %, -1px, 50pt, wide, 1.px | each refused with the width message |
| an empty Source | Choose or type the image path. under Source |
| a Source that is not on one line | The path is one line. |
| an Alt text that is not on one line | The alt text is one line. |
| a Name that is not on one line | The name is one line. |
| an Align that is not empty, left, center or right | Use left, center or right. |
| a Caption of more than one paragraph | The caption is one paragraph; put the others in the legend. |
| an empty Caption and a Legend | A legend needs a caption. under Legend |
| valid values | no message is shown and the directive is rewritten (see SwRS-MDOKFSTUDIO-PALETTE-160) |
When several fields are invalid the first invalid field gets the focus.
refusalFigure that cannot be edited and stale submit
| Input | Outcome |
|---|---|
| the form asked for a figure whose first body line is --- (YAML option block) | the status line reads This figure uses a YAML option block: edit it in the text box. and the text is unchanged |
| the form asked with the caret in a plain paragraph | the status line reads No figure at the caret. |
| Apply pressed after the text of the text box changed from the text at the opening of the form (for example by a script) | the form closes and nothing is written |
| Apply pressed on the same text | the directive is written |
The range recorded at opening is never applied to a different text.
Implemented in 3
Tested by 8
- test/integration/realInput/editorWidgets.tsintegration
- test/integration/realWindowGaps.tsintegration
- test/page/figureEditButtonClearance.test.tsunit
- test/page/modules/figureDirective.test.tsunit
- test/page/paletteReq.requirements.test.tsunit
- test/page/runtimePaletteActions.test.tsunit
- test/visual/capture_figure_button.pyvisual
- test/visual/scenarioDefinitions1.tsvisual