Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-040
The column lists the h1 to h4 headings with folding
When the column is built, the extension SHALL list the headings h1 to h4 of the content container that have text, in document order, indented by their level below the shallowest listed heading, with the heading text only, a Table of contents landmark and a twisty on each entry that has deeper entries.
Step 2 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-006: from “The column is open” to “The headings are listed”.
Scenarios 8
The situations the tests check; open one to read it.
nominalFour levels
Givenheadings h1 to h5 in the content
Whenthe column is built
Thenentries for levels 1 to 4 appear with their level, in order, and the h5 is not listed
boundaryIndent, text and excluded headings
| Input | Outcome |
|---|---|
| A document whose top heading is an h2 | That h2 is at indent 0 and a following h3 one step deeper (--sphinx-preview-toc-depth = level - shallowest listed level) |
| A heading whose text is empty | It is not listed |
| A heading in a normal section | It is listed |
| Headings inside a properties table, an admonition, an open block editor or the sticky band | None of them is listed |
| A heading with a permalink glyph and a comment chip | The entry holds the heading words only, without the glyph, the chip or its hidden body |
| A heading with a TODO word chip | The TODO word stays in the entry |
refusalNo headings
| Input | Outcome |
|---|---|
| A document without headings and the column open | The column shows the text No headings and no entry |
| A document whose only headings are inside admonitions | The column shows No headings |
nominalLandmark
Givena page with the column closed
Whenthe nav element is read
Thenit exists as nav[data-sphinx-preview-toc] with aria-label Table of contents, hidden by the stylesheet; once the column is opened it is the same element and is displayed
nominalFold
Givena parent entry with two children
Whenits twisty is pressed
Thenthe children are hidden, aria-expanded is false, the accessible name becomes Unfold followed by the heading, and sibling entries stay shown; pressed again, they show and the name is Fold again
boundaryTwisty by entry
| Input | Outcome |
|---|---|
| An entry with deeper entries below it | It has a twisty button that hides or shows exactly its own subtree, down to the next entry of the same or a shallower level, and sets aria-expanded; its accessible name is Fold followed by the heading while the subtree is shown and Unfold followed by the heading while it is folded |
| An entry with no deeper entry below it | It has no twisty |
nominalFolded sections are remembered
Givena folded entry and a content update
Whenthe column is rebuilt
Thenthe entry is still folded; the folded entries are kept in the webview state (tocCollapsed), keyed by level, text and occurrence, and applied after every rebuild and reload
boundarySame text twice
Giventwo headings with the same level and text
Whenthe first is folded
Thenonly the first is folded, because the key holds the occurrence number