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
| Message | Required fields |
|---|---|
| previewEditModeChanged | a boolean editMode |
| previewEditOpen | a 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 |
| previewEditSave | string 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 |
| previewEditCancel | the fields of a previewEditOpen |
| previewBlockMove | four positive integer lines, a direction up or down, an optional pinViewportTop that is finite and within 100000 |
| previewBlocksCopy | positive integer line and endLine |
| previewBlocksCut | positive integer line and endLine, an optional pinViewportTop |
| previewBlocksPaste | an integer insertAfterLine of at least 0, an optional positive integer pinLine, an optional pinViewportTop |
| previewEditClosed | a non-empty editId of at most 100 characters |
| previewEditFlushed | a 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
| Input | Outcome |
|---|---|
| line 0 | dropped |
| endLine below line | dropped |
| insertAfterLine -1 | dropped |
| a pin field (pinLine with pinViewportTop) or the field final | dropped |
| a missing or empty editId, or an editId that is not a string | dropped |
refusalpreviewEditSave: Invalid optional fields
| Input | Outcome |
|---|---|
| final "yes" | dropped |
| flush false | dropped (flush is accepted only as true) |
| a pin on an autosave | dropped (a pin is accepted only on a final save) |
| a pin top of 200000 | dropped (pinViewportTop is finite and within 100000 in absolute value) |
| originalText or editedText missing or not a string | dropped |
| no editId, or no line range with endLine not below line (as for previewEditOpen) | dropped |
boundarypreviewEditSave: Insert point of a block edit
| Input | Outcome |
|---|---|
| previewEditSave with insertAfterLine 0 | accepted (an integer of at least 0) |
| previewEditSave with insertAfterLine -1 | dropped |
| previewEditOpen with insertAfterLine 0 | accepted |
| previewScroll with insertAfterLine 0 | dropped (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
| Input | Outcome |
|---|---|
| direction left | dropped |
| line 0 | dropped |
| endLine 1.5 | dropped |
| a missing neighbour line | dropped |
| a NaN pin top or a pin top of 200000 | dropped |
refusalpreviewBlocksCopy: Invalid lines
| Input | Outcome |
|---|---|
| line 0 | dropped |
| endLine 1.5 | dropped |
| a missing line | dropped |
| a string endLine | dropped |
refusalpreviewBlocksCut: Invalid pin or lines
| Input | Outcome |
|---|---|
| a NaN pin top | dropped |
| the invalid lines of a copy (line 0, endLine 1.5, a missing line, a string endLine) | dropped |
refusalpreviewBlocksPaste: Invalid line or pin
| Input | Outcome |
|---|---|
| insertAfterLine -1 | dropped |
| insertAfterLine 1.5 | dropped |
| insertAfterLine missing | dropped |
| pinLine 0 | dropped |
| a pin top of 200000 | dropped |
refusalpreviewEditClosed: Invalid edit id
| Input | Outcome |
|---|---|
| an empty editId | dropped |
| a missing editId | dropped |
| a numeric editId | dropped |
| a 101-character editId | dropped (100 characters is the longest accepted) |
refusalpreviewEditFlushed: Invalid flush id or flag
| Input | Outcome |
|---|---|
| an empty flushId | dropped |
| a flushId of more than 100 characters | dropped |
| a flushed that is not a boolean | dropped |
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