Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-054

Back and Next follow the host's history state

When the page starts, the page receives a history state for its render or the reader presses Back or Next, the extension SHALL keep both buttons disabled until the host reports a place to go to, enable each only when its flag in a state for the page's own render is true (a state of another render is ignored), and post one history move per press, which the host accepts only when its direction is back or forward and it names the current render, and answers by moving, by posting the state again when there is nowhere to go, or by a warning when the document cannot be opened.

Step 3 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-009: from “The place is recorded” to “The reader has pressed Back”.

Scenarios 8

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

boundaryStart disabled
Givena new preview page
Whenthe buttons are read before any host message (the toolbar markup carries the disabled attribute on both)
Thenboth are disabled until the first previewHistoryState
nominalState enables
Givena state with canBack true and canForward false
Whenthe page applies the previewHistoryState of its render
ThenBack is enabled and Next is disabled
boundaryOnly true enables
Givena state with canBack missing and canForward 1
Whenthe page applies it
Thenboth buttons are disabled, because only the value true enables (disabled = value !== true)
nominalPress posts a move
InputOutcome
An enabled Back button is pressedOne previewHistoryGo with direction back is posted, with the page's document, revision and request identifiers
An enabled Next button is pressedOne previewHistoryGo with direction forward is posted, with the same identifiers
refusalNowhere to go
Givena history with no previous place
WhenpreviewHistoryGo back arrives at the host
Thenthe host posts previewHistoryState with canBack false and opens nothing; with a previous place the move happens
refusalDocument cannot be opened
InputOutcome
Back to a place whose file was deletedThe warning "Markdown OKF-Schema Studio could not go back: {reason}" is shown with the reason of the error
Next to a place whose file cannot be openedThe warning "Markdown OKF-Schema Studio could not go forward: {reason}" is shown
Either move that failsThe history position and the list stay as they were, and the state posted afterwards enables Back and Next as before the press
refusalA history state of another render is ignored
InputOutcome
a state with an older or different revision (for example 99 for a page at 7)the buttons keep their state
a state for another documentignored in the same way
a state for another requestignored in the same way
a state with the page's identifiers (the current render)the buttons follow it (nominal row)
refusalThe host accepts only back or forward
InputOutcome
a previewHistoryGo with direction back or forwardaccepted
the direction up, an empty string or a missing directionrefused
a previewHistoryGo that names a render other than the shown onerefused by the render gate (see SwRS-MDOKFSTUDIO-TRUST-065)

Implemented in 4

Tested by 7

Replaces

SwRS-MDOKFSTUDIO-TOOLBAR-056A history state of another render is ignored superseded superseded by SwRS-MDOKFSTUDIO-TOOLBAR-054 Markdown file
SwRS-MDOKFSTUDIO-TOOLBAR-058The host accepts only back or forward superseded superseded by SwRS-MDOKFSTUDIO-TOOLBAR-054 Markdown file