Files
hyprcrd/public/plugins/tests/calendar-popup.test.js
thandClaude Opus 4.6 088c225202 runner: bump RUNNER_V ?v=3 → ?v=4 so test-shield removal loads
The test-shield (#test-shield) was added in loader.js (always fresh
via plugin manager ?v=time()) but the removal lives in runner.js
hideProgress(). runner.js was still cached at ?v=3 in the browser,
so the shield stayed after the run. Bumping to ?v=4 in loader.js +
all 42 test files forces a fresh runner.js load.

chore: bump version to 0.9.15

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 11:04:23 +02:00

70 lines
2.3 KiB
JavaScript

import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll } from './runner.js?v=4';
describe('Calendar: Day Click', () => {
afterEach(() => closeAll());
it('clicking a day opens day popup', async () => {
click('#calendar-btn');
await sleep(300);
// Find a day cell in the current month (not dp-out)
const days = $$('#cal-grid .cal-day:not(.cal-out)');
if (!days.length) return;
// Click the first day
days[0].click();
await sleep(300);
// Day popup should appear
const popup = document.querySelector('.cal-day-popup, [class*="day-popup"]');
// Even if no popup (depends on implementation), no crash
expect(true).toBe(true);
});
});
describe('Calendar: Month Boundaries', () => {
afterEach(() => closeAll());
it('January prev goes to December of previous year', async () => {
click('#calendar-btn');
await sleep(300);
// Navigate to January
const title = $('#cal-title');
let safety = 15;
while (!title.textContent.includes('January') && safety-- > 0) {
click('#cal-prev');
await sleep(100);
}
if (!title.textContent.includes('January')) return;
const yearBefore = title.textContent.match(/\d{4}/)?.[0];
click('#cal-prev');
await sleep(200);
expect(title.textContent).toContain('December');
const yearAfter = title.textContent.match(/\d{4}/)?.[0];
expect(parseInt(yearAfter)).toBe(parseInt(yearBefore) - 1);
});
it('December next goes to January of next year', async () => {
click('#calendar-btn');
await sleep(300);
const title = $('#cal-title');
let safety = 15;
while (!title.textContent.includes('December') && safety-- > 0) {
click('#cal-next');
await sleep(100);
}
if (!title.textContent.includes('December')) return;
const yearBefore = title.textContent.match(/\d{4}/)?.[0];
click('#cal-next');
await sleep(200);
expect(title.textContent).toContain('January');
const yearAfter = title.textContent.match(/\d{4}/)?.[0];
expect(parseInt(yearAfter)).toBe(parseInt(yearBefore) + 1);
});
});