Behaviour SwRS-MDOKFSTUDIO-FMEDIT-029
Remove field deletes exactly the lines of a non-required field
When a field editor is open, the extension SHALL show in its field action menu a "Remove field" button for the edited row, which deletes exactly the lines of that field and keeps the comment lines above it, and which is disabled and refused by the host for a field the schema requires.
Another outcome at step 1 of path 2 in StRS-MDOKFSTUDIO-FMEDIT-005, in the state “A field editor is open”.
Part of StRS-MDOKFSTUDIO-FMEDIT-008, outside the paths drawn on its map.
Scenarios 6
The situations the tests check; open one to read it.
nominalEvery field editor has a Remove field button
| Editor open on the row | Outcome |
|---|---|
| a value editor on an optional field | the menu has an enabled button "Remove frontmatter field" labelled Remove field |
| a key editor | the same Remove field button appears in its menu |
nominalRemove deletes exactly the lines of the field
Givenfrontmatter with a comment line above the field legacy followed by another field
Whenlegacy is removed
Thenonly the legacy line is deleted and the comment lines stay
boundaryRemoval leaves a valid block
| Field removed | Outcome |
|---|---|
| the only field of the block | the block becomes a valid empty mapping ({}) between the fences |
| tags (a list) | exactly the sequence lines are deleted |
refusalRemove is disabled for a schema-required field
| Row whose editor opens | Remove button |
|---|---|
| marked required by the schema | disabled, its title reads "Required by the schema; it cannot be removed" |
| optional | enabled |
refusalThe host refuses to remove a required field
Givena document with a schema in which count is required
Whena remove of count arrives
Thenthe answer is 'Cannot remove required frontmatter field "count".' and the document is unchanged
boundaryOnly a newly missing required field blocks a remove
| Remove request | Outcome |
|---|---|
| an optional field, while a required field was already missing before the remove | accepted |
| a field whose removal makes another field newly missing through a conditional required rule | refused the same way, with the message above |
Implemented in 3
Tested by 6
Replaces
SwRS-MDOKFSTUDIO-FMEDIT-030Remove field deletes exactly the lines of the field superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-029 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-031Remove field is disabled for a schema-required field superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-029 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-032The host refuses to remove a required field superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-029 Markdown file