Skip to content

Visual Studio Code, rebuilt in Rust

Rust

test(windows): check each platform key of extension keybindings

rokarturba076d8aaa0a
diff --git a/native/crates/app/src/workbench/extension_features/tests.rs b/native/crates/app/src/workbench/extension_features/tests.rs
index 8e1b3f2b493..fe5f56dce98 100644
--- a/native/crates/app/src/workbench/extension_features/tests.rs
+++ b/native/crates/app/src/workbench/extension_features/tests.rs
@@ -75,7 +75,7 @@ fn commands_list_their_keybindings_and_menus_with_the_implicit_command_palette()
let manifest = json!({ "contributes": {
"commands": [{ "command": "b.run", "title": "Run" }, { "command": "a.hidden", "title": { "value": "Hidden", "original": "Hidden" } }],
"menus": { "commandPalette": [{ "command": "a.hidden", "when": "false" }], "editor/title": [{ "command": "b.run" }, { "command": "c.menuOnly" }] },
- "keybindings": [{ "command": "b.run", "key": "ctrl+r", "mac": "cmd+r" }, { "command": "d.keyOnly", "key": "" }]
+ "keybindings": [{ "command": "b.run", "key": "ctrl+r", "mac": "cmd+r", "win": "alt+r", "linux": "shift+r" }, { "command": "d.keyOnly", "key": "" }]
} });
let (headers, rows) = rows(feature_data(&manifest, "commands"));
assert_eq!(headers, ["ID", "Title", "Keyboard Shortcuts", "Menu Contexts"]);
@@ -86,7 +86,7 @@ fn commands_list_their_keybindings_and_menus_with_the_implicit_command_palette()
assert_eq!(rows[1][3], markdown("`commandPalette` `editor/title`"));
let Cell::Keybindings(keybindings) = &rows[1][2] else { panic!("the keybindings cell") };
assert_eq!(keybindings.len(), 1);
- let platform_key = if cfg!(target_os = "macos") { "⌘" } else { "Ctrl" };
+ let platform_key = if cfg!(target_os = "macos") { "⌘" } else if cfg!(windows) { "Alt" } else { "Shift" };
assert!(keybindings[0][0].contains(&platform_key.to_owned()), "the platform's key wins: {keybindings:?}");
assert_eq!(rows[2][1], text(""));
}