Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions components/src/ChartList/ChartList.stories.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import { within, expect } from 'storybook/test';
import { resolve } from '$app/paths';

import DesignTokens from '../DesignTokens/DesignTokens.svelte';

Expand Down Expand Up @@ -35,7 +34,7 @@
testCharts.forEach((c) => {
const el = canvas.getByText(c.title);
expect(el).toBeInstanceOf(HTMLAnchorElement);
expect(el.getAttribute('href')).toBe(resolve('/' + c.slug));
expect(el.getAttribute('href')).toBe('/' + c.slug);
});
});

Expand Down Expand Up @@ -68,13 +67,13 @@
testCharts.forEach((c) => {
const el = canvas.getByText(c.title);
expect(el).toBeInstanceOf(HTMLAnchorElement);
expect(el.getAttribute('href')).toBe(resolve('/' + c.slug));
expect(el.getAttribute('href')).toBe(`/${c.slug}`);
});
});

await step('Embed paths render using project-relative URLs', async () => {
await step('Embed paths render with .html prefix', async () => {
testCharts.forEach((c) => {
const el = canvas.getByDisplayValue(resolve('/' + c.slug));
const el = canvas.getByDisplayValue(`/${c.slug}.html`);
expect(el).toBeTruthy();
});
});
Expand Down
11 changes: 5 additions & 6 deletions components/src/ChartList/ChartList.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<script lang="ts">
import { dev } from '$app/environment';
import { resolve } from '$app/paths';
import type { RouteId } from '$app/types';

type ProjectPrefix = 'p' | 't';
type ProjectIdentifier = `${ProjectPrefix}${number}: ${string}`;
Expand Down Expand Up @@ -31,14 +29,15 @@
</thead>
<tbody>
{#each charts as chart}
{@const route = `/${chart.slug}/` as RouteId}
{@const fullUrl = baseUrl ? `${baseUrl}/${chart.slug}.html` : resolve(route)}
{@const route = `/${chart.slug}`}
<tr>
<td>
<a href={dev ? resolve(route) : fullUrl}>{chart.title}</a>
<a rel="external" href={dev ? route : `./${chart.slug}.html`}>
{chart.title}
</a>
</td>
<td>
<input type="text" value={fullUrl} />
<input type="text" value={`${baseUrl ?? ''}${route}.html`} />
</td>
</tr>
{/each}
Expand Down