decimal precision constrained

This commit is contained in:
Filipriec
2026-08-24 19:58:44 +02:00
parent 60aca940ee
commit 16670f4375
13 changed files with 147 additions and 25 deletions

View File

@@ -245,11 +245,18 @@ mod tests {
assert!(html.contains("Every profile can use this shared table."));
}
/// Every type the server accepts has to be reachable from the picker, or
/// the web UI silently offers less than the backend does.
/// Fixed-scale decimal is the one intentionally gated type; enabling the
/// advanced control makes it reachable without removing server support.
#[test]
fn the_type_picker_offers_the_parameterised_and_interval_types() {
let html = render_builder(&page());
let mut state = page();
let html = render_builder(&state);
assert!(!html.contains(r#"<option value="decimal""#));
assert!(html.contains(r#"name="fixed_decimal_input""#));
state.draft.columns.fixed_decimal_input = "yes".to_string();
let html = render_builder(&state);
for column_type in ["decimal", "duration", "period", "accounting"] {
assert!(
@@ -273,10 +280,12 @@ mod tests {
assert!(render_builder(&state).contains(r#"name="gtin_type_input""#));
// Decimal reveals its precision and scale.
state.draft.columns.fixed_decimal_input = "yes".to_string();
state.draft.columns.type_input = "decimal".to_string();
let html = render_builder(&state);
assert!(html.contains(r#"name="decimal_precision_input""#));
assert!(html.contains(r#"name="decimal_scale_input""#));
assert!(html.contains("Advanced fixed-scale decimal"));
// Money reveals its currency and rounding inputs.
state.draft.columns.type_input = "money".to_string();