Markdown OKF-Schema Studio

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
InputOutcome
The writer clicks the down arrow of the bar under the second of two selected blocksThe span of both blocks is posted
The writer clicks the arrow of another barOnly that bar's block moves
Blocks are selectedThe 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 clearedThe arrows carry "Move the block above up" and "Move the block above down" again, without titles
nominalA block outside the selection moves alone
InputOutcome
Two blocks selected and a third, not selected, block focused; Alt+ArrowDownOnly the third block is moved
Nothing selected; Alt+ArrowDown on a focused blockThat block moves as with its arrow button
boundaryThe moved selection is selected again at its new place
InputOutcome
The render of a move of a two-block selection down arrivesThe same blocks by position one block lower are selected and the focus goes to the free end
The patch has a different number of blocksNothing 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 secondsNothing is selected and the saved entry is dropped
refusalAt the ends of the document the selection does not move
InputOutcome
A selection that starts at the first block; Alt+ArrowUpNothing is posted and the selection stays
An included block below the selection; Alt+ArrowDownNothing is posted
refusalA repeated key moves once and a refusal keeps the selection
InputOutcome
A selection move is in flight and the key repeatsNo second message is posted
The result and the render of the move arrived and the writer presses the chord againA new selection move is requested
The host answers the selection move with ok false and a reasonThe selection is kept and the chord can be pressed again
The request of a selection move was dropped and the flight is forgottenNo 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
InputOutcome
A span that would move past the end of the documentThe move is refused
A span next to the frontmatter that would cross itThe move is refused
A refusal answer after a key pressThe reason shows next to the bar under the last selected block

Implemented in 2

Tested by 4