Merge pull request #10064 from dotCooCoo/fix/number-text-row-commit-tests

Graph Type: test that typed numbers and text reach the draft only on commit
This commit is contained in:
.CooCoo authored and GitHub committed 2026-11-29 09:09:47 -08:00
commit 963c6001ca
1 file changed
+34
+34
View File
@@ -1219,6 +1219,40 @@ mod tests {
}
}
/// A number or text row leaves the draft alone while its text is still being typed, and writes
/// the typed value once Tab commits it.
#[test]
fn typed_number_and_text_rows_reach_the_draft_only_when_committed() {
use crate::tests::panel_harness::Panel;
use craft::ui::contract::Role;
use egui::{Key, Modifiers};
let mut app = app_with_graph("column");
app.run(COMMAND, json!({"columnWidth": 80, "prefix": "USD"})).unwrap();
let mut panel = Panel::new(app, crate::tests::picks::dialogs);
panel.room(egui::vec2(900.0, 900.0));
open(&mut panel.app()).unwrap();
panel.frame();
panel.click_role("Column Width", Role::SPIN_BUTTON);
panel.key(Key::A, Modifiers::COMMAND);
panel.type_text("140");
panel.frame();
assert_eq!(field(&panel.app(), "columnWidth"), json!(80.0), "a number being typed is not in the draft");
panel.key(Key::Tab, Modifiers::NONE);
panel.frame();
assert_eq!(field(&panel.app(), "columnWidth"), json!(140.0), "Tab commits the typed number");
set(&panel.app(), PAGE, json!("valueAxis")).unwrap();
panel.frame();
panel.click_role("Prefix", Role::TEXT_INPUT);
panel.key(Key::A, Modifiers::COMMAND);
panel.type_text("EUR");
panel.frame();
assert_eq!(field(&panel.app(), "prefix"), json!("USD"), "text being typed is not in the draft");
panel.key(Key::Tab, Modifiers::NONE);
panel.frame();
assert_eq!(field(&panel.app(), "prefix"), json!("EUR"), "Tab commits the typed text");
}
/// Object › Graph › Type… opens the dialog on the selected graph's options, on its Graph
/// Options page; each page the type has can be shown, and Override Calculated Values of the
/// right axis takes input only while that axis has a scale of its own.