Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-259

The host ignores a malformed block-editing message and changes nothing

When the page posts a block-editing message (previewEditModeChanged, previewEditOpen, previewEditSave, previewEditCancel, previewBlockMove, previewBlocksCopy, previewBlocksCut, previewBlocksPaste, previewEditClosed or previewEditFlushed), the host SHALL accept it only with the fields its type requires and SHALL drop a malformed one and change nothing.

Part of StRS-MDOKFSTUDIO-BLOCK-025, outside the paths drawn on its map.

Scenarios 12

The situations the tests check; open one to read it.

nominalA well-formed message of each type is accepted
MessageRequired fields
previewEditModeChangeda boolean editMode
previewEditOpena non-empty string editId; positive integer line and endLine, endLine not below line; insertAfterLine absent or an integer of at least 0; no save or pin field
previewEditSavestring originalText and editedText; the editId and line range of a previewEditOpen; final a boolean when present, flush only true, insertAfterLine absent or an integer of at least 0; pinLine with pinViewportTop (finite, within 100000 in absolute value) only on a final save
previewEditCancelthe fields of a previewEditOpen
previewBlockMovefour positive integer lines, a direction up or down, an optional pinViewportTop that is finite and within 100000
previewBlocksCopypositive integer line and endLine
previewBlocksCutpositive integer line and endLine, an optional pinViewportTop
previewBlocksPastean integer insertAfterLine of at least 0, an optional positive integer pinLine, an optional pinViewportTop
previewEditCloseda non-empty editId of at most 100 characters
previewEditFlusheda non-empty flushId of at most 100 characters and a boolean flushed
Givena message of one of these types carrying exactly the fields above
Whenthe host validates it
Thenit is accepted, also without an optional pin
refusalpreviewEditModeChanged: Edit mode that is not a boolean
Givena previewEditModeChanged message with editMode "yes" or no editMode
Whenit is validated
Thenit is dropped
refusalpreviewEditOpen: An open with a wrong range, insert point or extra field
InputOutcome
line 0dropped
endLine below linedropped
insertAfterLine -1dropped
a pin field (pinLine with pinViewportTop) or the field finaldropped
a missing or empty editId, or an editId that is not a stringdropped
refusalpreviewEditSave: Invalid optional fields
InputOutcome
final "yes"dropped
flush falsedropped (flush is accepted only as true)
a pin on an autosavedropped (a pin is accepted only on a final save)
a pin top of 200000dropped (pinViewportTop is finite and within 100000 in absolute value)
originalText or editedText missing or not a stringdropped
no editId, or no line range with endLine not below line (as for previewEditOpen)dropped
boundarypreviewEditSave: Insert point of a block edit
InputOutcome
previewEditSave with insertAfterLine 0accepted (an integer of at least 0)
previewEditSave with insertAfterLine -1dropped
previewEditOpen with insertAfterLine 0accepted
previewScroll with insertAfterLine 0dropped (insertAfterLine is accepted only on previewEditOpen, previewEditSave and previewEditCancel)
refusalpreviewEditCancel: A cancel that carries a text or a pin
Givena previewEditCancel message that carries a final or pin field
Whenit is validated
Thenit is dropped
refusalpreviewBlockMove: Invalid lines, direction or pin
InputOutcome
direction leftdropped
line 0dropped
endLine 1.5dropped
a missing neighbour linedropped
a NaN pin top or a pin top of 200000dropped
refusalpreviewBlocksCopy: Invalid lines
InputOutcome
line 0dropped
endLine 1.5dropped
a missing linedropped
a string endLinedropped
refusalpreviewBlocksCut: Invalid pin or lines
InputOutcome
a NaN pin topdropped
the invalid lines of a copy (line 0, endLine 1.5, a missing line, a string endLine)dropped
refusalpreviewBlocksPaste: Invalid line or pin
InputOutcome
insertAfterLine -1dropped
insertAfterLine 1.5dropped
insertAfterLine missingdropped
pinLine 0dropped
a pin top of 200000dropped
refusalpreviewEditClosed: Invalid edit id
InputOutcome
an empty editIddropped
a missing editIddropped
a numeric editIddropped
a 101-character editIddropped (100 characters is the longest accepted)
refusalpreviewEditFlushed: Invalid flush id or flag
InputOutcome
an empty flushIddropped
a flushId of more than 100 charactersdropped
a flushed that is not a booleandropped

Implemented in 1

Tested by 2

Replaces

SwRS-MDOKFSTUDIO-BLOCK-236previewEditModeChanged carries a boolean edit mode superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-237previewEditOpen needs an edit id and a line range superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-238previewEditSave needs both texts and valid optional fields superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-239previewEditCancel needs an edit id and a line range superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-240previewBlockMove needs both ranges and a direction superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-241previewBlocksCopy needs a line range superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-242previewBlocksCut needs a line range and an optional pin superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-243previewBlocksPaste needs a line to paste after superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-244previewEditClosed carries the id of the closed editor superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file
SwRS-MDOKFSTUDIO-BLOCK-245previewEditFlushed carries the flush id and a flag superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-259 Markdown file