plugin infrastruktur

This commit is contained in:
th committed 2026-04-10 07:57:53 +02:00
1 parent dd2a995f6c
commit 1545b90f39
43 files changed

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
import { describe, it, afterEach, expect, $, $$, rightClick, sleep } from './runner.js';
describe('Context Menu', () => {
afterEach(async () => {
document.dispatchEvent(new MouseEvent('click'));
await sleep(50);
});
it('opens on card right-click', async () => {
const card = $('#board [data-id]');
if (!card) return;
rightClick(card);
await sleep(150);
expect($('#ctx-menu').classList.contains('hidden')).toBe(false);
});
it('has all standard actions', async () => {
const card = $('#board [data-id]');
if (!card) return;
rightClick(card);
await sleep(150);
const actions = $$('#ctx-items [data-action]').map(b => b.dataset.action);
for (const a of ['open', 'edit', 'duplicate', 'due-date', 'save-md', 'push-relay', 'favorite', 'color', 'bucket', 'tags', 'delete']) {
expect(actions).toContain(a);
}
});
it('has color submenu with presets', async () => {
const card = $('#board [data-id]');
if (!card) return;
rightClick(card);
await sleep(100);
const colors = $$('#ctx-color-grid [data-ctx-color]');
expect(colors.length).toBeGreaterThan(5);
});
it('has tag submenu with input', async () => {
const card = $('#board [data-id]');
if (!card) return;
rightClick(card);
await sleep(100);
expect($('#ctx-tag-input')).toExist();
expect($('#ctx-tag-list')).toExist();
});
it('closes on document click', async () => {
const card = $('#board [data-id]');
if (!card) return;
rightClick(card);
await sleep(100);
document.dispatchEvent(new MouseEvent('click'));
await sleep(50);
expect($('#ctx-menu').classList.contains('hidden')).toBe(true);
});
});