web aliasing of accounting and others

This commit is contained in:
Priec
2026-08-13 19:05:41 +02:00
parent 6c15fcedc8
commit 8662b00ccf
7 changed files with 161 additions and 33 deletions

View File

@@ -126,7 +126,8 @@ mod tests {
}
/// The columns an ACCOUNTING row generates get a name field of their own,
/// which is what makes them aliasable at creation time.
/// which is what makes them aliasable at creation time — in a section of
/// their own, not in the column list, which is there to be read.
#[test]
fn generated_accounting_columns_get_an_alias_field() {
let mut page = page();
@@ -151,6 +152,38 @@ mod tests {
);
}
assert!(html.contains(r#"name="generated_alias_names""#));
// The column list itself carries no input at all.
let list = html
.split("<h2>Columns")
.nth(1)
.and_then(|rest| rest.split("</table>").next())
.expect("the column list should be rendered");
assert!(!list.contains("<input"), "{list}");
assert!(html.contains("<summary>Rename generated columns</summary>"));
}
/// A rename is reported where the column is listed, so the list still says
/// what the table will look like without the section being opened.
#[test]
fn a_renamed_generated_column_says_so_in_the_column_list() {
let mut page = page();
page.draft.columns.added.push(ColumnDefinition {
name: "accounting".to_string(),
data_type: "accounting".to_string(),
indexed: false,
quantity_ledger: false,
money_mode: MoneyMode::Exact,
currency: "EUR".to_string(),
});
page.draft.generated_aliases = vec![crate::pages::add_table::draft::GeneratedAlias {
source: "debit".to_string(),
alias: "md".to_string(),
}];
let html = render_builder(&page);
assert!(html.contains(r#"<span class="tag">renamed to md</span>"#), "{html}");
assert!(html.contains(r#"name="generated_alias_names" value="md""#));
}
#[test]