test fixes: dialog selector, closeAll scope, copy filter, runner ?v=3
* card-interactions.test.js: group delete tests used `.dialog-ok` (class selector) but the button has `id="dialog-ok"`. querySelector returned null, the click was skipped, the dialog stayed open and blocked every downstream test. Fixed to getElementById. * runner.js closeAll(): added #dialog, #bucket-super-popover (remove), and #gitea-overlay to the cleanup list. A failed test that leaves any of these open no longer poisons the rest of the suite. * runner.js copy handler: when there are failures or flaky tests, the "copy" button now builds the clipboard text from lastResults — only failed + flaky lines (suite name, test name, timing, error, original error for retried). When everything passed, copies the full output as before. lastResults is set in renderResults(). * bucket-context.test.js: move-left test used `[data-bucket]` to find user bucket tabs, which misses super-bucket tiles (they carry `data-bucket-super`). Changed to `[data-bucket-drag]` which is on both regular and super-bucket tiles but not on fixed filters. * context-menu.test.js: make-ticket pre-fill assertion now polls up to 2s for the title input to be populated (async openCreateForm repo-fetch was racing against the immediate assertion). * card-join.test.js: clickJoin sleep bumped from 400ms → 800ms. joinSelectedCards does 3+ serial API calls (fetch bodies, PATCH winner, N×DELETE losers, _reloadAll) which sometimes exceeded the old 400ms window on slow runs. * Runner cache: RUNNER_V bumped from ?v=2 → ?v=3 in loader.js + all 42 test files so the browser picks up the new runner.js content (copy handler, closeAll, retry progress bar) without a hard reload. super-buckets: remember last selection per group * buckets.js: module-scope lastSuperSelection Map tracks the last active member per super-bucket parent. Updated in renderBar() whenever activeBucket matches a group member. tileFor() uses it as a fallback when the user is on a different bucket — the tile shows the last-picked child's name and color instead of reverting to the parent. The dropdown popover also highlights the last selection when no member is currently active. chore: bump version to 0.9.11 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
56c90225cb
commit
c8835825e7
47 files changed
+126
-56
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
define('APP_NAME', 'hyprcrd');
|
||||
define('APP_VERSION', '0.9.10');
|
||||
define('APP_VERSION', '0.9.11');
|
||||
|
||||
// Database path — writable directory, outside webroot
|
||||
define('DB_PATH', __DIR__ . '/data/hyprcrd.db');
|
||||
|
||||
@@ -242,6 +242,12 @@ function updateHeaderTint() {
|
||||
}
|
||||
}
|
||||
|
||||
// Remembers the last active member per super-bucket so the tile doesn't
|
||||
// fall back to the parent label when the user navigates away and comes
|
||||
// back. Keyed by parent bucket id → last selected member id (could be
|
||||
// the parent itself or any child).
|
||||
const lastSuperSelection = new Map();
|
||||
|
||||
function renderBar() {
|
||||
if (!bar) return;
|
||||
const tab = (active) => `bucket-tab ${active ? 'active' : ''} flex items-center gap-1.5 px-2.5 py-1 text-xs border border-t-border text-t-muted hover:border-t-accent hover:text-t-accent transition-colors shrink-0`;
|
||||
@@ -253,14 +259,31 @@ function renderBar() {
|
||||
.filter(b => b.parent_id == parentId)
|
||||
.sort((a, b) => (a.position || 0) - (b.position || 0));
|
||||
|
||||
// Resolve which child / parent to *show* on a super-bucket tile. The
|
||||
// active bucket wins; otherwise fall back to the parent itself.
|
||||
// Track which super-bucket member is active NOW so we can recall it
|
||||
// later when the user comes back from a different bucket.
|
||||
for (const b of topLevel) {
|
||||
const kids = childrenOf(b.id);
|
||||
if (!kids.length) continue;
|
||||
if (state.activeBucket == b.id) lastSuperSelection.set(b.id, b.id);
|
||||
const activeKid = kids.find(c => c.id == state.activeBucket);
|
||||
if (activeKid) lastSuperSelection.set(b.id, activeKid.id);
|
||||
}
|
||||
|
||||
// Resolve which child / parent to *show* on a super-bucket tile.
|
||||
// Priority: currently active member → last selected member → parent.
|
||||
const tileFor = (parent) => {
|
||||
const kids = childrenOf(parent.id);
|
||||
if (!kids.length) return null; // not a super-bucket
|
||||
const activeChild = kids.find(c => c.id == state.activeBucket);
|
||||
if (activeChild) return activeChild;
|
||||
if (state.activeBucket == parent.id) return parent;
|
||||
// Fall back to the last selection rather than the parent
|
||||
const lastId = lastSuperSelection.get(parent.id);
|
||||
if (lastId) {
|
||||
if (lastId == parent.id) return parent;
|
||||
const lastKid = kids.find(c => c.id == lastId);
|
||||
if (lastKid) return lastKid;
|
||||
}
|
||||
return parent;
|
||||
};
|
||||
|
||||
@@ -369,9 +392,13 @@ function renderBar() {
|
||||
pop.style.top = (rect.bottom + 4) + 'px';
|
||||
pop.style.left = rect.left + 'px';
|
||||
|
||||
// Highlight the currently active member OR the last remembered
|
||||
// selection (so the user sees which child was picked last time
|
||||
// even when they're currently on a different bucket).
|
||||
const lastId = lastSuperSelection.get(parentId);
|
||||
const renderEntry = (m) => {
|
||||
const c = m.color || '#64748b';
|
||||
const active = state.activeBucket == m.id;
|
||||
const active = state.activeBucket == m.id || (!members.some(x => x.id == state.activeBucket) && lastId == m.id);
|
||||
const isParent = m.id === parentId;
|
||||
return `<button class="bucket-tab ${active ? 'active' : ''} flex items-center gap-1.5 px-2.5 py-1 text-xs border border-t-border text-t-muted hover:border-t-accent hover:text-t-accent transition-colors w-full" data-bucket="${m.id}" draggable="true" data-bucket-drag="${m.id}" style="border-left:3px solid ${c};${active ? `background:${c};color:var(--t-bg);border-color:${c}` : ''}"><i class="ph ph-folder text-sm"></i><span class="font-pixel text-[10px] flex-1 text-left">${esc(m.name)}</span>${isParent ? '<i class="ph ph-house text-[10px] opacity-60" title="parent"></i>' : ''}</button>`;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, csrf } from './runner.js?v=2';
|
||||
import { describe, it, expect, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('API: Edge Cases', () => {
|
||||
it('create card with special characters in title', async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, csrf } from './runner.js?v=2';
|
||||
import { describe, it, expect, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('API: Cards CRUD', () => {
|
||||
it('GET /api/cards returns array', async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Board Rendering', () => {
|
||||
it('renders card elements', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Bucket Context Menu', () => {
|
||||
afterEach(async () => {
|
||||
@@ -100,7 +100,11 @@ describe('Bucket Context Menu', () => {
|
||||
it('move-left disabled on first bucket', async () => {
|
||||
await window._reloadAll?.();
|
||||
await sleep(200);
|
||||
const tabs = $$('#bucket-bar [data-bucket]').filter(t => !['all', 'current', 'favorites', 'journal', 'none'].includes(t.dataset.bucket));
|
||||
// data-bucket-drag is present on BOTH regular and super-bucket
|
||||
// tiles but not on the fixed filters (all/current/favorites/…).
|
||||
// Using it instead of [data-bucket] avoids missing super-bucket
|
||||
// tiles which carry data-bucket-super instead.
|
||||
const tabs = $$('#bucket-bar [data-bucket-drag]');
|
||||
if (!tabs.length) return;
|
||||
tabs[0].dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, clientX: 100, clientY: 50 }));
|
||||
await sleep(150);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
describe('Bucket Bar', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
describe('Calendar: Day Click', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
describe('Calendar', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, beforeEach, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, beforeEach, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
// ── Helpers ──
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, rightClick, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, rightClick, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
describe('Card: Tag Operations', () => {
|
||||
@@ -320,7 +320,7 @@ describe('Card: Group Delete', () => {
|
||||
expect(msg.textContent).toContain('__test_grpdel_child1__');
|
||||
expect(msg.textContent).toContain('__test_grpdel_child2__');
|
||||
// Confirm the delete
|
||||
const okBtn = dialog.querySelector('.dialog-ok');
|
||||
const okBtn = document.getElementById('dialog-ok');
|
||||
if (okBtn) click(okBtn);
|
||||
await sleep(500);
|
||||
}
|
||||
@@ -364,7 +364,7 @@ describe('Card: Group Delete', () => {
|
||||
await sleep(200);
|
||||
const dialog = document.getElementById('dialog');
|
||||
if (dialog?.classList.contains('open')) {
|
||||
const okBtn = dialog.querySelector('.dialog-ok');
|
||||
const okBtn = document.getElementById('dialog-ok');
|
||||
if (okBtn) click(okBtn);
|
||||
await sleep(500);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, rightClick, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, rightClick, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
async function makeCard(title, body = '') {
|
||||
@@ -26,7 +26,10 @@ async function clickJoin(rightClickTargetEl) {
|
||||
const joinBtn = $$('#ctx-items [data-action="join"]')[0];
|
||||
if (!joinBtn) return false;
|
||||
click(joinBtn);
|
||||
await sleep(400);
|
||||
// joinSelectedCards does: fetch full bodies → PATCH winner → N × DELETE
|
||||
// losers → _reloadAll. That's 3+ serial API calls and a full board
|
||||
// re-render, so 400ms was sometimes too tight on slower runs.
|
||||
await sleep(800);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, rightClick, sleep, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, rightClick, sleep, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Context Menu', () => {
|
||||
afterEach(async () => {
|
||||
@@ -203,9 +203,15 @@ describe('Card: Make ticket (gitea)', () => {
|
||||
expect(form && !form.classList.contains('hidden')).toBe(true);
|
||||
|
||||
// The form must NOT auto-submit — the title and body should be
|
||||
// populated and the form still visible afterwards.
|
||||
// populated and the form still visible afterwards. The pre-fill
|
||||
// happens after an async openCreateForm, so poll until the title
|
||||
// input has our expected value or we time out.
|
||||
const titleInput = document.getElementById('gitea-create-title');
|
||||
const bodyInput = document.getElementById('gitea-create-body');
|
||||
for (let i = 0; i < 40; i++) {
|
||||
if (titleInput?.value === title) break;
|
||||
await sleep(50);
|
||||
}
|
||||
expect(titleInput?.value).toBe(title);
|
||||
expect(bodyInput?.value).toBe(body);
|
||||
// Issues list / detail view should NOT be the foreground
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll } from './runner.js?v=3';
|
||||
import { showDialog } from '../../js/modules/dialog.js';
|
||||
|
||||
describe('Datepicker: Rendering', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Detail: Done Toggle', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
describe('Detail View', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, type, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, type, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Editor: Color Picker', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, type, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, type, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Editor: Empty Title Prevention', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
// Helper: set selection range in textarea
|
||||
function selectRange(textarea, start, end) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Editor: Structure', () => {
|
||||
it('has all elements', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, csrf } from './runner.js?v=2';
|
||||
import { describe, it, expect, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Export: JSON ZIP', () => {
|
||||
it('export endpoint returns ZIP', async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
describe('Favorites Bucket', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
import { state, parseTags, sortedCards } from '../../js/modules/state.js';
|
||||
|
||||
describe('Filtering: Tag AND Logic', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
describe('Gallery', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, pressKey, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, pressKey, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
describe('Help', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, pressKey, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Image Fullscreen Viewer', () => {
|
||||
afterEach(async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
function enableLines() {
|
||||
const gutter = $('#editor-gutter');
|
||||
|
||||
@@ -39,7 +39,7 @@ document.addEventListener('keydown', e => {
|
||||
|
||||
// Must match the `?v=…` suffix used in test files' `from './runner.js?v=…'`
|
||||
// imports — bump both in lock-step to invalidate the runner.js cache.
|
||||
const RUNNER_V = '?v=2';
|
||||
const RUNNER_V = '?v=3';
|
||||
|
||||
function ensureProgressBar() {
|
||||
if (document.getElementById('test-progress')) return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from './runner.js?v=2';
|
||||
import { describe, it, expect } from './runner.js?v=3';
|
||||
import { renderMd } from '../../js/modules/markdown.js';
|
||||
|
||||
describe('Markdown: Blank Lines', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from './runner.js?v=2';
|
||||
import { describe, it, expect } from './runner.js?v=3';
|
||||
import { renderMd, formatTodoItems, stripMd } from '../../js/modules/markdown.js';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, sleep, closeAll } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
describe('Multi-Select', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, $ } from './runner.js?v=2';
|
||||
import { describe, it, expect, $ } from './runner.js?v=3';
|
||||
|
||||
describe('Notification Banner', () => {
|
||||
it('banner element exists', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, type, pressKey, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, type, pressKey, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Quick Capture: Open/Close', () => {
|
||||
afterEach(async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, csrf } from './runner.js?v=2';
|
||||
import { describe, it, expect, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Relay: Push API', () => {
|
||||
it('push without config returns error', async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from './runner.js?v=2';
|
||||
import { describe, it, expect } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
// RRULE is set by CalDAV sync, not via PATCH. Test the data model and existing cards.
|
||||
|
||||
@@ -171,7 +171,7 @@ export function csrf() {
|
||||
}
|
||||
|
||||
export async function closeAll() {
|
||||
for (const id of ['settings-overlay', 'help', 'search', 'calendar', 'gallery', 'detail', 'modal', 'tasks']) {
|
||||
for (const id of ['settings-overlay', 'help', 'search', 'calendar', 'gallery', 'detail', 'modal', 'tasks', 'dialog']) {
|
||||
const el = document.getElementById(id);
|
||||
if (el?.classList.contains('open')) el.classList.remove('open');
|
||||
}
|
||||
@@ -179,6 +179,8 @@ export async function closeAll() {
|
||||
document.querySelector('#select-bar')?.classList.add('hidden');
|
||||
document.querySelector('.bucket-picker')?.remove();
|
||||
document.querySelector('.orphan-lightbox')?.remove();
|
||||
document.getElementById('bucket-super-popover')?.remove();
|
||||
document.getElementById('gitea-overlay')?.classList.remove('open');
|
||||
// Clear multi-select
|
||||
document.querySelectorAll('.card-selected').forEach(el => {
|
||||
el.classList.remove('card-selected');
|
||||
@@ -289,6 +291,7 @@ async function runAll(only = null) {
|
||||
// ── UI Panel ──
|
||||
|
||||
let panel = null;
|
||||
let lastResults = null;
|
||||
|
||||
function createPanel() {
|
||||
if (panel) { panel.remove(); panel = null; }
|
||||
@@ -309,9 +312,35 @@ function createPanel() {
|
||||
document.body.appendChild(panel);
|
||||
panel.querySelector('#test-close-btn').addEventListener('click', close);
|
||||
panel.querySelector('#test-run-btn').addEventListener('click', run);
|
||||
// Copy: when failures exist, only copy the failed + flaky tests so
|
||||
// the user can paste the relevant part without wading through 200+
|
||||
// lines of green. When everything passed, copy the full output.
|
||||
panel.querySelector('#test-copy-btn').addEventListener('click', () => {
|
||||
const output = panel.querySelector('#test-output');
|
||||
const text = output.innerText;
|
||||
let text;
|
||||
if (lastResults) {
|
||||
const hasFailures = lastResults.some(s => s.tests.some(t => t.status === 'fail' || t.retried));
|
||||
if (hasFailures) {
|
||||
const lines = [];
|
||||
for (const s of lastResults) {
|
||||
const relevant = s.tests.filter(t => t.status === 'fail' || t.retried);
|
||||
if (!relevant.length) continue;
|
||||
lines.push(s.name);
|
||||
for (const t of relevant) {
|
||||
const icon = t.status === 'fail' ? '✗' : '⚠';
|
||||
const note = t.retried ? (t.status === 'pass' ? ' (flaky — passed on retry)' : ' (failed twice)') : '';
|
||||
lines.push(`${icon} ${t.name} ${t.time}ms${note}`);
|
||||
if (t.error) lines.push(` ${t.error}`);
|
||||
if (t.originalError) lines.push(` first run: ${t.originalError}`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
text = lines.join('\n').trim();
|
||||
} else {
|
||||
text = panel.querySelector('#test-output').innerText;
|
||||
}
|
||||
} else {
|
||||
text = panel.querySelector('#test-output').innerText;
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
const btn = panel.querySelector('#test-copy-btn');
|
||||
btn.textContent = 'copied';
|
||||
@@ -322,6 +351,7 @@ function createPanel() {
|
||||
}
|
||||
|
||||
function renderResults(results) {
|
||||
lastResults = results;
|
||||
const output = panel.querySelector('#test-output');
|
||||
const summary = panel.querySelector('#test-summary');
|
||||
let total = 0, passed = 0, failed = 0, flaky = 0, totalTime = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, type, pressKey, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, type, pressKey, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
|
||||
describe('Search: Tag + Text Combined', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, type, pressKey, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, type, pressKey, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
describe('Search', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, closeAll, sleep } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, closeAll, sleep } from './runner.js?v=3';
|
||||
|
||||
describe('Settings: Open/Close', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, $ } from './runner.js?v=2';
|
||||
import { describe, it, expect, $ } from './runner.js?v=3';
|
||||
|
||||
describe('App Shell', () => {
|
||||
it('header with logo', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=3';
|
||||
|
||||
// Helper: simulate typing a snippet trigger in the editor body
|
||||
function typeSnippet(bodyEl, trigger) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, csrf } from './runner.js?v=2';
|
||||
import { describe, it, expect, csrf } from './runner.js?v=3';
|
||||
import { state, sortedCards } from '../../js/modules/state.js';
|
||||
|
||||
describe('Sorting: All Modes', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from './runner.js?v=2';
|
||||
import { describe, it, expect } from './runner.js?v=3';
|
||||
import { state, parseTags, sortedCards, getChildren, getGroupCards, getRecent, markRecent, getFavorites, toggleFavorite, isFavorite } from '../../js/modules/state.js';
|
||||
|
||||
describe('State: parseTags', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
// Helper: create a bucket with the given name and return its row.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, closeAll, sleep } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, closeAll, sleep } from './runner.js?v=3';
|
||||
|
||||
describe('Theme', () => {
|
||||
it('CSS custom properties set', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
describe('Toolbar: Filter Toggles', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, afterEach, expect, $, $$, click, type, rightClick, pressKey, sleep, closeAll, csrf } from './runner.js?v=2';
|
||||
import { describe, it, afterEach, expect, $, $$, click, type, rightClick, pressKey, sleep, closeAll, csrf } from './runner.js?v=3';
|
||||
import { state } from '../../js/modules/state.js';
|
||||
|
||||
function ctrlZ() {
|
||||
|
||||
Reference in new issue
Block a user