tests: rebind runner to Ctrl+Shift+Alt+T and cover recent fixes

Plugin loader + runner shortcut moves to Ctrl+Shift+Alt+T (the old
Ctrl+Shift+T conflicts with the browser "reopen closed tab"). Loader
now imports runner.js *without* the cache-busting query so it picks
up the same module instance the test files register their suites
into — previously the shortcut opened a fresh runner with an empty
suites array and reported 0/0 passed.

New / fixed coverage:
- card-interactions: favorite toggle assertion is now case-insensitive
  (context menu was capitalized to "Unfavorite"/"Favorite" earlier);
  done-badge test guards against state.hideDone / hideTagged that would
  filter the test card off the board; new test for the always-on
  Mark done / Unmark done toggle on a card without due_date.
- context-menu: copy-text action exists; copy-text strips fenced code
  blocks, image markdown and inline #tags. Mocks navigator.clipboard
  via Object.defineProperty so the assertion works without a focused
  / secure-context clipboard.
- export: round-trip preserves a custom bucket color (covers the import
  handler regression that was wiping bucket colors on every test run).
- theme: design preset selection persists in localStorage across
  settings open/close, refreshPresetSelect ignores unknown keys.
  afterEach restores both hyprcrd-design-active-preset and
  hyprcrd-design so a test run can't permanently swap the user's
  design.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
thandClaude Opus 4.6 committed 2026-04-11 18:50:25 +02:00
1 parent ccd0477841
commit 43c15b81a3
8 files changed
+241 -13

No files matched your search

+24
View File
@@ -114,4 +114,28 @@ describe('Export: Backup Integrity', () => {
expect(found.tags).toContain('beta');
expect(found.due_date).toBe('2099-12-31');
});
it('export→import preserves bucket color', async () => {
// Create a bucket with a recognizable name and patch a custom color onto it
const b = await fetch('api/buckets', {
method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrf() },
body: JSON.stringify({ name: '__test_bucket_color__' }),
}).then(r => r.json());
await fetch(`api/buckets/${b.id}`, {
method: 'PATCH', headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrf() },
body: JSON.stringify({ color: '#fb7185' }),
});
// Round-trip through export → replace-import
const blob = await fetch('api/export').then(r => r.blob());
const form = new FormData();
form.append('file', blob, 'roundtrip.zip');
await fetch('api/import', { method: 'POST', body: form, headers: { 'X-CSRF-Token': csrf() } });
// The bucket must reappear with the same custom color (not the schema default)
const buckets = await fetch('api/buckets').then(r => r.json());
const found = buckets.find(x => x.name === '__test_bucket_color__');
expect(found).toExist();
expect(found.color).toBe('#fb7185');
});
});