test: fix tests for MacOS, closes #61
(I think) due to differences Backspace/Delete is handled in MacOS as compared to Linux/Windows, some tests were failing. `oxker` default keymap doesn’t use Backspace or Delete, but a note has been added to the function in case it ever comes up again in the future.
This commit is contained in:
@@ -215,6 +215,8 @@ impl From<Option<ConfigKeymap>> for Keymap {
|
||||
|
||||
impl Keymap {
|
||||
/// Try to parse a &[String] into a Vec of keycodes, at most the output will have 2 entries
|
||||
/// This might fail on MacOS due to Backspace and Delete working in a different manner as to how they work on Linux & Windows
|
||||
/// I think that on MacOS `Del` becomes `Fwd Del`, and `Backspace` becomes `Delete`
|
||||
fn try_parse_keycode(input: &[String]) -> Option<Vec<KeyCode>> {
|
||||
let mut output = vec![];
|
||||
|
||||
@@ -246,6 +248,7 @@ impl Keymap {
|
||||
"f11" => Some(KeyCode::F(11)),
|
||||
"f12" => Some(KeyCode::F(12)),
|
||||
"backspace" => Some(KeyCode::Backspace),
|
||||
// See MacOS not above
|
||||
"backtab" => Some(KeyCode::BackTab),
|
||||
"delete" => Some(KeyCode::Delete),
|
||||
"down" => Some(KeyCode::Down),
|
||||
@@ -394,7 +397,7 @@ mod tests {
|
||||
sort_by_id: gen_v(("[", "]")),
|
||||
sort_by_image: gen_v(("A", "B")),
|
||||
sort_by_rx: gen_v(("C", "D")),
|
||||
sort_by_tx: gen_v(("backspace", "TAB")),
|
||||
sort_by_tx: gen_v(("insert", "TAB")),
|
||||
sort_reset: gen_v(("up", "down")),
|
||||
toggle_help: gen_v(("home", "end")),
|
||||
toggle_mouse_capture: gen_v(("pagedown", "PAGEUP")),
|
||||
@@ -426,7 +429,7 @@ mod tests {
|
||||
sort_by_id: (KeyCode::Char('['), Some(KeyCode::Char(']'))),
|
||||
sort_by_image: (KeyCode::Char('A'), Some(KeyCode::Char('B'))),
|
||||
sort_by_rx: (KeyCode::Char('C'), Some(KeyCode::Char('D'))),
|
||||
sort_by_tx: (KeyCode::Backspace, Some(KeyCode::Tab)),
|
||||
sort_by_tx: (KeyCode::Insert, Some(KeyCode::Tab)),
|
||||
sort_reset: (KeyCode::Up, Some(KeyCode::Down)),
|
||||
toggle_help: (KeyCode::Home, Some(KeyCode::End)),
|
||||
toggle_mouse_capture: (KeyCode::PageDown, Some(KeyCode::PageUp)),
|
||||
|
||||
@@ -581,7 +581,7 @@ mod tests {
|
||||
sort_by_id: (KeyCode::Char('/'), None),
|
||||
sort_by_image: (KeyCode::Char(','), None),
|
||||
sort_by_rx: (KeyCode::Char('.'), None),
|
||||
sort_by_tx: (KeyCode::Backspace, None),
|
||||
sort_by_tx: (KeyCode::Insert, None),
|
||||
sort_reset: (KeyCode::Up, None),
|
||||
toggle_help: (KeyCode::Home, None),
|
||||
toggle_mouse_capture: (KeyCode::PageDown, None),
|
||||
@@ -626,9 +626,9 @@ mod tests {
|
||||
sort_by_id: (KeyCode::Char('/'), Some(KeyCode::Char('='))),
|
||||
sort_by_image: (KeyCode::Char(','), Some(KeyCode::Char('\\'))),
|
||||
sort_by_rx: (KeyCode::Char('.'), Some(KeyCode::Char(']'))),
|
||||
sort_by_tx: (KeyCode::Backspace, Some(KeyCode::BackTab)),
|
||||
sort_by_tx: (KeyCode::Insert, Some(KeyCode::BackTab)),
|
||||
sort_reset: (KeyCode::Up, Some(KeyCode::Down)),
|
||||
toggle_help: (KeyCode::Home, Some(KeyCode::Delete)),
|
||||
toggle_help: (KeyCode::Home, Some(KeyCode::End)),
|
||||
toggle_mouse_capture: (KeyCode::PageDown, Some(KeyCode::PageUp)),
|
||||
};
|
||||
|
||||
@@ -671,7 +671,7 @@ mod tests {
|
||||
sort_by_id: (KeyCode::Char('/'), Some(KeyCode::Char('='))),
|
||||
sort_by_image: (KeyCode::Char(','), None),
|
||||
sort_by_rx: (KeyCode::Char('.'), Some(KeyCode::Char(']'))),
|
||||
sort_by_tx: (KeyCode::Backspace, None),
|
||||
sort_by_tx: (KeyCode::Insert, None),
|
||||
sort_reset: (KeyCode::Up, Some(KeyCode::Down)),
|
||||
toggle_help: (KeyCode::Home, None),
|
||||
toggle_mouse_capture: (KeyCode::PageDown, Some(KeyCode::PageUp)),
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ expression: setup.terminal.backend()
|
||||
" │ ( / ) sort containers by id │ "
|
||||
" │ ( , ) sort containers by image │ "
|
||||
" │ ( . ) sort containers by rx │ "
|
||||
" │ ( Backspace ) sort containers by tx │ "
|
||||
" │ ( Insert ) sort containers by tx │ "
|
||||
" │ ( a ) close dialog │ "
|
||||
" │ ( k ) quit at any time │ "
|
||||
" │ │ "
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ expression: setup.terminal.backend()
|
||||
" │ ( u ) or ( v ) scroll list to start │ "
|
||||
" │ ( enter ) send docker container command │ "
|
||||
" │ ( g ) or ( h ) exec into a container │ "
|
||||
" │ ( Home ) or ( Del ) toggle this help information - or click heading │ "
|
||||
" │ ( Home ) or ( End ) toggle this help information - or click heading │ "
|
||||
" │ ( m ) or ( n ) save logs to file │ "
|
||||
" │ ( Page Down ) or ( Page Up ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
||||
" │ ( i ) or ( j ) enter filter mode │ "
|
||||
@@ -39,7 +39,7 @@ expression: setup.terminal.backend()
|
||||
" │ ( / ) or ( = ) sort containers by id │ "
|
||||
" │ ( , ) or ( \ ) sort containers by image │ "
|
||||
" │ ( . ) or ( ] ) sort containers by rx │ "
|
||||
" │ ( Backspace ) or ( Back Tab ) sort containers by tx │ "
|
||||
" │ ( Insert ) or ( Back Tab ) sort containers by tx │ "
|
||||
" │ ( a ) or ( b ) close dialog │ "
|
||||
" │ ( k ) or ( l ) quit at any time │ "
|
||||
" │ │ "
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ expression: setup.terminal.backend()
|
||||
" │ ( / ) or ( = ) sort containers by id │ "
|
||||
" │ ( , ) sort containers by image │ "
|
||||
" │ ( . ) or ( ] ) sort containers by rx │ "
|
||||
" │ ( Backspace ) sort containers by tx │ "
|
||||
" │ ( Insert ) sort containers by tx │ "
|
||||
" │ ( a ) or ( b ) close dialog │ "
|
||||
" │ ( k ) quit at any time │ "
|
||||
" │ │ "
|
||||
|
||||
Reference in New Issue
Block a user