test(web): cover g sequences in the jstest suite
- commit
- a8c4b101e1b6197376ef98c6e0dea7f7553788e4
- author
- brice · · 2026-10-22 07:30 UTC
- committer
- brice · · 2026-10-22 08:51 UTC
- parent
- c3ae830
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +8 -7
R internal/adapters/web/keyboard_test.js → internal/adapters/web/jstest/keyboard.test.mjs +5 -6 renamed, 85% similar
| @@ -1,10 +1,9 @@ | |||
| 1 | - | // Run with node --test internal/adapters/web/keyboard_test.js. | |
| 2 | 1 | // Exercise the production key handler without a browser or dependencies. | |
| 3 | - | const { test } = require('node:test'); | |
| 4 | - | const assert = require('node:assert/strict'); | |
| 5 | - | const { readFileSync } = require('node:fs'); | |
| 6 | - | const { runInNewContext } = require('node:vm'); | |
| 7 | - | const source = readFileSync(__dirname + '/static/js/ermite.js', 'utf8'); | |
| 2 | + | import assert from 'node:assert/strict'; | |
| 3 | + | import { readFileSync } from 'node:fs'; | |
| 4 | + | import { test } from 'node:test'; | |
| 5 | + | import { runInNewContext } from 'node:vm'; | |
| 6 | + | const source = readFileSync(new URL('../static/js/ermite.js', import.meta.url), 'utf8'); | |
| 8 | 7 | function keyboard({ off = false, typing = false, dialog = false } = {}) { | |
| 9 | 8 | let handler; | |
| 10 | 9 | const fired = []; | |
| @@ -1,10 +1,9 @@ | |||||
| 1 | - | // Run with node --test internal/adapters/web/keyboard_test.js. | |||
| 2 | // Exercise the production key handler without a browser or dependencies. | 1 | // Exercise the production key handler without a browser or dependencies. | ||
| 3 | - | const { test } = require('node:test'); | 2 | + | import assert from 'node:assert/strict'; |
| 4 | - | const assert = require('node:assert/strict'); | 3 | + | import { readFileSync } from 'node:fs'; |
| 5 | - | const { readFileSync } = require('node:fs'); | 4 | + | import { test } from 'node:test'; |
| 6 | - | const { runInNewContext } = require('node:vm'); | 5 | + | import { runInNewContext } from 'node:vm'; |
| 7 | - | const source = readFileSync(__dirname + '/static/js/ermite.js', 'utf8'); | 6 | + | const source = readFileSync(new URL('../static/js/ermite.js', import.meta.url), 'utf8'); |
| 8 | function keyboard({ off = false, typing = false, dialog = false } = {}) { | 7 | function keyboard({ off = false, typing = false, dialog = false } = {}) { | ||
| 9 | let handler; | 8 | let handler; | ||
| 10 | const fired = []; | 9 | const fired = []; | ||
M internal/adapters/web/jstest/keys.test.mjs +3 -1
| @@ -17,9 +17,11 @@ function page({ owner = true, off = false, typing = false, dialog = false } = {} | |||
| 17 | 17 | return fired; | |
| 18 | 18 | }; | |
| 19 | 19 | } | |
| 20 | - | test('Shift+I opens inbox while lowercase i retains the issues tab', () => { | |
| 20 | + | test('Shift+I opens inbox while issues need the g i sequence', () => { | |
| 21 | 21 | const press = page(); | |
| 22 | 22 | assert.deepEqual(press('I'), ['inbox']); | |
| 23 | + | assert.deepEqual(press('i'), ['inbox']); | |
| 24 | + | press('g'); | |
| 23 | 25 | assert.deepEqual(press('i'), ['inbox', 'i']); | |
| 24 | 26 | }); | |
| 25 | 27 | test('inbox shortcut respects preference, fields, dialogs, and owner target', () => { | |
| @@ -17,9 +17,11 @@ function page({ owner = true, off = false, typing = false, dialog = false } = {} | |||||
| 17 | return fired; | 17 | return fired; | ||
| 18 | }; | 18 | }; | ||
| 19 | } | 19 | } | ||
| 20 | - | test('Shift+I opens inbox while lowercase i retains the issues tab', () => { | 20 | + | test('Shift+I opens inbox while issues need the g i sequence', () => { |
| 21 | const press = page(); | 21 | const press = page(); | ||
| 22 | assert.deepEqual(press('I'), ['inbox']); | 22 | assert.deepEqual(press('I'), ['inbox']); | ||
| 23 | + | assert.deepEqual(press('i'), ['inbox']); | |||
| 24 | + | press('g'); | |||
| 23 | assert.deepEqual(press('i'), ['inbox', 'i']); | 25 | assert.deepEqual(press('i'), ['inbox', 'i']); | ||
| 24 | }); | 26 | }); | ||
| 25 | test('inbox shortcut respects preference, fields, dialogs, and owner target', () => { | 27 | test('inbox shortcut respects preference, fields, dialogs, and owner target', () => { | ||