Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-LIFE-062

A preview without a source says why and recovers when it returns

When the source of a preview is not an existing Markdown file inside its root, the extension SHALL replace the page by the status Preview source missing with the reason of the case, and render the source again when its file is created.

Step 1 of path 2 in StRS-MDOKFSTUDIO-LIFE-007: from “The Markdown file of a preview is missing” to “The status says Preview source missing”.

Scenarios 5

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

nominalDeleted file
Givena ready preview of a.md and a.md deleted on disk
Whenthe watcher reports the deletion
Thenthe page is replaced by Preview source missing with the message The active Markdown source was deleted.; the queue is cancelled and the old HTML and reading state are gone
nominalRestored panel
Givena restored panel whose file no longer exists
Whenthe panel is restored
Thenit shows the same status Preview source missing (integration test test/integration/serializer.test.ts, missing-source status)
boundaryReason of each case
InputOutcome
A new preview for a file that does not existPreview source missing with the message The active Markdown source is unavailable.
A change event for a document whose file vanishedPreview source missing with the message The active Markdown source is unavailable.
requestDocument called with an untitled document (not a saved .md file)Preview source missing with the message The restored or active source is not a Markdown file.
The shown a.md is deletedPreview source missing with the message The active Markdown source was deleted.
The reader renames or moves a.md to b.mdPreview source missing with the message The active Markdown source was renamed or deleted.
The file resolves, once symbolic links are resolved, outside the session's resource root (a symlink out)Preview source missing; the source counts as unavailable
A saved .md file below the rootIt renders
An included file (not the shown source) is deletedThe preview renders again instead of showing the status
An included file is renamedThe document renders again (see SwRS-MDOKFSTUDIO-LIFE-044)
nominalRecreated source
Givena preview showing Preview source missing for a.md
Whena.md is created again below the root
Thenthe preview renders a.md without any command
refusalCreated file is not the source
Givena preview showing Preview source missing and a created file that is not the shown source
Whenthe file is created
Thenthe preview stays on the status page

Implemented in 3

Tested by 3