Behaviour SwRS-MDOKFSTUDIO-MYST-038
The anchor icon opens a rename field that sends valid names
When a reader clicks the anchor icon of a label in edit mode, the extension SHALL open a Rename label popover with a prefilled, selected, focused Label name field before block click handling, send a rename only for a changed valid name and show the answer of the host in the field, placed so that it does not cover the block its label introduces.
Scenarios 10
The situations the tests check; open one to read it.
nominalThe click opens the rename field
Givenedit mode on and the label `(draft_1)=` before a paragraph, which shows an anchor icon with a pointer cursor
Whenthe anchor icon is clicked
Thena dialog Rename label opens under it with the Label name field prefilled with `draft_1`, selected and focused, and no block editor opens
boundaryA label above a table opens the field above its icon
| Input | Outcome |
|---|
| Anchor icon of a label held by no paragraph or heading (`(table-label)=` right before a table, also a code block, a figure or a directive) clicked in edit mode, with room above the icon | The field opens above the icon: its bottom edge is 6 px above the icon's top edge, its left edge as for any label; it covers no cell of the table |
| The same click with too little room above (less than the field's height between the icon and the top obstruction: the bottom of the preview toolbar when it overlaps the field's horizontal span, else 8 px from the top of the pane) and a page that can scroll up by the missing height | The page scrolls up by the missing height, then the field opens above the icon |
| The same click at the very top of the document, where the page cannot scroll up by the missing height | The field opens under the icon, as for a label before a paragraph, and covers the first rows of the table until Escape or a press elsewhere |
| Renaming..., Renamed. or a refusal shown in the field | The field grows upwards, away from the table |
The field is anchored by its bottom edge when it opens above. A label held by a paragraph or a heading keeps the placement under its icon. The field never exceeds the width of the pane (its padding and border included).
refusalClicks that open no field
| Input | Outcome |
|---|
| Anchor icon clicked with edit mode off | Nothing opens and the icon stays a link target |
nominalEnter sends the rename or closes
| Input (Enter pressed in the field) | Outcome |
|---|
| A changed valid name | One rename with the label line is posted |
| The name left unchanged | The field closes and nothing is posted |
refusalInvalid names are not sent
| Input (Enter pressed in the field) | Outcome |
|---|
| `bad name` (a space) | The message is shown and nothing is posted |
| An empty name | The same message is shown and nothing is posted |
| A 101-character name | The same message is shown and nothing is posted |
| A name with characters other than letters, digits and `_ . : -` | The same message is shown and nothing is posted |
The message reads: Use letters, digits and _ . : - only (100 characters at most). The host and the message validator repeat the check.
nominalLabels starting with a symbol
| Input | Outcome |
|---|
| Anchor icon of the label `(_draft)=`, `(.hidden)=` or `(-dash)=` clicked in edit mode | The rename field opens prefilled and selected, like for any other label, and no block editor opens |
| `-new` typed for `_draft` and Enter pressed | One rename is posted |
The anchor icon, the field and the host share one name pattern: letters, digits and `_ . : -`, 100 characters at most. Every label that shows an icon can be renamed.
refusalA rename from a stale render
| Input | Outcome |
|---|
| A rename sent from an older render | The host answers ok false with The label is no longer on that line. Refresh the preview.; the field shows it and is editable again |
boundaryEscape or an outside press closes the field
| Input (field open) | Outcome |
|---|
| Escape | The field closes and nothing is sent |
| Pointer press outside the popover and the icon | The field closes and nothing is sent |
| Pointer press on a table cell while the field is open | The field closes, nothing is sent and the cell editor opens in the same click |
nominalA successful rename reports the remaining uses
| Input (rename succeeds) | Outcome |
|---|
| Two `{ref}` uses of the old name | The field shows Renamed. 2 uses of "old" remain in this document. |
| No `{ref}` use, or `{doc}` and `{numref}` uses only | The field shows Renamed. No use of the old name remains. |
Only `{ref}` forms are counted. The field closes itself 5 s after the success message; a new rename or Escape within the 5 s makes the field follow the new action and no stale close occurs.
boundaryProgress, refusal and silence of the host
| Input | Outcome |
|---|
| A posted rename the host has not answered | The field is disabled and reads Renaming... |
| An answer with another edit id | The answer is ignored |
| A refusal with a reason | The reason is shown and the field is editable again |
| No host answer within 6 s | The field is editable again with The editor did not answer. Try again. |
| An answer arriving before 6 s | The answer is matched by edit id, the timer is cleared and no timeout message is shown |