ui: validity indicator rendering + warning theme colour (ADR-0027 step D)
Adds the `[ERR]` / `[WRN]` validity indicator to the input row. `App` gains `input_indicator: Option<Severity>` (the runtime owns its timing — step E) and a pure `input_validity_verdict()` query that runs `input_verdict` in simple mode only (advanced mode is raw SQL, ADR-0027 §7). `render_input_panel` reserves the rightmost six columns of the input row unconditionally (ADR-0027 §4) — a five-column label plus a one-column gap — so the typed command never shifts sideways when the indicator appears or hides. The label renders only when `input_indicator` is set: `[ERR]` in `theme.error`, `[WRN]` in the new amber `theme.warning` (defined for both light and dark themes). The indicator is not yet wired live — `input_indicator` stays `None` until the debounce lands (step E). Covered by a render test and the theme contrast test; the input-panel snapshot is updated for the six-column reservation.
This commit is contained in:
@@ -595,3 +595,23 @@ fn dsl_failure_shows_friendly_error_in_output() {
|
||||
"error should include the friendly message:\n{rendered}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validity_indicator_renders_err_and_wrn_labels() {
|
||||
// ADR-0027 §4: the input row shows a `[ERR]` / `[WRN]`
|
||||
// label at its right edge, or nothing when clean.
|
||||
use rdbms_playground::dsl::walker::Severity;
|
||||
let mut app = App::new();
|
||||
|
||||
let clean = rendered_text(&mut app, &Theme::dark(), 80, 24);
|
||||
assert!(!clean.contains("[ERR]"), "clean input shows no label:\n{clean}");
|
||||
assert!(!clean.contains("[WRN]"), "clean input shows no label:\n{clean}");
|
||||
|
||||
app.input_indicator = Some(Severity::Error);
|
||||
let err = rendered_text(&mut app, &Theme::dark(), 80, 24);
|
||||
assert!(err.contains("[ERR]"), "ERROR verdict shows [ERR]:\n{err}");
|
||||
|
||||
app.input_indicator = Some(Severity::Warning);
|
||||
let wrn = rendered_text(&mut app, &Theme::dark(), 80, 24);
|
||||
assert!(wrn.contains("[WRN]"), "WARNING verdict shows [WRN]:\n{wrn}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user