Behaviour SwRS-MDOKFSTUDIO-REVIEW-218
Escape or a press outside closes a comment editor and asks before dropping a draft
When a reader presses Escape, wherever the focus is, or presses outside while the new comment box or the reply box of the thread popover is open, the page SHALL close it at once when its text is blank, and SHALL otherwise ask Discard or Keep editing inside the editor, without window.confirm, and drop the text only on Discard.
Part of StRS-MDOKFSTUDIO-REVIEW-003, outside the paths drawn on its map.
Scenarios 3
The situations the tests check; open one to read it.
nominalEscape and a press outside close a blank editor
| Given | When | Then |
|---|---|---|
| an open new comment box with no text, or only spaces, and the focus anywhere | the reader presses Escape | the box closes, nothing is sent and the event is stopped from reaching other handlers |
| the same box | the reader presses the mouse or a pointer outside the box (not on the Comment button) | the box closes and nothing is sent |
| an open thread popover whose reply box has no text | the reader presses Escape, or presses outside the popover and outside the highlights | the popover closes |
| an open box or popover | the reader presses inside it | nothing is asked and nothing closes |
nominalA changed draft is asked about, inside the editor
Givenan open new comment box, or a thread popover, whose text area holds text that is not blank
Whenthe reader presses Escape, wherever the focus is, or presses outside the editor
Thenthe editor stays open with its text, and a group named "Discard this comment?" (box) or "Discard this reply?" (popover) shows two buttons, Discard and Keep editing; in the box it replaces Save and Cancel
WHEN the reader presses Keep editing, THEN the question goes, the text stays and the text area has the focus
WHEN the reader presses Discard, THEN the editor closes and nothing is sent
`window.confirm` is never called
WHEN the reader presses Keep editing, THEN the question goes, the text stays and the text area has the focus
WHEN the reader presses Discard, THEN the editor closes and nothing is sent
`window.confirm` is never called
boundaryWhile the question shows
| Input | Outcome |
|---|---|
| Escape | the question goes and the editor stays open with its text, as Keep editing |
| another press outside | the one question stays, no second one is added |
| the threads are posted again while the popover asks | the popover for the same thread asks again |
| the reader presses the highlight of the same thread, or of another thread, while the popover holds a changed draft | the popover asks and does not close or switch |
| Cancel in the new comment box | the box closes without a question (Cancel is the explicit answer) |