Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-001

The Edit button turns edit mode on and off and tidies up on exit

When a writer clicks the Edit button of a preview, the page SHALL switch edit mode on or off and show the new state on the button as its pressed state and its tooltip, post the new state to the host before it applies it, keep the reading layout unchanged, and on exit save the open block editor, clear the block selection and the hover outline and close the label rename field.

Step 1 of path 1 in StRS-MDOKFSTUDIO-BLOCK-001: from “The preview shows the document in reading mode” to “Edit mode is on”.

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

Scenarios 8

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

nominalEdit mode turned on
Givena preview in reading mode
Whenthe writer clicks the Edit button
Thenthe page posts previewEditModeChanged with editMode true for the shown document and then turns edit mode on: the page element carries data-sphinx-preview-edit-mode on, the button carries data-edit-mode on and aria-pressed true, and its tooltip reads "Exit edit mode"
nominalEdit mode turned off again
Givena preview in edit mode
Whenthe writer clicks the Edit button again
Thendata-sphinx-preview-edit-mode and data-edit-mode are off, aria-pressed is false and the tooltip reads "Edit mode"
nominalLeaving edit mode with an open block editor
Givenedit mode on and a block editor whose source is loaded and whose text was changed
Whenthe writer clicks the Edit button
ThenpreviewEditModeChanged with editMode false is posted first, then one final previewEditSave with the typed text, so the block save stays the last message, and the editor closes when the next render arrives
boundaryBlock editor still waiting for its source
Givenedit mode on and a block editor that is still waiting for its source
Whenedit mode is turned off
Thenthe editor closes at once and no save and no cancel message is posted
nominalLeaving edit mode removes the edit state
Given edit mode on andWhen edit mode is turned offThen
two blocks selectedthe writer clicks the Edit buttonno block carries data-sphinx-preview-block-selected and the selection announcer is empty
the pointer over a list item, so the item is outlined (the list is outlined only when the pointer is on it outside its items)the writer clicks the Edit buttonthe item no longer carries data-sphinx-preview-edit-hover
the rename field of an anchor icon openthe writer clicks the Edit buttonthe field is closed and no previewLabelRename message is posted
boundaryNothing to tidy up
InputOutcome
Edit mode turned off with nothing selectednothing changes and no selection status element is created
Edit mode turned off with no rename field opennothing else changes in the page
Edit mode off and the pointer moves over a blockno element receives the hover outline
nominalEdit mode on keeps the reading layout
Givena document with a wrapped paragraph in reading mode
Whenedit mode is turned on
Thenthe paragraph keeps its wrapping and hides the source line breaks; only the cursor, the hover outline and the insert points are added
boundaryHover and click do not reflow
Givenedit mode on
Whenthe pointer hovers a paragraph and the writer clicks it
Thenno rendered paragraph shows its source line breaks and only the clicked block is replaced by its editor

Implemented in 1

Tested by 4