Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-003
A chevron folds the section under a heading, and Fold all folds every section
When the reader presses the chevron of a heading of the content, or the section shortcut with that heading current, the extension SHALL hide every block after the heading up to the next heading of the same or a higher level, keep the heading shown with its chevron marked folded, and show the blocks again when the chevron is pressed again; and when the reader presses the Fold button of the toolbar, or runs the command Fold All Sections in Preview or Unfold All Sections in Preview, fold every section that has content, or unfold every section, in the preview that has the focus.
Step 1 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-002: from “The document is shown with its sections open” to “A section is folded”.
Scenarios 7
The situations the tests check; open one to read it.
nominalFold a section
boundaryWhich headings fold and where a section ends
| Input | Outcome |
|---|---|
| A heading directly followed by a heading of the same or a higher level, or by nothing | It has no chevron, because its section is empty |
| An h3 inside a folded h2 that is itself folded | It stays hidden until the h2 opens; its own fold state is kept |
| A folded h3 followed by an h2 | The section ends at the h2, which stays shown |
| A heading inside an admonition or the properties table | It is not a top-level block of the content and has no chevron |
| The chevron is pressed in edit mode | The click is taken by the chevron: no block editor opens and the editor does not reveal the source |
| The chevron is pressed while a block editor or the frontmatter editor is open | Nothing folds |
| The section shortcut (Ctrl+Alt+[, Cmd+Alt+[ on macOS) with focus outside a text box | The section of the focused heading, or of the last heading at the reading line, folds or unfolds; a heading without a section stands for the heading above it; the key typed in a text box does nothing |
nominalThe chevron is shown when it is useful
boundaryFolded blocks take no room
nominalFold all and unfold all from the toolbar
nominalFold all and unfold all from the command palette
refusalNo preview, wrong command, open editor
| Input | Outcome |
|---|---|
| No preview has the focus | The command does nothing and returns false |
| A previewFoldCommand with a command other than foldAll or unfoldAll | The page refuses it |
| A block editor or the frontmatter editor is open | The page does not fold or unfold |
| The command palette while a text editor has the focus | The two entries are not offered (when: activeWebviewPanelId or activeCustomEditorId is the Studio's) |