diff options
author | Kaiden Fey <kookie@spacekookie.de> | 2020-09-21 14:12:32 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-09-21 14:12:32 +0200 |
commit | f80843dd45d7acd563d0a5b014cec3a2ea686fc2 (patch) | |
tree | 87189d873d6f932d85f9c1a480462b37d96cd6a5 /home-manager/tests/modules/programs/vscode/keybindings.nix | |
parent | e0800985dab8f8ebb4cebdfd7e361fd1fafdb2a7 (diff) | |
parent | 9b1b55ba0264a55add4b7b4e022bdc2832b531f6 (diff) |
Merge commit '9b1b55ba0264a55add4b7b4e022bdc2832b531f6'
Diffstat (limited to 'home-manager/tests/modules/programs/vscode/keybindings.nix')
-rw-r--r-- | home-manager/tests/modules/programs/vscode/keybindings.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/home-manager/tests/modules/programs/vscode/keybindings.nix b/home-manager/tests/modules/programs/vscode/keybindings.nix new file mode 100644 index 00000000000..420b212dce9 --- /dev/null +++ b/home-manager/tests/modules/programs/vscode/keybindings.nix @@ -0,0 +1,53 @@ +# Test that keybdinings.json is created correctly. +{ config, lib, pkgs, ... }: + +with lib; + +let + bindings = [ + { + key = "ctrl+c"; + command = "editor.action.clipboardCopyAction"; + when = "textInputFocus && false"; + } + { + key = "ctrl+c"; + command = "deleteFile"; + when = ""; + } + { + key = "d"; + command = "deleteFile"; + when = "explorerViewletVisible"; + } + ]; + + targetPath = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/Code/User/keybindings.json" + else + ".config/Code/User/keybindings.json"; + + expectedJson = pkgs.writeText "expected.json" (builtins.toJSON bindings); +in { + config = { + programs.vscode = { + enable = true; + keybindings = bindings; + }; + + nixpkgs.overlays = [ + (self: super: { + vscode = pkgs.runCommandLocal "vscode" { pname = "vscode"; } '' + mkdir -p $out/bin + touch $out/bin/code + chmod +x $out/bin/code; + ''; + }) + ]; + + nmt.script = '' + assertFileExists "home-files/${targetPath}" + assertFileContent "home-files/${targetPath}" "${expectedJson}" + ''; + }; +} |