pub fn key(s: &str) -> KeyEventExpand description
Create a KeyEvent from a key string.
This is a convenience wrapper around parse_key_string that panics
if the key string is invalid, making it suitable for use in tests.
§Examples
use tui_dispatch_core::testing::key;
use crossterm::event::{KeyCode, KeyModifiers};
let k = key("q");
assert_eq!(k.code, KeyCode::Char('q'));
let k = key("ctrl+p");
assert_eq!(k.code, KeyCode::Char('p'));
assert!(k.modifiers.contains(KeyModifiers::CONTROL));
let k = key("shift+tab");
assert_eq!(k.code, KeyCode::BackTab);§Panics
Panics if the key string cannot be parsed.