feat(notifications): add overlay notifications with position config (#110)

This commit is contained in:
2026-06-10 22:46:52 -07:00
committed by GitHub
parent c09d009a3e
commit 7be1843c41
177 changed files with 7524 additions and 440 deletions
@@ -0,0 +1,43 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createOverlayLoadingOsdController } from './overlay-loading-osd';
test('overlay loading OSD shows spinner ticks and clears when stopped', () => {
const messages: string[] = [];
const clearedTimers: unknown[] = [];
let tick: (() => void) | null = null;
const controller = createOverlayLoadingOsdController({
showOsd: (message) => {
messages.push(message);
},
clearOsd: () => {
messages.push('clear');
},
setInterval: (callback) => {
tick = callback;
return 'timer';
},
clearInterval: (timer) => {
clearedTimers.push(timer);
},
});
controller.start();
controller.start();
assert.deepEqual(messages, ['Overlay loading |']);
if (!tick) {
assert.fail('expected spinner tick callback');
}
const tickCallback: () => void = tick;
tickCallback();
tickCallback();
controller.stop();
controller.stop();
assert.deepEqual(messages, ['Overlay loading |', 'Overlay loading /', 'Overlay loading -', 'clear']);
assert.deepEqual(clearedTimers, ['timer']);
});