Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TRUST-052

Every page message has a registered type and a valid envelope before any handler runs

When the host receives a value from the page, it SHALL hand it to a handler only if it is an object whose type is an own key of the table of registered message types and whose envelope fields (documentId, revision, requestId and the shared optional fields) are of their kind and within their bounds, ignoring any other value without a visible change.

Step 1 of path 1 in StRS-MDOKFSTUDIO-TRUST-009: from “The page sends a message to the host” to “The message is a registered one”.

Scenarios 6

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

nominalRegistered type with a valid envelope
Givena previewCopyText message with a valid envelope
Whenit is checked
Thenit is accepted as a message and the host acts on it
refusalValue that is not a registered message
Givennull, a string, an array, a message of an unregistered type, and messages whose type is __proto__, constructor or toString
Wheneach is checked
Thennone is accepted, it is ignored and nothing changes on screen
boundaryIdentity fields and size bound of the envelope
InputOutcome
previewCopyText with a documentId of 4096 charactersaccepted (longest accepted identifier)
the same message with a documentId of 4097 charactersrefused
previewScroll (a page-state message) with a documentId of 5000 charactersaccepted (a page-state message may carry a string of any length)
a message with a missing documentId or a documentId that is not a stringrefused
a valid message with revision 7 and requestId 3accepted (revision and requestId are safe integers)
the same message with revision 1.5refused
the same message with requestId the string 3refused
the same message with a revision beyond the largest safe integerrefused
boundaryShared optional fields of a page-state message
InputOutcome
previewScroll with line 2, anchorLine 3.5, scrollTop 120 and request a stringaccepted
the same message with line 0refused (line, endLine, sourceLine and selectionLine are safe integers of at least 1)
the same message with anchorLine below 1refused (anchorLine is a finite number of at least 1)
the same message with scrollTop negativerefused (scrollTop is a finite number of at least 0)
the same message with editMode the string yesrefused (editMode and anchorToEditor are booleans)
a previewThemeMode that is not a known moderefused (the theme mode is a known one)
a request that is not a stringrefused (request is a string)
boundaryFields accepted only on the type that owns them
InputOutcome
previewFrontmatterSave with pinLine 3 and pinViewportTop 120accepted
previewEditSave with final true and both pin fieldsaccepted (a pin is owned by previewFrontmatterSave and by a final previewEditSave)
previewEditCancel with a pinrefused
previewFrontmatterSave with pinViewportTop 100001refused (pinViewportTop is a finite number of at most 100000 in absolute value)
a pin with only one of pinLine and pinViewportToprefused (the pair is complete or absent; pinLine is a source line)
previewReady with blockEditOpen trueaccepted (blockEditOpen is a boolean only on previewReady)
previewEditSave with final falseaccepted (final is a boolean only on previewEditSave)
previewScroll with blockEditOpen truerefused
previewEditCancel with flush truerefused (flush is true only on previewEditSave or previewFrontmatterSave)
boundaryBlock edit and checkbox request names its editor and its lines
InputOutcome
previewEditOpen with editId e1, line 3 and endLine 5accepted
the same message with endLine 2refused (endLine is not before line)
the same message without editIdrefused (editId is non-empty)
previewEditSave, previewEditCancel or previewCheckboxToggle with the same shapethe same outcome (see SwRS-MDOKFSTUDIO-GFM-021 for the extra checkbox fields)

Implemented in 2

Tested by 2

Replaces

SwRS-MDOKFSTUDIO-CORE-066Ignore invalid page messages superseded superseded by SwRS-MDOKFSTUDIO-TRUST-052 Markdown file