Versie 0.3.3
This commit is contained in:
1 parent
1cf6eeed29
commit
6e741a51fe
57 files changed
+1362
-2135
No files matched your search
@@ -0,0 +1,54 @@
|
||||
// Generated, do not edit. sha256:1928a498401313a668bc3ca99074cab18fed0b4d4c803c1532d4ea964f94743c
|
||||
import { describe, it, beforeEach, mock } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { installDom } from '../helpers/mini-dom.mjs';
|
||||
import { CONFIG } from '../../shared/config.js';
|
||||
|
||||
const dom = installDom();
|
||||
|
||||
const INSTELLING = { blur: 0, auto_blur_min: CONFIG.AUTO_BLUR.NEVER_MIN };
|
||||
mock.module('../../client/app-settings.js', {
|
||||
namedExports: {
|
||||
appSetting: k => INSTELLING[k],
|
||||
setAppSetting: async (k, v) => { INSTELLING[k] = v; },
|
||||
},
|
||||
});
|
||||
|
||||
const { initPrivacyBlur } = await import('../../client/ui/blur.js');
|
||||
initPrivacyBlur(dom.host());
|
||||
|
||||
const stand = () => dom.document.documentElement.dataset.blur;
|
||||
|
||||
beforeEach(() => {
|
||||
INSTELLING.blur = 0;
|
||||
dom.document.documentElement.dataset.blur = 'off';
|
||||
for (const el of dom.document.querySelectorAll('.nav-edit-toggle, button.focus')) el.remove();
|
||||
});
|
||||
|
||||
describe('de spatiebalk en de vervaging', () => {
|
||||
it('wisselt heen en terug als niets de focus heeft, en houdt de pagina stil', () => {
|
||||
const doorgelaten = dom.key(dom.document.body, ' ');
|
||||
assert.equal(stand(), 'on');
|
||||
assert.equal(doorgelaten, false, 'geen scrollsprong van de spatie');
|
||||
dom.key(dom.document.body, ' ');
|
||||
assert.equal(stand(), 'off');
|
||||
});
|
||||
|
||||
it('laat een knop met de focus zijn eigen spatie houden', () => {
|
||||
const knop = dom.document.createElement('button');
|
||||
knop.className = 'focus';
|
||||
dom.document.body.appendChild(knop);
|
||||
assert.equal(dom.key(knop, ' '), true);
|
||||
assert.equal(stand(), 'off');
|
||||
});
|
||||
|
||||
it('doet niets in bewerkmodus of met een modifier', () => {
|
||||
dom.key(dom.document.body, ' ', { shiftKey: true });
|
||||
assert.equal(stand(), 'off');
|
||||
const schakel = dom.document.createElement('span');
|
||||
schakel.className = 'nav-edit-toggle is-on';
|
||||
dom.document.body.appendChild(schakel);
|
||||
dom.key(dom.document.body, ' ');
|
||||
assert.equal(stand(), 'off');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user