Behaviour SwRS-MDOKFSTUDIO-REVIEW-044
A comment editor sends its text on Save or Cmd+Enter and keeps it until the host accepts it
When a reader writes a comment in the comment box or a reply in the reply box of a thread popover, the page SHALL send the typed text to the host only on Save or Reply, Cmd+Enter or Ctrl+Enter with a text that is not blank, and keep the box and its text until the host answers that the text is saved.
Step 3 of path 1 in StRS-MDOKFSTUDIO-REVIEW-003: from “The comment box is open” to “The comment is sent”.
Scenarios 16
The situations the tests check; open one to read it.
nominalBox content
When the comment box opens, the page shows a dialog named New comment holding the quoted text, a text area labelled Comment with the placeholder Write a comment and a limit of 10 000 characters, and Save and Cancel buttons.
| Input | Outcome |
|---|---|
| A selection of the words "second paragraph" and the box opens | The dialog shows those words, an empty text area with the focus, Save and Cancel |
| A selection whose text looks like HTML and the box opens | The quote and the typed text are set as text, never as markup |
nominalSave or Cmd/Ctrl+Enter sends the comment
refusalEmpty or blank text is not sent
nominalEscape or Cancel closes the box
| Input | Outcome |
|---|---|
| An open box with no text and the reader presses Escape, wherever the focus is | The box closes and nothing is sent |
| An open box with typed text and the reader presses Escape | The box asks Discard or Keep editing and nothing is sent (SwRS-MDOKFSTUDIO-REVIEW-218) |
| An open box and the reader presses Cancel | The box closes, nothing is sent, and the selection state is looked at again |
boundaryKeys typed in the box stay in the box
| Input | Outcome |
|---|---|
| The reader types a letter that is also a shortcut in the open box | The letter goes to the text area, each key event is stopped, and no other key handler of the page acts |
| A key is pressed outside the box and it is not the comment chord | The event is left alone |
nominalA saved comment closes the box
| Input | Outcome |
|---|---|
| A box waiting for the host, and the host answers a create with ok true | The box closes and the text selection is cleared |
| An answer of another kind arrives | The answer is ignored and the box stays |
| An answer arrives with no save pending | The answer is ignored and the box stays |
refusalA refused comment keeps the box and its text
| Input | Outcome |
|---|---|
| The answer ok false has no reason | The alert reads "The comment was not saved." |
refusalNo answer from the host after 15 seconds
WHEN the host answers ok true later, THEN the box closes
refusalThe host answers a blank or invalid comment as empty
When a create or reply message passes the protocol with a body that is blank or over 10 000 characters, the host answers ok false and writes nothing.
| Input | Outcome |
|---|---|
| A create message with the body of three spaces | The page is told "the comment is empty or too long." and no thread is written |
| A reply message with the body of three spaces | The page is told "the reply is empty or too long." |
| A create message whose anchor is not valid (lines, quote of at most 500 characters, prefix and suffix of at most 32 characters) | The page is told "the comment is empty or too long." |
nominalReply box: the popover of a preview ends with the reply box
refusalReply box: none without a reply hook
nominalReply box: Reply sends the thread id and the trimmed text
a reply box that is empty or holds only blanks
the reader presses Reply, or presses Cmd+Enter or Ctrl+Enter in the box
nothing is sent (the body must not be empty)
nominalReply box: keys typed in the box stay in the box
when the reader presses Cmd+Enter with text, the reply is sent and the event is stopped
boundaryReply box: length of the reply
| Input | Outcome |
|---|---|
| a reply of 10 000 characters | the reply is sent |
| a text of 10 001 characters forced into the box | nothing is sent (the text area also carries maxlength 10000) |
nominalReply box: a reply accepted by the host empties the box
when the reader typed other text in the box after the reply was sent, the box keeps that new text (the box is cleared only when it still equals the sent text)
refusalReply box: a reply the host does not accept keeps its text
| Input | Outcome |
|---|---|
| the host answers ok false with a reason | the text stays, the reason is shown as text in an alert of at most 500 characters and Reply works again |
| the host answers ok false without a reason | the text stays and the alert reads "The reply was not saved." |
| the host gives no answer within 15 seconds | the text stays, the message reads "No answer from the editor. Your text is kept: try Reply again." and Reply works again |
| the host answers ok true after that timeout | the box is emptied |