Behaviour SwRS-MDOKFSTUDIO-REVIEW-006
The host posts the baseline rendering while the side-by-side diff is on and takes only a well-formed switch message
While the side-by-side diff is on for a tracked file in a trusted workspace and markdownOkfSchemaStudio.preview.showIncomingChanges is not false, the host SHALL post to the page the text at the last commit rendered like the page content with its blocks numbered by the lines of that text, together with the line hunks between that text and the shown text, again when the shown text or the commit changes, and SHALL post an empty baseline when the file is not known to Git or the text at the last commit cannot be rendered; the switch message previewSideBySideChanged is accepted only with a boolean on field for the current render, and any other is dropped.
Step 2 of path 1 in StRS-MDOKFSTUDIO-REVIEW-018: from “The host is told the diff is on” to “The page holds the baseline”.
Scenarios 4
The situations the tests check; open one to read it.
nominalThe baseline follows the shown text
| Input | Outcome |
|---|---|
| The side-by-side diff on, a tracked file in a trusted workspace | the host posts previewBaselineDiff with the HEAD text rendered like the page content and the hunks between it and the shown text |
| The shown text changes | a new message with new hunks; the same HEAD text is not rendered again |
| The HEAD commit changes | a new message with the new rendering |
| The Diff button off | the baseline is still posted |
| The diff switched off | nothing more is read, rendered or posted |
boundaryNo baseline
| Input | Outcome |
|---|---|
| A file Git does not know | an empty baseline (no html, no hunk) |
| A HEAD text that cannot be rendered, or whose content would carry a script or a nonce | an empty baseline, so the page keeps the green bars |
| markdownOkfSchemaStudio.preview.showIncomingChanges off, or an untrusted workspace | nothing is read or posted |
| Raw scripts in the HEAD text | never part of the posted html |
nominalA well-formed switch message
| Input | Outcome |
|---|---|
| previewSideBySideChanged with on true or false for the current render | accepted |
refusalDropped switch messages
| Input | Outcome |
|---|---|
| previewSideBySideChanged with a non-boolean or no on | dropped |
| A switch message of a stale render | dropped |