Files
hyprcrd/public/plugins/tests/image-fullscreen.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

54 lines
2.3 KiB
JavaScript

import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll, csrf } from './runner.js?v=4';
describe('Image Fullscreen Viewer', () => {
afterEach(async () => {
// Close fullscreen if open
document.querySelector('.detail-image-fs-overlay')?.remove();
await closeAll();
});
it('fullscreen overlay has required elements when opened', async () => {
// Create card with image reference
const res = await fetch('api/cards', {
method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrf() },
body: JSON.stringify({ title: '__test_img_fs__', body: '![test](uploads/nonexist.jpg)', color: '#38bdf8' }),
}).then(r => r.json());
await window._reloadAll?.();
await sleep(200);
// Ensure non-split mode
if (!$('#board-preview')?.classList.contains('hidden')) {
click('#board-split-toggle');
await sleep(100);
}
// Open detail
const cardEl = document.querySelector(`[data-id="${res.id}"]`);
if (!cardEl) return;
click(cardEl);
await sleep(300);
// Check that images in detail would get fullscreen handler
// The overlay is created lazily, verify the create function structure
const { bindDetailImageFullscreen } = await import('../../js/modules/detail.js');
expect(typeof bindDetailImageFullscreen).toBe('function');
});
it('overlay structure is correct when created', () => {
// Manually create to test structure
const overlay = document.createElement('div');
overlay.className = 'detail-image-fs-overlay';
overlay.innerHTML = `
<button class="detail-image-fs-close"></button>
<button class="detail-image-fs-prev"></button>
<button class="detail-image-fs-next"></button>
<div class="detail-image-fs-counter"></div>
<div class="detail-image-fs-stage"><img class="detail-image-fs-img" alt=""></div>
`;
expect(overlay.querySelector('.detail-image-fs-close')).toExist();
expect(overlay.querySelector('.detail-image-fs-prev')).toExist();
expect(overlay.querySelector('.detail-image-fs-next')).toExist();
expect(overlay.querySelector('.detail-image-fs-img')).toExist();
});
});