1
use ratatui::style::{Color, Style};
2

            
3
use super::*;
4

            
5
#[test]
6
1
fn the_hotkey_is_the_marked_letter() {
7
1
    assert_eq!(hotkey("Co~n~sole"), Some('n'));
8
1
    assert_eq!(hotkey("Console"), None);
9
1
    assert_eq!(hotkey("Con~sole"), None);
10
1
}
11

            
12
#[test]
13
1
fn marks_are_stripped_and_split_the_spans() {
14
1
    assert_eq!(plain("Co~n~sole"), "Console");
15
1
    let (base, hot) = (Style::new(), Style::new().fg(Color::Red));
16
1
    let parts = spans("Co~n~sole", base, hot);
17
3
    let text: Vec<_> = parts.iter().map(|s| s.content.to_string()).collect();
18
1
    assert_eq!(text, ["Co", "n", "sole"]);
19
1
    assert_eq!(parts[1].style, hot);
20
1
    assert_eq!(parts[0].style, base);
21
1
}