From e47b4cc822d1ee8138af07783cd893a713a78da1 Mon Sep 17 00:00:00 2001 From: Gulluth Date: Sat, 30 May 2026 08:24:26 -0500 Subject: [PATCH 1/3] fix: typescript in plain js module causing test errors --- docs/architecture.md | 2 +- src/stories/molecules/ExhibitCard.stories.svelte | 5 ++--- src/stories/pages/ExhibitDetail.stories.svelte | 5 ++--- vitest.config.ts | 8 +++++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 9867a32..b8169dd 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -7,7 +7,7 @@ The codebase has two distinct layers that should never blur: | Layer | Location | Who owns it | | ----------- | ------------------------------------------------- | ----------- | | **App** | `src/` — routes, components, data loading, styles | Developer | -| **Content** | `oddments/`, `oddments.config.js` | Site owner | +| **Content** | `oddments/`, `oddments.config.js` | Site owner | SvelteKit prebuilds every route at build time (fully static output to `build/`). There is no server at runtime. diff --git a/src/stories/molecules/ExhibitCard.stories.svelte b/src/stories/molecules/ExhibitCard.stories.svelte index d9e7657..18b897d 100644 --- a/src/stories/molecules/ExhibitCard.stories.svelte +++ b/src/stories/molecules/ExhibitCard.stories.svelte @@ -1,6 +1,5 @@ diff --git a/src/stories/pages/ExhibitDetail.stories.svelte b/src/stories/pages/ExhibitDetail.stories.svelte index 71220ce..5342576 100644 --- a/src/stories/pages/ExhibitDetail.stories.svelte +++ b/src/stories/pages/ExhibitDetail.stories.svelte @@ -1,6 +1,5 @@ diff --git a/vitest.config.ts b/vitest.config.ts index 73773a2..325fd63 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -36,9 +36,8 @@ export default defineConfig({ configDir: path.join(dirname, '.storybook') })], optimizeDeps: { - // The dep-scan of story files fails on `import type` TS syntax, so Vite falls back to - // lazy discovery. Pre-including these prevents the mid-collection optimizer restarts - // that break the storybook browser tests on CI cold starts. + // Pre-including Storybook/theme packages keeps browser-test startup + // stable and avoids mid-collection optimizer restarts on cold caches. include: [ '@storybook/addon-themes', '@skeletonlabs/skeleton-svelte', @@ -50,6 +49,9 @@ export default defineConfig({ browser: { enabled: true, headless: true, + api: { + host: '127.0.0.1', + }, provider: playwright({}), instances: [{ browser: 'chromium' From 711b673b12a6afa33454fada4a5748ddb8a2a2b8 Mon Sep 17 00:00:00 2001 From: Gulluth Date: Sat, 30 May 2026 08:41:32 -0500 Subject: [PATCH 2/3] task: adds category chip to exhibit page - also arranges all chips into a cloud. --- e2e/exhibit.test.ts | 9 +++++++++ src/routes/exhibit/[slug]/+page.svelte | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/e2e/exhibit.test.ts b/e2e/exhibit.test.ts index 61c0c3f..db6a535 100644 --- a/e2e/exhibit.test.ts +++ b/e2e/exhibit.test.ts @@ -34,6 +34,15 @@ test.describe('exhibit detail page', () => { await expect(page.locator('article.card').first()).toBeVisible() }) + test('category chip links to the catalog category filter', async ({ page }) => { + await page.goto('/exhibit/black-hack/') + const categoryChip = page.getByRole('link', { name: 'RPG' }) + await expect(categoryChip).toBeVisible() + await categoryChip.click() + await expect(page).toHaveURL(/\?category=RPG/) + await expect(page.locator('article.card').first()).toBeVisible() + }) + test('renders cover image when cover-image is set', async ({ page }) => { await page.goto(firstExhibitUrl) const img = page.getByRole('img').first() diff --git a/src/routes/exhibit/[slug]/+page.svelte b/src/routes/exhibit/[slug]/+page.svelte index b94a41c..8977c6f 100644 --- a/src/routes/exhibit/[slug]/+page.svelte +++ b/src/routes/exhibit/[slug]/+page.svelte @@ -24,6 +24,9 @@ exhibit['cover-image']?.startsWith('/') ? `${base}${exhibit['cover-image']}` : (exhibit['cover-image'] ?? '') ) const coverStyle = $derived(hasCover ? '' : `background: ${placeholderGradient(exhibit.name ?? exhibit.slug)};`) + const hasMetadataChips = $derived( + exhibit.category.length > 0 || Boolean(exhibit.genre) || Boolean(exhibit.license) || exhibit.tags.length > 0 + ) @@ -92,10 +95,16 @@ {#if exhibit.author} By {exhibit.author}{config.showCost && exhibit.cost ? ` · ${exhibit.cost}` : ''} {/if} - {#if exhibit.genre || exhibit.license} + {#if hasMetadataChips}
+ {#each exhibit.category as cat} + {cat} + {/each} {#if exhibit.genre}{exhibit.genre}{/if} {#if exhibit.license}{exhibit.license}{/if} + {#each exhibit.tags as tag} + {tag} + {/each}
{/if} @@ -137,14 +146,6 @@ {/if} - {#if exhibit.tags.length > 0} -
- {#each exhibit.tags as tag} - {tag} - {/each} -
- {/if} - {#if exhibit['source-url']} Date: Sat, 30 May 2026 08:43:26 -0500 Subject: [PATCH 3/3] chore: update project off deprecated base imports - replaced internal route prefixing with resolve() - replaced internal asset prefxing with asset() --- docs/architecture.md | 6 +++--- src/lib/ExhibitCard.svelte | 9 +++++---- src/lib/ExhibitCard.test.ts | 2 +- src/lib/Footer.svelte | 4 ++-- src/lib/SiteHeader.svelte | 10 +++++----- src/routes/+layout.svelte | 6 +++--- src/routes/+page.svelte | 7 ++++--- src/routes/exhibit/[slug]/+page.svelte | 14 +++++++------- src/test/mocks/app-paths.ts | 7 +++++++ tsconfig.test.json | 9 ++++++++- 10 files changed, 45 insertions(+), 29 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index b8169dd..804b607 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -61,14 +61,14 @@ The `/submit/` route is a generic form UI. It POSTs to `config.submitUrl` — an - **Svelte 5 runes** everywhere: `$state`, `$derived`, `$effect`, `$props`, `$bindable`. No legacy Options API. - Filter state lives in `+page.svelte`. Components receive values and emit changes via `bind:` props; they own no global state. -- All internal links must include the `base` import from `$app/paths` and prefix hrefs: `` href=`${base}/exhibit/${slug}/` ``. -- Local cover image paths need the same `base` prefix since `paths.base` is set in `svelte.config.js`. +- All internal links must use `resolve` from `$app/paths`, for example `href={resolve('/exhibit/my-slug/')}`. +- Local static asset paths must use `asset` from `$app/paths`, since `paths.base` is set in `svelte.config.js`. - `FilterBar` and `TagCloud` accept a `show` prop; `+page.svelte` passes `data.config.showFilterBar` / `data.config.showTagCloud` directly — no `{#if}` wrappers at the call site. - `FilterBar` owns the sort select. Pass `bind:sort` from `+page.svelte`. ### Adding a component test -Tests live next to the component file (`src/lib/Foo.test.ts`). The vitest config aliases `$lib` and mocks `$app/paths` (`base = ''`) so components can be imported in jsdom without the SvelteKit runtime. +Tests live next to the component file (`src/lib/Foo.test.ts`). The vitest config aliases `$lib` and mocks `$app/paths` so components can be imported in jsdom without the SvelteKit runtime. ```ts import { render, screen } from '@testing-library/svelte' diff --git a/src/lib/ExhibitCard.svelte b/src/lib/ExhibitCard.svelte index 7765bf1..a058558 100644 --- a/src/lib/ExhibitCard.svelte +++ b/src/lib/ExhibitCard.svelte @@ -1,6 +1,6 @@
{#if hasCover && orientation !== 'none'} @@ -44,7 +45,7 @@

- {exhibit.name}

diff --git a/src/lib/ExhibitCard.test.ts b/src/lib/ExhibitCard.test.ts index 4549ad0..467a86c 100644 --- a/src/lib/ExhibitCard.test.ts +++ b/src/lib/ExhibitCard.test.ts @@ -138,6 +138,6 @@ test("local cover-image gets base prefix", () => { exhibit: makeExhibit({ "cover-image": "/covers/game.webp", name: "Local Cover" }), }); const img = screen.getByRole("img", { name: "Local Cover" }); - // base is '' in test mock, so the src should be '/covers/game.webp' + // asset() returns the input path in the test mock. expect(img).toHaveAttribute("src", "/covers/game.webp"); }); diff --git a/src/lib/Footer.svelte b/src/lib/Footer.svelte index c51bb3f..d4ab203 100644 --- a/src/lib/Footer.svelte +++ b/src/lib/Footer.svelte @@ -1,5 +1,5 @@
@@ -31,7 +31,7 @@
{#if config.showSubmitForm} - + Submit {/if} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 88a994f..932da2e 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,6 +1,6 @@ - + {#if config.customCss} - + {/if} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 837c195..b9c54e8 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,6 +1,6 @@