Behaviour SwRS-MDOKFSTUDIO-GFM-021
Clicking a checkbox toggles one source character
When a writer clicks a checkbox in reading or edit mode, the extension SHALL edit only the character between its brackets, without opening a block editor, and revert the checkbox and show the reason next to it for a few seconds (and as its tooltip) when the host refuses the toggle; the host SHALL accept a previewCheckboxToggle message only with a safe non-negative integer column, a boolean checked state and a single line.
Step 2 of path 1 in StRS-MDOKFSTUDIO-GFM-003: from “The task shows a checkbox” to “The source holds [x] for the task”.
Scenarios 8
The situations the tests check; open one to read it.
nominalToggle in reading mode
nominalToggle in a table cell in edit mode
boundaryUppercase marker rewritten
refusalClicks that send no message
| Input | Outcome |
|---|---|
| a click while a toggle awaits the host result | only one toggle message was sent and the checkbox is aria-busy until the result arrives |
| a checkbox without valid line or column attributes | the click is prevented and no message is sent |
refusalThe host refuses the toggle
For the open editor and the stale render, see SwRS-MDOKFSTUDIO-BLOCK-041, SwRS-MDOKFSTUDIO-TRUST-065 and SwRS-MDOKFSTUDIO-TRUST-005. The reasons of the toggle are:
| Input | Outcome |
|---|---|
| a toggle refused as out of date | the checkbox returns to its previous state, and the tooltip and a short status note next to the box read 'The preview is out of date. Try again once it has refreshed.' |
| a toggle for a marker removed from the source | refused with 'The checkbox is no longer in the source. Refresh the preview.' |
| a toggle while a Markdown edit is open | refused with 'Save or cancel the open Markdown edit before toggling a checkbox.' |
| VS Code fails to apply the edit | refused with 'VS Code could not apply the checkbox edit.' or the edit error |
| a file VS Code keeps read-only (files.readonlyInclude, or read-only in the session): the apply resolves and changes nothing | refused with 'This file is read-only in VS Code.' |
| a toggle message the validator rejects (scenario 'Invalid toggle messages') | refused with 'The checkbox request was not understood. Refresh the preview.' |
The reason appears in a status note right after the box and disappears after about six seconds; a second refusal of the same box replaces the note.
boundaryContent patches clear pending toggles
| Input | Outcome |
|---|---|
| a pending toggle of old content, then an in-place patch and the old result | the new content checkbox is unchanged |
| no pending toggle, then a patch | patching succeeds without effect on checkboxes |
refusalInvalid toggle messages
A previewCheckboxToggle message with line 3, endLine 3, column 4, checked true is accepted. Column, checked and radioGroup are accepted on no other message type: a previewEditCancel message with column 4, or a previewScroll message with a radioGroup, is refused.
| Input | Outcome |
|---|---|
| a negative column | rejected, no edit is made |
| a fractional column | rejected, no edit is made |
| a checked state that is not a boolean | rejected, no edit is made |
| line different from endLine | rejected, no edit is made |
| a radioGroup (the options of a radio choice) that is not an array of 2 to 256 distinct line and column positions including the message's own, or that comes with checked false | rejected, no edit is made |
refusalA rejected message is answered
| Input | Outcome |
|---|---|
| a rejected toggle that names the shown document, a render and an edit id | the page is answered with the error 'The checkbox request was not understood. Refresh the preview.' and no edit is made, so the box does not stay busy |
| a rejected toggle without an edit id, or for another document | dropped without an answer |
Implemented in 6
Tested by 8
- test/core/edits/sourceEdits.test.tsunit
- test/core/protocol/pageStateMessages.test.tsunit
- test/host-vscode/documents.test.tsunit
- test/page/runtimeContentPatch.test.tsunit
- test/page/runtimePageControls.test.tsunit
- test/session/checkboxRefusal.test.tsunit
- test/session/radioChoice.test.tsunit
- test/visual/scenarioDefinitions2.tsvisual