space commands here we go again
This commit is contained in:
25
client/tests/input/leader_sequences.rs
Normal file
25
client/tests/input/leader_sequences.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use client::config::binds::config::Config;
|
||||
use client::input::leader::leader_match_action;
|
||||
use client::config::binds::key_sequences::parse_binding;
|
||||
use crossterm::event::KeyCode;
|
||||
|
||||
#[test]
|
||||
fn test_space_b_d_binding() {
|
||||
// Minimal fake config TOML
|
||||
let toml_str = r#"
|
||||
[keybindings]
|
||||
close_buffer = ["space+b+d"]
|
||||
"#;
|
||||
let config: Config = toml::from_str(toml_str).unwrap();
|
||||
|
||||
let seq = vec![KeyCode::Char(' '), KeyCode::Char('b'), KeyCode::Char('d')];
|
||||
let action = leader_match_action(&config, &seq);
|
||||
assert_eq!(action, Some("close_buffer"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_space_b_r() {
|
||||
let seq = parse_binding("space+b+r");
|
||||
let codes: Vec<KeyCode> = seq.iter().map(|p| p.code).collect();
|
||||
assert_eq!(codes, vec![KeyCode::Char(' '), KeyCode::Char('b'), KeyCode::Char('r')]);
|
||||
}
|
||||
Reference in New Issue
Block a user