diff options
| author | sommerfeld <sommerfeld@sommerfeld.dev> | 2026-09-26 22:23:04 +0100 |
|---|---|---|
| committer | sommerfeld <sommerfeld@sommerfeld.dev> | 2026-09-26 22:23:04 +0100 |
| commit | 869ea8436d9cf9d5748e6c089cc0b0b58358e75f (patch) | |
| tree | 57d765d0a975b67573673f13d00a1584cb2c35f4 /tests/fixtures/workspace-cycle.js | |
| parent | d6f4aee0ccf47dea61204f4af44d8eed2e65f96c (diff) | |
| download | dotfiles-869ea8436d9cf9d5748e6c089cc0b0b58358e75f.tar.gz dotfiles-869ea8436d9cf9d5748e6c089cc0b0b58358e75f.tar.bz2 dotfiles-869ea8436d9cf9d5748e6c089cc0b0b58358e75f.zip | |
Align GNOME shortcuts with the Sway setup
Diffstat (limited to 'tests/fixtures/workspace-cycle.js')
| -rw-r--r-- | tests/fixtures/workspace-cycle.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/fixtures/workspace-cycle.js b/tests/fixtures/workspace-cycle.js new file mode 100644 index 0000000..13e1bc7 --- /dev/null +++ b/tests/fixtures/workspace-cycle.js @@ -0,0 +1,54 @@ +import assert from "node:assert/strict"; + +const bindings = new Map(); +const Extension = class { + getSettings() { + return {}; + } +}; +const Meta = { KeyBindingFlags: { NONE: 0 } }; +const Shell = { ActionMode: { NORMAL: 1, OVERVIEW: 2 } }; +const Main = { + wm: { + addKeybinding(name, settings, flags, mode, callback) { + assert.equal(mode, 3); + bindings.set(name, callback); + }, + removeKeybinding(name) { + bindings.delete(name); + }, + }, +}; +let active = 0; +let activations = 0; +global.workspace_manager = { + n_workspaces: 3, + get_active_workspace_index: () => active, + get_workspace_by_index: (index) => ({ + activate(time) { + assert.equal(time, 123); + active = index; + activations++; + }, + }), +}; +global.get_current_time = () => 123; + +// EXTENSION + +const extension = new WorkspaceCycle(); +extension.enable(); +bindings.get("previous-workspace")(); +assert.equal(active, 2); +bindings.get("next-workspace")(); +assert.equal(active, 0); +bindings.get("next-workspace")(); +assert.equal(active, 1); +global.workspace_manager.n_workspaces = 1; +extension.cycle(1); +assert.equal(activations, 3); +extension.disable(); +assert.equal(bindings.size, 0); +extension.enable(); +assert.equal(bindings.size, 2); +extension.disable(); |
