diff --git a/crates/engine/src/tests/textedit.rs b/crates/engine/src/tests/textedit.rs index bb1ac80a0..7738e45a4 100644 --- a/crates/engine/src/tests/textedit.rs +++ b/crates/engine/src/tests/textedit.rs @@ -1149,6 +1149,15 @@ fn typed_lists_off_leaves_typed_markers_as_text() { let t = obj(&s, id); assert_eq!((t.plain_text(), t.para_at(0).list), (format!("{typed} a"), None), "{typed}"); assert!(!undo_labels(&s).iter().any(|l| l == "Bullets and Numbering"), "{typed}"); + // Turned back on, the same typing in a new paragraph starts a list. + s.execute("prefs.set", &json!({"key": "typedLists", "value": true})).unwrap(); + key(&mut s, ToolKey::Enter, Mods::default()); + for c in typed.chars().chain(" ".chars()) { + s.tool_text(&c.to_string(), v).unwrap(); + } + let t = obj(&s, id); + assert_eq!((t.plain_text(), t.para_at(0).list, t.para_at(1).list.is_some()), (format!("{typed} a\n"), None, true), "on: {typed}"); + assert_eq!(undo_labels(&s).last().map(String::as_str), Some("Bullets and Numbering"), "on: {typed}"); } let mut s = session(); s.execute("prefs.set", &json!({"key": "typedLists", "value": false})).unwrap(); diff --git a/crates/ui-egui/src/prefs_dialog/tests.rs b/crates/ui-egui/src/prefs_dialog/tests.rs index 9e8ce2804..da1814b35 100644 --- a/crates/ui-egui/src/prefs_dialog/tests.rs +++ b/crates/ui-egui/src/prefs_dialog/tests.rs @@ -16,6 +16,27 @@ fn geometric_snapping_is_a_saved_smart_guides_preference() { assert!(a.run("view.snapping", json!({})).is_err()); } +/// Type › Start Lists From Typed Markers is a checkbox in the Type panel, on by default; turning +/// it off is saved, and every bundled language translates its label. +#[test] +fn start_lists_from_typed_markers_is_a_saved_type_preference() { + const LABEL: &str = "Start Lists From Typed Markers"; + let mut a = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + assert!(a.session.prefs.typed_lists); + open(&mut a, Some("Type")); + let text = crate::tests_labels::painted_text(&mut a, |a, ui| show(a, ui.ctx())); + assert!(text.contains(LABEL), "{text}"); + assert_eq!(a.ui.dialog.as_ref().unwrap().fields.get("typedLists"), Some(&json!(true))); + a.ui.dialog.as_mut().unwrap().fields.insert("typedLists".into(), json!(false)); + confirm(&mut a).unwrap(); + assert!(!a.session.prefs.typed_lists); + let saved: Prefs = serde_json::from_value(a.ui.engine_prefs.clone()).unwrap(); + assert!(!saved.typed_lists); + for lang in crate::i18n::Lang::all().filter(|l| l.code() != crate::i18n::Lang::EN.code()) { + assert!(crate::i18n::has(lang, LABEL), "{}", lang.code()); + } +} + /// A resting checkbox must have a visible outline in both states and every brightness. #[test] fn preference_checkboxes_draw_outlines_without_hover() {