5830e4cfd2
Deploy / deploy (push) Successful in 48s
Opening versicle; Ps 66 (fixed, no antiphon at all); the weekday- variable psalm groups (Ps 50 plus 1-2 more, framed by their own antiphon each, wholesale-substituted by Sunday's Ps 50+117-share-one- antiphon shape); the weekday OT canticle; the Laudate psalms (148-150) under one more shared antiphon; the weekday chapter/responsory/hymn/ versicle bundle; the Benedictus (framed by a day-resolved antiphon, same incipit-or-full/full-repeat shape as Compline's Nunc Dimittis); the Kyrie/Pater-noster short litany; the day's collect(s) — winner plus one per commemoration, via the new getDayCollects; the four Tridentine suffrages (omitted on a Double-or-higher feast); the conclusio; the closing versicle (the silent Our Father that precedes it isn't re-rendered, its text having already appeared once at the short litany); and the closing Marian antiphon, reusing Compline's own mechanism exactly. Known, deliberate gap, not yet fixed: the psalmody doesn't model the Commune/feast override real practice applies on a Semiduplex-or-higher day (substituting an entirely different psalm+canticle set) — every day currently gets the plain ferial weekday distribution regardless of who wins. That's a separate, larger propers-authoring task (a full Common-of-Saints psalm set per Common). Also a simplification in getDayCollects: each collect in a multi- collect day renders as its own complete "Let us pray ... Amen." block, rather than the more compressed real form (one "Let us pray," only the last collect's doxology). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
89 lines
3.3 KiB
TypeScript
89 lines
3.3 KiB
TypeScript
import { beforeEach, describe, expect, it } from 'vitest';
|
|
import { mountShell } from '../../src/ui/shell';
|
|
import { setDate, setSelectedHour, setLanguages } from '../../src/app-state';
|
|
|
|
describe('shell', () => {
|
|
// app-state is a module-level singleton, so each test must reset every
|
|
// field it might have mutated — not just the one it cares about — or
|
|
// state leaks across tests in this file.
|
|
beforeEach(() => {
|
|
document.body.innerHTML = '<div id="app"></div>';
|
|
setDate('2026-08-09');
|
|
setSelectedHour('prime');
|
|
setLanguages(['en']);
|
|
window.history.replaceState(null, '', '/vu/2026-08-09/prime');
|
|
});
|
|
|
|
it('renders the day nav, all 8 hours, and Prime content by default', () => {
|
|
const root = document.getElementById('app')!;
|
|
mountShell(root);
|
|
|
|
expect(root.querySelector('.day-nav-date')?.textContent).toContain('August 9, 2026');
|
|
|
|
const hourNames = Array.from(root.querySelectorAll('.hour-name')).map((el) => el.textContent);
|
|
expect(hourNames).toEqual([
|
|
'Prime',
|
|
'Compline',
|
|
'Terce',
|
|
'Sext',
|
|
'None',
|
|
'Lauds',
|
|
'Vespers',
|
|
'Matins',
|
|
]);
|
|
|
|
expect(root.querySelector('.hour-item.is-selected .hour-name')?.textContent).toBe('Prime');
|
|
expect(root.querySelector('.hour-view h2')?.textContent).toBe('Prime');
|
|
expect(root.querySelectorAll('.ordo-part-psalm').length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('switches to a not-yet-built hour and shows the pending message', () => {
|
|
const root = document.getElementById('app')!;
|
|
mountShell(root);
|
|
|
|
const vespersBtn = Array.from(root.querySelectorAll<HTMLButtonElement>('[data-hour]')).find(
|
|
(btn) => btn.dataset.hour === 'vespers',
|
|
);
|
|
vespersBtn?.click();
|
|
|
|
expect(root.querySelector('.hour-view h2')?.textContent).toBe('Vespers');
|
|
expect(root.querySelector('.hour-view-pending')).not.toBeNull();
|
|
});
|
|
|
|
it('switches to Compline and shows its real content, not the pending message', () => {
|
|
const root = document.getElementById('app')!;
|
|
mountShell(root);
|
|
|
|
const complineBtn = Array.from(root.querySelectorAll<HTMLButtonElement>('[data-hour]')).find(
|
|
(btn) => btn.dataset.hour === 'compline',
|
|
);
|
|
complineBtn?.click();
|
|
|
|
expect(root.querySelector('.hour-view h2')?.textContent).toBe('Compline');
|
|
expect(root.querySelector('.hour-view-pending')).toBeNull();
|
|
expect(root.querySelectorAll('.ordo-part-psalm').length).toBe(3);
|
|
});
|
|
|
|
it('moving to the next day updates the displayed date', () => {
|
|
const root = document.getElementById('app')!;
|
|
mountShell(root);
|
|
|
|
root.querySelector<HTMLButtonElement>('[data-action="next"]')?.click();
|
|
expect(root.querySelector('.day-nav-date')?.textContent).toContain('August 10, 2026');
|
|
});
|
|
|
|
it('switching to two-language mode renders two columns per verse', () => {
|
|
const root = document.getElementById('app')!;
|
|
mountShell(root);
|
|
|
|
const bilingualBtn = Array.from(root.querySelectorAll<HTMLButtonElement>('[data-langs]')).find(
|
|
(btn) => btn.dataset.langs === 'en,la',
|
|
);
|
|
bilingualBtn?.click();
|
|
|
|
const firstVerseColumns = root.querySelector('.psalm-verse .lang-columns');
|
|
expect(firstVerseColumns?.classList.contains('lang-columns-2')).toBe(true);
|
|
expect(firstVerseColumns?.querySelectorAll('.lang-column').length).toBe(2);
|
|
});
|
|
});
|