#258: the formula-header Resize Table test enters its formula away from the table

The test typed =1+1 next to the table's header row, which now grows the table
and names the column itself, so table.resize had nothing left to do and the
test no longer reached Resize Table's own header naming. The formula now goes
in D1, two columns away, and the test checks the table did not grow before
the resize.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
AlissonFA
2026-11-29 07:18:32 -03:00
co-authored by Claude Opus 5.5
parent 3c9fc0d7c2
commit 28bd4b42d0
@@ -196,14 +196,17 @@ fn resizing_a_table_without_a_header_row_keeps_its_names_and_data() {
#[test]
fn resized_formula_header_is_named_by_its_value_when_formulas_show() {
// The formula goes in D1, not next to the table, so entering it doesn't grow the table and
// the header is named by Resize Table itself.
let mut s = with_headers("A1:B3", &["x", "y"]);
s.execute("cell.set", json!({"cell": "C1", "input": "=1+1"})).unwrap();
s.execute("cell.set", json!({"cell": "D1", "input": "=1+1"})).unwrap();
assert_eq!(sheet(&s).tables[0].range.a1(), "A1:B3");
{
let wb = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().wb);
std::sync::Arc::make_mut(&mut wb.sheets[0]).show_formulas = true;
}
s.execute("table.resize", json!({"table": "T", "range": "A1:C3"})).unwrap();
assert_eq!(names(&s, 0), ["x", "y", "2"]);
s.execute("table.resize", json!({"table": "T", "range": "A1:D3"})).unwrap();
assert_eq!(names(&s, 0).last().map(String::as_str), Some("2"));
assert_eq!(headers(&s, 0), names(&s, 0));
}