DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Integration: #1068 Convert Rows descriptions name the table target (story, table, rows/row, cols/col)
aiongg21b2e30f93f9
diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rsindex a3eeaf3f1..c43c502bc 100644--- a/crates/engine/src/cmd/table.rs+++ b/crates/engine/src/cmd/table.rs@@ -369,7 +369,7 @@ fn table_specs() -> Vec<CommandSpec> {"To Header",["Table", "Convert Rows"],None,- "{rows?: [a,b]} — the target rows, at the top of the table or right after its header rows",+ "{story?, table?, rows?: [a, b] | row?, cols?: [a, b] | col? (the target cells; default: the selection)} — the target rows, at the top of the table or right after its header rows",|s| can_convert_rows(s, RowKind::Header),|s, p| convert_rows(s, p, RowKind::Header)),@@ -378,7 +378,7 @@ fn table_specs() -> Vec<CommandSpec> {"To Body",["Table", "Convert Rows"],None,- "{rows?: [a,b]} — the target header rows next to the body, footer rows next to it, or both",+ "{story?, table?, rows?: [a, b] | row?, cols?: [a, b] | col? (the target cells; default: the selection)} — the target header rows next to the body, footer rows next to it, or both",|s| can_convert_rows(s, RowKind::Body),|s, p| convert_rows(s, p, RowKind::Body)),@@ -387,7 +387,7 @@ fn table_specs() -> Vec<CommandSpec> {"To Footer",["Table", "Convert Rows"],None,- "{rows?: [a,b]} — the target rows, at the bottom of the table or right before its footer rows",+ "{story?, table?, rows?: [a, b] | row?, cols?: [a, b] | col? (the target cells; default: the selection)} — the target rows, at the bottom of the table or right before its footer rows",|s| can_convert_rows(s, RowKind::Footer),|s, p| convert_rows(s, p, RowKind::Footer)),diff --git a/crates/engine/src/tests_params.rs b/crates/engine/src/tests_params.rsindex 19625d90c..d9d7b883f 100644--- a/crates/engine/src/tests_params.rs+++ b/crates/engine/src/tests_params.rs@@ -104,3 +104,12 @@ fn journal_entries_pass_the_check() {assert!(check_params(id, params).is_ok(), "{id} {params}");}}++/// Convert Rows acts on the shared table target, so a call that names its table and cells isn't refused.+#[test]+fn convert_rows_takes_the_table_target() {+ for id in ["table.convertRowsToHeader", "table.convertRowsToBody", "table.convertRowsToFooter"] {+ check_params(id, &json!({"story": 1, "table": 0, "rows": [0, 1], "cols": [0, 0]})).unwrap();+ check_params(id, &json!({"row": 0, "col": 0})).unwrap();+ }+}