Merge pull request #10057 from dotCooCoo/fix/escape-tests-cancel-path

Tool options: tests cover a canceled field edit that keeps the dialog open
This commit is contained in:
.CooCoo authored and GitHub committed 2026-11-29 09:08:58 -08:00
commit c6695df569
1 file changed
+19 -1
+19 -1
View File
@@ -507,6 +507,15 @@ pub(super) mod tests {
crate::toolbar::open_options(&mut panel.app(), "livePaintBucket").unwrap();
panel.frame();
assert_eq!(fields(&panel.app()), before);
panel.click_role("Width", Role::SPIN_BUTTON);
panel.key(Key::A, Modifiers::COMMAND);
panel.type_text("9");
assert_eq!(fields(&panel.app())["width"], 9.0, "typing proposes the width");
panel.type_text("x");
panel.key(Key::Tab, Modifiers::NONE);
panel.frame();
assert!(is_open(&panel.app()), "leaving the field keeps the dialog open");
assert_eq!(fields(&panel.app()), before, "leaving the field on text that is not a number restores the opening width");
if commit {
panel.click_role("Width", Role::SPIN_BUTTON);
panel.key(Key::A, Modifiers::COMMAND);
@@ -530,7 +539,7 @@ pub(super) mod tests {
/// Normal Gap Options supplies numeric points. This hosted row fixture separately checks
/// the nullable length helper's contract, including restoring an empty opening value.
#[test]
fn a_nullable_length_row_restores_null_on_escape() {
fn a_nullable_length_row_restores_null_when_its_typing_is_canceled() {
static NULL_LENGTH: OptionSpec = OptionSpec {
key: "nullableLengthTest",
title: || "Nullable Length".into(),
@@ -555,6 +564,15 @@ pub(super) mod tests {
open(&mut panel.app(), &NULL_LENGTH, Map::from_iter([("length".into(), Value::Null)]), Value::Null).unwrap();
panel.frame();
assert_eq!(fields(&panel.app())["length"], Value::Null);
panel.click_role("Length", Role::SPIN_BUTTON);
panel.key(Key::A, Modifiers::COMMAND);
panel.type_text("9 pt");
assert_eq!(fields(&panel.app())["length"], 9.0);
panel.type_text("x");
panel.key(Key::Tab, Modifiers::NONE);
panel.frame();
assert!(is_open(&panel.app()), "leaving the field keeps the dialog open");
assert_eq!(fields(&panel.app())["length"], Value::Null, "leaving the field on text that is not a length restores null");
}
/// Whether `a` and `b` are the same value, numbers by their value.