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
| Input | Outcome |
|---|---|
| no value set, page starts | no block is marked |
| true | the mark is on |
| the number 1, the string true or the string yes | the 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
| Input | Outcome |
|---|---|
| the setting off, or no visible editor for the file, a render is shown | the host posts nothing |
| the setting off, a sourceScroll with a selection line reaches the page | no 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
| Input | Outcome |
|---|---|
| following off, the mark on, a sourceScroll with line 50 and selection line 50 | the second block is marked and the scroll position stays 0 |
| following on, a sourceScroll with a line | the 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 starts | the 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 blocks | the block with the nearest edge is marked |
nominalThe outline
| Input | Outcome |
|---|---|
| a marked block in a light 900 px pane | outline style solid, width 2 px, offset 2px, in the find-match colour |
| the setting turned off and a message arrives | the block has no outline |
| forced-colors mode | the outline is 2 px solid Highlight (the system highlight colour) |
| the normal mode | the outline uses the find-match colour |
Implemented in 5
Tested by 7
- test/core/configuration/settingsRegistry.test.tsunit
- test/core/preview/toolbarReq.requirements.test.tsunit
- test/page/pageSettings.test.tsunit
- test/page/runtimeScroll.test.tsunit
- test/session/toolbarReq.requirements.test.tsunit
- test/visual/scenarioDefinitions1.tsvisual
- test/visual/scenarioDefinitions2.tsvisual