aboutsummaryrefslogtreecommitdiffstats
path: root/keybinds/test_binds.js
diff options
context:
space:
mode:
Diffstat (limited to 'keybinds/test_binds.js')
-rw-r--r--keybinds/test_binds.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/keybinds/test_binds.js b/keybinds/test_binds.js
index 9acb071..08be66a 100644
--- a/keybinds/test_binds.js
+++ b/keybinds/test_binds.js
@@ -18,7 +18,7 @@ const assert = require("assert");
const src = fs.readFileSync(__dirname + "/Binds.js", "utf8")
.replace(/^\.pragma library$/m, "");
-const B = new Function(src + "\nreturn { mods, keys, group };")();
+const B = new Function(src + "\nreturn { mods, keys, group, PAD };")();
assert.deepStrictEqual(B.mods(0), []);
assert.deepStrictEqual(B.mods(65), ["Win", "SHIFT"]);
@@ -38,10 +38,10 @@ assert.deepStrictEqual(B.group([
{ modmask: 8, key: "x", description: "No colon here" },
]), [
{ name: "Apps", rows: [
- { keys: "Win + w", label: "Browser" },
+ { keys: "Win + w", label: "Browser", pad: { key: 1 } },
{ keys: "Win + e", label: "Files" },
] },
- { name: "Media", rows: [{ keys: "Mute", label: "Mute" }] },
+ { name: "Media", rows: [{ keys: "Mute", label: "Mute", pad: { knob: "top", turn: "●" } }] },
{ name: "Other", rows: [{ keys: "ALT + x", label: "No colon here" }] },
{ name: "Undescribed", rows: [{ keys: "Win + s", label: "no description" }] },
]);
@@ -52,4 +52,13 @@ assert.deepStrictEqual(B.group([
{ modmask: 64, key: "z", description: "toString: Weird" },
]), [{ name: "toString", rows: [{ keys: "Win + z", label: "Weird" }] }]);
+// The macropad: shifted keys, the workspace row built in a loop, and an
+// encoder turned with Win held.
+assert.deepStrictEqual(B.PAD["Win + SHIFT + r"], { key: 2, mod: "Shift" });
+assert.deepStrictEqual(B.PAD["CTRL + ALT + SHIFT + l"], { key: 4, mod: "Alt" });
+assert.deepStrictEqual(B.PAD["CTRL + F1"], { key: 9 });
+assert.deepStrictEqual(B.PAD["Win + CTRL + SHIFT + F4"], { key: 12, mod: "Win Shift" });
+assert.deepStrictEqual(B.PAD["Win + Previous song"], { knob: "bottom", turn: "↺", mod: "Win" });
+assert.strictEqual(B.PAD["toString"], undefined);
+
console.log("ok");