Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-FMEDIT-028

The field action menu offers the missing schema fields or a custom key

When a field editor is open, the extension SHALL show inside the edited row, after the control, a field action menu labelled "Frontmatter field actions" with an "Add field" button that adds a field chosen among the schema fields still missing or typed as a custom key.

Step 1 of path 2 in StRS-MDOKFSTUDIO-FMEDIT-005: from “A field editor is open” to “A new field is added”.

Scenarios 9

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

nominalThe menu sits in the edited row with an Add field button
Editor open on the rowOutcome
a value editora toolbar "Frontmatter field actions" sits in the edited row after the control, with a button "Add frontmatter field" labelled Add field
a key editorthe same menu with the Add field button appears
nominalThe picker lists the schema fields still missing
Givena schema with the missing field owner
Whenthe writer opens Add field and chooses owner in the select "Frontmatter field to add" (placeholder "Choose a field...")
Thenan add save for owner is posted at once, placed right after the open row, with the first value found among the schema default, then the empty string
boundaryDefault value of the chosen field
Missing fieldValue posted
booleanfalse
number0
listan empty list
enumthe first enum value
a field with a schema defaultthe schema default
any other fieldthe empty string
nominalWithout schema fields to add, a typed name is added
Givena document without a schema (or a schema with no field left to add)
Whenthe writer opens Add field, types owner in the text input "New field name" and presses Enter or the Add button
Thenan add save for owner with an empty value is posted, after the open field (afterField)
boundaryThe Add button waits for a name
Givenno name typed in the text input
Whenthe picker is shown
Thenthe button "Add selected frontmatter field" is disabled until a name is typed
nominalCustom key when extra properties are allowed
Givena picker listing schema fields and a schema that allows additional properties
Whenthe writer chooses "Custom key…"
Thena "New field name" input appears, nothing is posted, and Enter in it with the name notes posts an add of notes with an empty value
boundaryNo Custom key when extra properties are forbidden
Givena schema root with additionalProperties false and schema fields left to add
Whenthe picker renders
Thenit lists the fields and has no "Custom key…" entry (the properties section carries the flag described in SwRS-MDOKFSTUDIO-FMSCHEMA-084)
refusalAn invalid custom key name is refused in the picker
Custom key typed, then EnterMessage in the editor status (nothing is posted)
empty, or only spaces"Enter a name for the new field."
surrounding spaces"The field name cannot start or end with spaces."
a line break"The field name cannot contain a line break."
a name already shown in the table'The field "x" already exists.'
boundaryThe menu stays inside its row in a narrow preview
Preview widthOutcome
normalneither the value nor another row is covered by the menu or its tooltips
about 520 pxthe menu and its tooltips wrap inside the edited row and cover nothing

Implemented in 1

Tested by 3

Known limits (1)

Replaces

SwRS-MDOKFSTUDIO-FMEDIT-033The Add field picker lists the schema fields still missing superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-028 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-034Without schema fields to add, a typed field name is added superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-028 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-035The picker offers a Custom key when extra properties are allowed superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-028 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-036An invalid custom key name is refused in the picker superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-028 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-084The field action menu stays inside its row in a narrow preview superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-028 Markdown file