Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-THEME-016

Current mode follows the VS Code theme and redraws on change

When the Current theme mode is shown or the active VS Code colour theme changes, the extension SHALL keep the preview in the colours of the VS Code theme: it colours the page, the toolbar and its pressed button with the VS Code theme variables for every host theme kind, high contrast included, tells every open preview that has a render the new theme kind, and draws a Markdown document again once no block editor is open.

Another outcome at step 2 of path 1 in StRS-MDOKFSTUDIO-THEME-002, in the state “A theme mode is active”.

Part of StRS-MDOKFSTUDIO-THEME-004, outside the paths drawn on its map.

Scenarios 9

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

nominalCurrent mode on a dark and a light VS Code theme
Giventhe preview in Current mode on a dark VS Code theme (real-input capture theme-zoom/r02) and on a light VS Code theme (capture theme-zoom/r06)
Whenthe page is rendered
Thenthe body background equals --vscode-editor-background, the toolbar background equals --vscode-editorWidget-background, the toolbar text equals --vscode-icon-foreground and the pressed button background equals --vscode-button-background, with the values of the variables of each host theme
boundaryHigh-contrast host
Giventhe Current mode on a high-contrast VS Code theme (theme kind 3 or 4)
Whenthe page is rendered
Thenthe same four colours come from the high-contrast theme's variables; no rule of the page palette overrides them
nominalThe page root records the theme kind
Givena page and a themeChanged message with a theme kind, or a boot context without one
Whenthe page starts or handles the message
Thenthe attribute data-sphinx-preview-theme of the html element reads the kind number, or default when there is none, as in the table
Inputdata-sphinx-preview-theme
themeChanged with theme kind 2 (dark)2
themeChanged with theme kind 1 (light)1
themeChanged with theme kind 3 (high contrast), then 4 (high contrast light)3, then 4
Boot context without a theme kinddefault
nominalThe host tells every open preview
Giventwo open previews with a render and a switch of the VS Code theme from dark to light
WhenVS Code reports the change
Theneach preview receives one themeChanged message with the new kind and the identity of its render (the page accepts it under SwRS-MDOKFSTUDIO-TRUST-059)
boundaryPreview without a render
Givenan open preview that has not rendered yet
WhenVS Code reports the change
Thenno themeChanged message is posted to it
nominalA Markdown document is drawn again
Givenan open preview of a .md file and a switch of the VS Code theme
WhenVS Code reports the change
Thenone bounded render follows, with a request number higher than the previous one, and no second render follows after 300 ms
boundaryRedraw by document and editor state
Givena theme change reported by VS Code
Whenthe preview document or the editor state is as in the table
Thenthe outcome is the one in the table
InputOutcome
A preview whose document has no .md pathThe page receives its themeChanged message but the document is not drawn again
A block editor open in edit modeThe page changes its theme marker at once, the document is not drawn again, and the redraw runs after the editor closes (see SwRS-MDOKFSTUDIO-BLOCK-041)
No editor openThe redraw starts at once
nominalA page that missed the theme message gets it with the ready answer
Givena page whose runtime started after the host's themeChanged message was delivered, and the host's answer to a ready report of render 11
Whenthe page reports previewReady and the host answers
Thenthe page receives themeChanged with kind 2 and data-sphinx-preview-theme reads 2; the document, revision and request number of the answer are those of the report, so a page that has moved on ignores it
boundaryThe page reports the theme mode it was given
Givena press of the Theme button (see SwRS-MDOKFSTUDIO-THEME-001)
Whenthe page reports the new mode
Thenit posts a previewThemeModeChanged message, whose accepted shape and the dropping of a malformed one are stated in SwRS-MDOKFSTUDIO-THEME-013

Implemented in 6

Tested by 4

Known limits (1)