32 lines
907 B
JavaScript
32 lines
907 B
JavaScript
// ── Tests Plugin: conditional loader ──
|
|
//
|
|
// The test runner is heavy (40+ test files), so we only load it when:
|
|
// - URL contains ?test query param → auto-run
|
|
// - Ctrl+Shift+T pressed → manual open
|
|
//
|
|
// Tests are completely optional — without this plugin the app has no
|
|
// test runner code loaded at all.
|
|
|
|
const hyprcrd = window.hyprcrd;
|
|
|
|
// Auto-load if ?test in query string
|
|
if (new URLSearchParams(location.search).has('test')) {
|
|
import('./tests.js');
|
|
}
|
|
|
|
// Keyboard shortcut: Ctrl+Shift+T → open runner
|
|
document.addEventListener('keydown', e => {
|
|
if (e.ctrlKey && e.shiftKey && e.key === 'T') {
|
|
e.preventDefault();
|
|
import('./tests.js').then(() =>
|
|
import('./runner.js').then(m => m.open?.())
|
|
);
|
|
}
|
|
});
|
|
|
|
hyprcrd?.registerPlugin?.({
|
|
name: 'tests',
|
|
version: '1.0.0',
|
|
description: 'UI + state test runner',
|
|
});
|