Behaviour SwRS-MDOKFSTUDIO-TABLE-055
Row and column buttons add and remove rows and columns
When the writer presses a row or column button of the table bar, the extension SHALL insert an empty row or column before (Row above, Col left) or after (Row below, Col right) the selected one, or delete the selected body row or column, store the text typed in the current cell, keep the text of every other cell and the style of every line, select the new or nearest remaining row or column, save the table and reopen the editor at the new position once the page rendered it again, with Row above disabled in the header row and Row − and Col − disabled where the table model refuses the deletion, offer the same buttons on a plain list-table (one header row, one-line cells, no title, label or option other than header-rows) and write its changed grid back as a list-table, change only the lines the operation concerns (a column operation keeps the padding, the indentation and the outer pipes of every line), and close the popover, link panel and slash menu of the cell it leaves.
Step 3 of path 1 in StRS-MDOKFSTUDIO-TABLE-008: from “The table bar is shown above the table” to “An empty row is next to the selected one”.
Scenarios 14
The situations the tests check; open one to read it.
nominalRow below inserts an empty row
| Input | Outcome |
|---|
| Editor in the first body row of a table with two body rows, Row below | An empty body row sits between the first and the second body row, the editor is in the same column of that new row and the status reads "Row 2 of 3" followed by the column |
| Editor in the header row, Row below | The new row is the first body row and is selected |
nominalRow − deletes the selected row
| Input | Outcome |
|---|
| Three body rows, editor in the second, Row − | Two body rows remain and the editor is on the row that took the deleted row's place |
| Editor in the last of two body rows, Row − | The previous body row is selected |
nominalCol right and Col − insert and delete a column
| Input | Outcome |
|---|
| Three-column table, editor in the first column, Col right | A column of empty cells sits between the first and second columns, its delimiter cell is "---" and the editor is in the new column of the same row |
| Editor in the last column, Col right | The new column is the last one and is selected |
| Three-column table, editor in the second column, Col − | Every row loses its second cell and the editor is in the column that took its place |
| Editor in the last column, Col − | The previous column is selected |
refusalDisabled buttons and model refusals
| Input | Outcome |
|---|
| Editor in the header row, the bar inspected | Row − is disabled |
| Table with one body row and the editor in it, the bar inspected | Row − is disabled, and deleteRow on the model returns no row and removes nothing |
| Table of one column and the editor in it, the bar inspected | Col − is disabled (read from tableCellEditor.ts, untested) |
| deleteColumn called on the one-column model | It returns no column and removes nothing |
nominalTyped text kept
Given"new" typed in the selected cell and Row below pressed
Whenthe table is saved
Thenthe saved text carries "new" in the original cell, and the editor reopens in the new row
nominalSaved by the button itself
Givena row added with no further typing
WhenRow below is pressed
Thena final previewEditSave is posted at once, the page renders the new table and reopens the editor in the new row (no editor stays in a cell of the rendered table that shows another cell's text)
boundaryA column button keeps the style of every line
| Input | Outcome |
|---|
| An indented table with padded columns and alignment colons, Col right pressed, the table saved | Every line keeps its indentation, its padding and its outer pipes; the new cell is as wide as the cell on its left, its delimiter cell is dashes of that width, and the other cells are kept verbatim |
| A compact table "|A|B|", Col − pressed on the first column | Every line loses its first cell and keeps its outer pipes and its absence of spaces |
| A table without outer pipes, Col − pressed on the last column | The pipe before the removed cell goes with it; the lines stay parseable |
| A row that cannot be edited in place (the result would not split into the expected cells) | That line alone is written in the canonical form "| a | b |", keeping its indentation |
| Col right then Col − on the same position | The table is back to its original text |
| The same table with only Row below pressed, the table saved | The other lines are kept verbatim |
boundaryThe open panels belong to the cell they were opened in
| Input | Outcome |
|---|
| Emoji picker open from the cell bar, Col right pressed | The picker is closed |
| Link panel open from the cell bar, Tab pressed | The panel is closed and the editor is in the next cell |
| The cell editor is rendered for another cell after a row or column button or a move | The open popover or panel of the cell formatting group and the slash menu are closed, because they act on the text selected in the cell that was left |
nominalRow above on a body row
| Input | Outcome |
|---|
| Editor in the second body row, "qq" typed in the cell, Row above | A final previewEditSave carries an empty body row above that row and "qq" in the original cell; the page reopens the editor in the new row, in the same column |
refusalHeader row
| Input | Outcome |
|---|
| Editor in the header row, the bar inspected | Row above is disabled and nothing is saved |
nominalCol left on a column
| Input | Outcome |
|---|
| Editor in the header cell "B" of a two-column table, Col left | A final previewEditSave carries a table whose header reads "A", an empty cell, "B", whose delimiter row has a third "---" cell and whose body rows gain an empty cell at the same place; the title "B" is kept; the page reopens the editor in the new column of the same row |
boundaryStyle kept
| Input | Outcome |
|---|
| An indented, padded table, Col left on its first column | Every line keeps its indentation, padding and outer pipes, as for Col right (see SwRS-MDOKFSTUDIO-TABLE-055) |
nominalButtons on a list-table
| Input | Outcome |
|---|
| A cell of ```{list-table} with ":header-rows: 1", Col left | The cell editor opens, and the saved text is the list-table with an empty first cell added to every row (`* -` followed by the other cells) |
| The same list-table, a cell edited and committed with no button | Only the cell changes in the saved list-table |
| The same list-table, nothing changed | The text is saved as it was, character for character |
refusalNot a plain list-table
| Input | Outcome |
|---|
| A list-table with a title, a label, ":widths:", no ":header-rows: 1", several-line cells or indentation | The whole block opens in the raw Markdown editor, as before |
| A plain list-table open in the cell editor | List table (the conversion button) is disabled |