Files
hyprcrd/public/plugins/tests/calendar.test.js
T
thandClaude Opus 4.6 ca47052768 collab attachments, multi-day events, calendar improvements
- Collab buckets sync attachments alongside cards (images/PDFs/audio).
  New /api/collab-attachments endpoint on relay, encrypted at rest,
  bucket-scoped for members.
- CalDAV multi-day events via **Bis:** body field. Calendar renders
  event on every day in range with day counter (1/6, 2/6, ...).
- Calendar preserves month across close/reopen (only jumps to today
  on first open).
- Calendar title: centered nav group with [MM-DD] Mon Y [KW-KW] —
  dimmed brackets, fixed width so nothing wiggles.
- Editor: scratchpad uses custom confirm, autobackup-draft dialog
  replaced with custom styled dialog.
- Scanlines theme feature removed (performance issue).

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

83 lines
2.5 KiB
JavaScript

import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=4';
describe('Calendar', () => {
afterEach(() => closeAll());
it('button exists', () => {
expect($('#calendar-btn')).toExist();
});
it('opens on button click', async () => {
click('#calendar-btn');
await sleep(250);
expect($('#calendar')).toBeVisible();
});
it('shows month title', async () => {
click('#calendar-btn');
await sleep(250);
expect($('#cal-title')).toExist();
expect($('#cal-title').textContent.length).toBeGreaterThan(3);
});
it('has navigation buttons', async () => {
click('#calendar-btn');
await sleep(200);
expect($('#cal-prev')).toExist();
expect($('#cal-next')).toExist();
expect($('#cal-today')).toExist();
});
it('navigates months', async () => {
click('#calendar-btn');
await sleep(200);
const before = $('#cal-title').textContent;
click('#cal-next');
await sleep(200);
const after = $('#cal-title').textContent;
// Should be different month
expect(after).toBeTruthy();
});
it('today resets to current month', async () => {
click('#calendar-btn');
await sleep(200);
click('#cal-next');
click('#cal-next');
await sleep(200);
click('#cal-today');
await sleep(200);
const months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
expect($('#cal-title').textContent).toContain(months[new Date().getMonth()]);
});
it('closes on close button', async () => {
click('#calendar-btn');
await sleep(200);
click('#cal-close');
await sleep(150);
expect($('#calendar')).toBeHidden();
});
it('preserves month across close/reopen', async () => {
// Open calendar and navigate forward 3 months
click('#calendar-btn');
await sleep(200);
click('#cal-next');
click('#cal-next');
click('#cal-next');
await sleep(200);
const navigatedTitle = $('#cal-title').textContent;
// Close
click('#cal-close');
await sleep(150);
expect($('#calendar')).toBeHidden();
// Reopen — must stay on the navigated month, not jump to today
click('#calendar-btn');
await sleep(200);
expect($('#cal-title').textContent).toBe(navigatedTitle);
});
});