Behaviour SwRS-MDOKFSTUDIO-REVIEW-160
The TODO action wraps or unwraps the touched lines in TODO comments
When a writer runs the TODO action in a block editor on lines that are not wrapped, the page SHALL wrap each non-blank line touched by the caret or the selection in a TODO comment, after its indentation, and unwrap them when every non-blank touched line is already wrapped.
Step 1 of path 2 in StRS-MDOKFSTUDIO-REVIEW-012: from “A block editor is open on a line” to “The touched lines are wrapped in a TODO comment, or unwrapped”.
Scenarios 8
The situations the tests check; open one to read it.
nominalCaret in a line
Giventhe text "abc" with the caret inside
Whenthe TODO action runs
Thenthe line reads "`<!-- TODO: abc -->`" and the caret stays on the same letter
nominalSelection of two lines
Giventhe lines "a" and "b" selected, partly or fully
Whenthe TODO action runs
Thenboth lines are wrapped, each after its own indentation, and the whole block stays selected
nominalUnwrap when every touched line is wrapped
Giventhe lines "`<!-- TODO: a -->`" and "`<!-- TODO: b -->`" selected
Whenthe TODO action runs
Thenthe lines read a and b; and the lines "- one" and "- two" wrapped by the action come back as the original lines when the action runs again (wrap then unwrap restores the text)
boundaryMixed selection and selection ending at a line start
| Input | Outcome |
|---|---|
| The lines "a" and "`<!-- TODO: b -->`" selected | Both lines are wrapped once |
| A selection that ends at the start of a line | That last line is left alone |
boundaryBlank line
| Input | Outcome |
|---|---|
| An empty line with the caret | The line reads "`<!-- TODO: -->`" with the caret between the spaces |
| A line of two spaces with the caret | The comment keeps the two spaces of indentation |
| An empty TODO comment with the caret inside it | The comment is removed, the line is empty with the caret |
refusalA line holding a comment end is never wrapped
| Input | Outcome |
|---|---|
| The line "a --> b" with the caret | No edit is made |
| The lines "a" and "b --> c" selected | Only the first line is wrapped |
boundaryThe TODO action has no shortcut
| Input | Outcome |
|---|---|
| Ctrl+/ or Cmd+/ in the text box of a block editor | The TODO action does not run: the shortcut toggles a plain comment, see SwRS-MDOKFSTUDIO-PALETTE-266 |
| The tooltip of the TODO button | Toggle TODO comment, with no shortcut in parentheses |
nominalThe slash menu finds the action by three names
| Typed after the slash in a block editor | Outcome |
|---|---|
| /todo | The slash menu lists the TODO action, titled Toggle TODO comment |
| /fixme or /task | The slash menu lists the same TODO action |