diff --git a/src/app/tests/connect.rs b/src/app/tests/connect.rs index 3b28ea0..519f534 100644 --- a/src/app/tests/connect.rs +++ b/src/app/tests/connect.rs @@ -138,3 +138,26 @@ fn connect_mode_aims_with_the_mouse_and_works_in_the_outline() { assert_eq!(look.line, Some(Stroke::Dashed), "a branch starts solid: dashed is next"); assert_eq!((h.label(), h.cursor().as_str()), ("NORMAL", "Soil")); } + +#[test] +fn a_named_style_n_and_the_note_view() { + let mut h = Harness::new(); + // n aims at the next match of the last search. + h.type_keys(":find compostggglC"); + h.type_keys("n"); + assert_eq!((h.label(), h.cursor().as_str()), ("CONNECT", "ask about compost")); + // s: a named line style, which brings its label. + h.type_keys("s/blocks"); + assert_eq!(h.label(), "CONNECT"); + h.type_keys(""); + let link = h.link_between("Soil", "ask about compost").unwrap(); + assert_eq!(link.look.style.as_ref().map(|style| style.as_str()), Some("blocks")); + // In the Note view, l goes to the next sibling to aim at it. + h.type_keys("vnglC"); + assert_eq!(h.cursor(), "Soil"); + h.type_keys("l"); + assert!(h.status().contains("Soil → Raised beds"), "{}", h.status()); + h.type_keys(""); + assert_eq!(h.message(), "linked Soil → Raised beds"); + assert!(h.screen().contains("→ Raised beds"), "the note lists the new link:\n{}", h.screen()); +}