Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-REVIEW-001

The review comments file next to a document holds its threads as data

When a document is shown, the extension SHALL look for its review threads in a file with the name of the document, its extension replaced by .comments.json, in the same folder, read them as plain data with only the fields of the format, and write them back in one stable form.

Part of StRS-MDOKFSTUDIO-REVIEW-001, outside the paths drawn on its map.

Part of StRS-MDOKFSTUDIO-REVIEW-003, outside the paths drawn on its map.

Scenarios 5

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

nominalName of the comments file
Givendocuments named notes.md, notes and a.b.md in a folder
Whenthe extension looks for their review threads
Thenit reads notes.comments.json, notes.comments.json and a.b.comments.json in the same folder
nominalValid file
Givena file with version 1, the document name notes.md and one thread with an anchor, a resolved flag, an ISO creation date and one comment
Whenthe file is read
Thenone thread is returned with its quote, its author and its body
boundaryUnknown fields
Givena file whose thread, anchor and comments carry fields the format does not name
Whenthe file is read
Thenthe threads are returned without those fields and the unknown top-level fields are not kept
boundaryText that looks like markup
InputOutcome
A comment body and an author name that contain an img tag with an onerror attribute, a control character and a template expressionThe strings are returned unchanged as data; a polluting __proto__ key does not reach other objects
A thread whose comment body is an HTML tag, shown in the thread popoverThe tag is shown as text and no element is created from it
nominalStable written form
InputOutcome
A file whose keys come in another order, read and written againThe text equals the one written from the canonical order, starting with version, document and threads, with a 2-space indent and a trailing newline
The text the extension wrote, read and written againThe second text equals the first

Implemented in 2

Tested by 4