20 lines
1.1 KiB
JavaScript
20 lines
1.1 KiB
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const { readdirSync, readFileSync } = require('node:fs');
|
|
const { join } = require('node:path');
|
|
|
|
test('download and offline icons never use emoji or text glyphs', () => {
|
|
// Arrow keys are prose, not action icons. Exact lines prevent new exceptions.
|
|
const allow = new Map([
|
|
['index.html', new Set(['<div class="shortcut-row"><kbd>↑</kbd><kbd>↓</kbd><span>Volume up / down</span></div>'])],
|
|
['admin.html', new Set(['<div class="keyboard-hint" aria-label="Keyboard shortcuts"><strong>Shortcuts</strong> <kbd>Space</kbd> stamp in Tap-sync · <kbd>↑</kbd><kbd>↓</kbd> select · <kbd>S</kbd> stamp selected · <kbd>K</kbd> play · <kbd>⌘/Ctrl S</kbd> save</div>'])],
|
|
]);
|
|
const failures=[];
|
|
for (const file of readdirSync(__dirname).filter(f=>/\.(js|html|css)$/.test(f) && !f.endsWith('.test.js'))) {
|
|
readFileSync(join(__dirname,file),'utf8').split('\n').forEach((line,i)=>{
|
|
if (/[⬇⤓⇩💾📥↓]/u.test(line) && !allow.get(file)?.has(line.trim())) failures.push(`${file}:${i+1}`);
|
|
});
|
|
}
|
|
assert.deepEqual(failures,[]);
|
|
});
|