Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-004
The folded sections are a view state kept per document
When a section is folded or unfolded, the extension SHALL keep the folded headings of the document in the webview state by level, text and occurrence, apply them again after every content update and reload, and never change the document text.
Step 2 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-002: from “A section is folded” to “The folds stay as the reader left them”.
Scenarios 2
The situations the tests check; open one to read it.
nominalThe folds survive a reload and a content update
Givena document with its h2 B folded
Whenthe content is replaced by a content patch, or the page is loaded again in the same panel
ThenB is folded again: the webview state holds headingFolds with the key 2|B|0 under the document id, and apply folds the heading with that key
boundaryKeys, documents and the file
| Input | Outcome |
|---|---|
| Two headings with the same level and text | Only the folded one is folded: the key ends with the occurrence number |
| Another document in the same panel | Its keys are kept apart under its own document id; at most 24 documents are kept and the oldest are dropped |
| A saved state that is not an object of string arrays | It is read as no folds |
| Any fold or unfold | The document text, the source file and the edit messages are unchanged |
| The last section of a document is unfolded | The document entry is removed from the state |