Skip to content

Commit

Permalink
fix: Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kiosion committed Oct 14, 2024
1 parent 042a309 commit 09f7357
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 62 deletions.
84 changes: 46 additions & 38 deletions svelte-app/src/components/sidebar.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { APP_THEMES, BASE_GIT_URL, NAV_LINKS } from '$lib/consts';
import { APP_THEMES, BASE_GIT_URL, BASE_PAGE_TITLE, NAV_LINKS } from '$lib/consts';
import { APP_VERSION } from '$lib/env';
import { t } from '$lib/i18n';
import Settings from '$lib/settings';
Expand Down Expand Up @@ -30,6 +30,8 @@
target: social.internal ? undefined : '_blank'
}));
const name = config instanceof Error ? BASE_PAGE_TITLE : config.name;
const { theme } = Settings;
$: pfp =
Expand All @@ -54,7 +56,7 @@
<h1
class="text-lg font-bold text-neutral-900 transition-colors dark:text-neutral-100"
>
{config.name}
{name}
</h1>
{#if config.handle}
<p
Expand All @@ -66,43 +68,49 @@
</div>
</div>

<div class="flex flex-col items-start justify-center gap-y-2 pb-2">
{#if config.bio}
<p class="pb-2 text-md text-neutral-400 transition-colors dark:text-neutral-200">
{config.bio}
</p>
{/if}
<ul
class="flex select-none flex-col items-start justify-start gap-y-1.5 text-base"
role="list"
>
{#each socials as social}
<li
class="group flex flex-row items-center justify-start gap-x-2 text-neutral-700 transition-colors dark:text-neutral-200"
role="listitem"
{#if config.bio && socials}
<div class="flex flex-col items-start justify-center gap-y-2 pb-2">
{#if config.bio}
<p
class="pb-2 text-md text-neutral-400 transition-colors dark:text-neutral-200"
>
{#if social.url.includes('mailto')}
<EnvelopeSmall
class="mt-px group-hover:hidden group-focus-visible:hidden"
/>
<EnvelopeOpenSmall
class="hidden group-hover:block group-focus-visible:block"
/>
{:else}
<GlobeAmericasSmall
class="mt-px group-hover:hidden group-focus-visible:hidden"
/>
<GlobeAsiaAustraliaSmall
class="mt-px hidden group-hover:block group-focus-visible:block"
/>
{/if}
<Link href={social.url} newtab>
{social.name}
</Link>
</li>
{/each}
</ul>
</div>
{config.bio}
</p>
{/if}
{#if socials}
<ul
class="flex select-none flex-col items-start justify-start gap-y-1.5 text-base"
role="list"
>
{#each socials as social}
<li
class="group flex flex-row items-center justify-start gap-x-2 text-neutral-700 transition-colors dark:text-neutral-200"
role="listitem"
>
{#if social.url.includes('mailto')}
<EnvelopeSmall
class="mt-px group-hover:hidden group-focus-visible:hidden"
/>
<EnvelopeOpenSmall
class="hidden group-hover:block group-focus-visible:block"
/>
{:else}
<GlobeAmericasSmall
class="mt-px group-hover:hidden group-focus-visible:hidden"
/>
<GlobeAsiaAustraliaSmall
class="mt-px hidden group-hover:block group-focus-visible:block"
/>
{/if}
<Link href={social.url} newtab>
{social.name}
</Link>
</li>
{/each}
</ul>
{/if}
</div>
{/if}

<nav class="-mb-2 flex w-full flex-col items-start justify-center gap-y-2">
<p
Expand Down
9 changes: 3 additions & 6 deletions svelte-app/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@
"Experiments": "Experiments",
"Footnotes": "Footnotes",
"French": "French",
"Go back": "Go back",
"Go to footnote": "Go to footnote",
"Go to footnote source": "Go to footnote source",
"Hide stack trace": "Hide stack trace",
"Home": "Home",
"Internal Error": "Internal Error",
"Invalid date": "Invalid date",
"Language": "Language",
"Light": "Light",
"Lights off": "Lights off",
"Lights on": "Lights on",
"Links": "Links",
"Meta": "Meta",
"More": "More",
Expand All @@ -51,9 +49,9 @@
"Reading": "Reading",
"Recent projects": "Recent projects",
"Recent thoughts": "Recent thoughts",
"Reload page": "Reload page",
"Say hello": "Say hello",
"See more": "See more",
"Show stack trace": "Show stack trace",
"Show {amount}": "Show {amount}",
"Skip to content": "Skip to content",
"Social": "Social",
Expand Down Expand Up @@ -107,7 +105,6 @@
"message": "No content."
}
},
"go back": "go back",
"less": "less",
"min left": "min left",
"mins left": "mins left",
Expand Down Expand Up @@ -156,4 +153,4 @@
"{views} views": "{views} views",
"{years} years": "{years} years",
"{year} year": "{year} year"
}
}
9 changes: 3 additions & 6 deletions svelte-app/src/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@
"Experiments": "Expériences",
"Footnotes": "Notes de bas de page",
"French": "Français",
"Go back": "Retour",
"Go to footnote": "Aller à la note de bas de page",
"Go to footnote source": "Aller à la source de la note de bas de page",
"Hide stack trace": "Masquer la trace de la pile",
"Home": "Accueil",
"Internal Error": "Erreur interne",
"Invalid date": "Date invalide",
"Language": "Langue",
"Light": "Clair",
"Lights off": "Lumières éteintes",
"Lights on": "Lumières allumées",
"Links": "Liens",
"Meta": "Plus",
"More": "Plus",
Expand All @@ -51,9 +49,9 @@
"Reading": "Lecture",
"Recent projects": "Projets récents",
"Recent thoughts": "Pensées récentes",
"Reload page": "Recharger la page",
"Say hello": "Dire bonjour",
"See more": "Voir plus",
"Show stack trace": "Afficher la trace de la pile",
"Show {amount}": "Afficher {amount}",
"Skip to content": "Passer au contenu",
"Social": "Social",
Expand Down Expand Up @@ -107,7 +105,6 @@
"message": "Pas de contenu."
}
},
"go back": "retourner",
"less": "moins",
"min left": "min rest",
"mins left": "mins rest",
Expand Down Expand Up @@ -156,4 +153,4 @@
"{views} views": "{views} vues",
"{years} years": "{years} ans",
"{year} year": "{year} an"
}
}
6 changes: 3 additions & 3 deletions svelte-app/tests/routes/error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('handles config load error', async ({ context, page }) => {
timeout: 4000
});

await page.click('text=See more');
await page.click('text=Show more');

expect(await page.textContent('[data-test-id="error-page"]')).toContain(
'Failed to fetch config data.'
Expand All @@ -46,7 +46,7 @@ test('handles project load error', async ({ context, page }) => {
timeout: 4000
});

await page.click('text=See more');
await page.click('text=Show more');

expect(await page.textContent('[data-test-id="error-page"]')).toContain(
'404: Not Found'
Expand All @@ -71,7 +71,7 @@ test('handles post load error', async ({ context, page }) => {
timeout: 4000
});

await page.click('text=See more');
await page.click('text=Show more');

expect(await page.textContent('[data-test-id="error-page"]')).toContain(
'404: Not Found'
Expand Down
2 changes: 1 addition & 1 deletion svelte-app/tests/routes/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('should render error page on failed data fetch', async ({ context, page })
await page.waitForSelector('body.is-loaded');
expect(await page.waitForSelector('[data-test-id="error-page"]')).toBeTruthy();

await page.click('text=See more');
await page.click('text=Show more');
expect(await page.textContent('[data-test-id="error-page"]')).toContain(
'Failed to fetch config data.'
);
Expand Down
5 changes: 2 additions & 3 deletions svelte-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"noEmit": true,
"removeComments": true,
"rootDir": "./",
"moduleResolution": "node",
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
Expand All @@ -27,7 +28,5 @@
"*.js",
"*.ts"
],
"exclude": [
"**/node_modules"
]
"exclude": ["**/node_modules"]
}
8 changes: 3 additions & 5 deletions svelte-app/types/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ export type LocaleKey =
| 'Experiments'
| 'Footnotes'
| 'French'
| 'Go back'
| 'Go to footnote'
| 'Go to footnote source'
| 'Hide stack trace'
| 'Home'
| 'Internal Error'
| 'Invalid date'
| 'Language'
| 'Light'
| 'Lights off'
| 'Lights on'
| 'Links'
| 'Meta'
| 'More'
Expand All @@ -51,9 +49,9 @@ export type LocaleKey =
| 'Reading'
| 'Recent projects'
| 'Recent thoughts'
| 'Reload page'
| 'Say hello'
| 'See more'
| 'Show stack trace'
| 'Show {amount}'
| 'Skip to content'
| 'Social'
Expand All @@ -62,6 +60,7 @@ export type LocaleKey =
| 'Summary'
| 'Switch to English'
| 'Switch to French'
| 'Switch to {opt}'
| 'Tags'
| 'Theme'
| 'Thoughts'
Expand Down Expand Up @@ -90,7 +89,6 @@ export type LocaleKey =
| 'errors.unauthorized.message'
| 'errors.unauthorized.title'
| 'errors.no-content.message'
| 'go back'
| 'less'
| 'min left'
| 'mins left'
Expand Down

0 comments on commit 09f7357

Please sign in to comment.