Behaviour SwRS-MDOKFSTUDIO-BLOCK-156
A block selection moves as a whole
When a writer presses Alt+ArrowUp or Alt+ArrowDown with blocks selected and the focus on the selection, a bar of it or the page, the page SHALL post one previewBlockMove with the line span of the selection and the neighbouring block.
Another outcome at step 1 of path 2 in StRS-MDOKFSTUDIO-BLOCK-014, in the state “A body block is focused in edit mode”.
Scenarios 8
The situations the tests check; open one to read it.
nominalAlt+Up and Alt+Down move the whole selection
Giventwo selected blocks with a block below and a block above
Whenthe writer presses Alt+ArrowDown, or Alt+ArrowUp
ThenpreviewBlockMove carries the first line of the first selected block, the last line of the last one, the neighbouring block and the direction (down, or up); one message is posted with the span as the moving range
nominalThe arrows under the last selected block move the whole selection
| Input | Outcome |
|---|---|
| The writer clicks the down arrow of the bar under the second of two selected blocks | The span of both blocks is posted |
| The writer clicks the arrow of another bar | Only that bar's block moves |
| Blocks are selected | The two arrows of the bar under the last selected block are labelled "Move the selected blocks up" and "Move the selected blocks down" and carry the same text as a tooltip |
| The selection is cleared | The arrows carry "Move the block above up" and "Move the block above down" again, without titles |
nominalA block outside the selection moves alone
| Input | Outcome |
|---|---|
| Two blocks selected and a third, not selected, block focused; Alt+ArrowDown | Only the third block is moved |
| Nothing selected; Alt+ArrowDown on a focused block | That block moves as with its arrow button |
boundaryThe moved selection is selected again at its new place
| Input | Outcome |
|---|---|
| The render of a move of a two-block selection down arrives | The same blocks by position one block lower are selected and the focus goes to the free end |
| The patch has a different number of blocks | Nothing is selected instead of another block |
| A full reload replaces the page after the move, the new page renders a newer revision than the saved one, and the saved state (pendingMoveSelection) is less than five seconds old (5000 ms) | The moved blocks are selected |
| A saved selection with the same revision, or older than five seconds | Nothing is selected and the saved entry is dropped |
refusalAt the ends of the document the selection does not move
| Input | Outcome |
|---|---|
| A selection that starts at the first block; Alt+ArrowUp | Nothing is posted and the selection stays |
| An included block below the selection; Alt+ArrowDown | Nothing is posted |
refusalA repeated key moves once and a refusal keeps the selection
| Input | Outcome |
|---|---|
| A selection move is in flight and the key repeats | No second message is posted |
| The result and the render of the move arrived and the writer presses the chord again | A new selection move is requested |
| The host answers the selection move with ok false and a reason | The selection is kept and the chord can be pressed again |
| The request of a selection move was dropped and the flight is forgotten | No pending mark is left on the bar |
nominalThe host swaps a span of blocks with the neighbouring block
Givenblocks A, B and C with A and B as the moving span
Whenthe host receives the block move down and plans it
ThenC comes first, then A and B with their inner blank line unchanged; the whole span is swapped with the neighbouring block, the separators inside the span stay untouched and a span keeps CRLF line breaks inside and around it
refusalThe host refuses a span that cannot move
| Input | Outcome |
|---|---|
| A span that would move past the end of the document | The move is refused |
| A span next to the frontmatter that would cross it | The move is refused |
| A refusal answer after a key press | The reason shows next to the bar under the last selected block |