Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-128

The block at the editor cursor is outlined when the setting is on

When the setting markdownOkfSchemaStudio.preview.markEditorSelection is true (off by default), the extension SHALL outline in the preview the one block that contains the cursor line of the text editor, which the host sends after each render and when the editor scrolls, without moving the preview unless it follows the editor.

Step 1 of path 2 in StRS-MDOKFSTUDIO-TOOLBAR-013: from “The setting that marks the editor selection is on” to “The block that matches the cursor line is outlined”.

Scenarios 7

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

boundaryValues of the setting
InputOutcome
no value set, page startsno block is marked
truethe mark is on
the number 1, the string true or the string yesthe mark stays off, because only the boolean true turns it on
nominalThe host sends the cursor line after a render
Giventhe setting on, a text editor that shows the document and the cursor on line 12
Whena render is shown
Thenthe page receives a sourceScroll with selectionLine 12 and no scroll line, so it does not scroll, and exactly the block that starts at line 12 is marked with data-sphinx-preview-current and aria-current location, the mark of the previous block being removed
refusalSetting off or no editor
InputOutcome
the setting off, or no visible editor for the file, a render is shownthe host posts nothing
the setting off, a sourceScroll with a selection line reaches the pageno block is marked and a previous mark is removed
nominalThe host sends the cursor line when the editor scrolls
Giventhe mark on and following off
Whenthe editor scrolls
Thenthe page receives a sourceScroll with the first visible line and the selection line, the selection line being the editor selection line plus 1
refusalA cursor move alone
Giventhe cursor moved without a scroll
Whenthe editor selection changes
Thenno message is posted, because no selection listener exists
boundaryMarking and scrolling
InputOutcome
following off, the mark on, a sourceScroll with line 50 and selection line 50the second block is marked and the scroll position stays 0
following on, a sourceScroll with a linethe page scrolls to the line and also marks the block
a sourceScroll with a line and no selection line (for example after Back)the block that contains the line is marked
a selection line inside a long block that ends before the next block startsthe long block is marked, not the next one, even when the next block starts closer to the line
a selection line on a blank line between two blocksthe block with the nearest edge is marked
nominalThe outline
InputOutcome
a marked block in a light 900 px paneoutline style solid, width 2 px, offset 2px, in the find-match colour
the setting turned off and a message arrivesthe block has no outline
forced-colors modethe outline is 2 px solid Highlight (the system highlight colour)
the normal modethe outline uses the find-match colour

Implemented in 5

Tested by 7