Skip to content

Commit

Permalink
refactor: code style, types and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviareichl committed Sep 2, 2024
1 parent 532e549 commit 4393015
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 22 deletions.
4 changes: 2 additions & 2 deletions components/locale-switcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ const labels = computed(() => {
<span class="sr-only">
{{ t("LocaleSwitcher.switch-locale", { locale: labels.of(locale) }) }}
</span>
<span aria-hidden="true">{{ locale.toUpperCase() }}</span>
<span aria-hidden="true">{{ locale }}</span>
</NuxtLink>
<span v-else class="cursor-default font-semibold">
<span class="sr-only">
{{ t("LocaleSwitcher.current-locale", { locale: labels.of(locale) }) }}
</span>
<span aria-hidden="true">{{ locale.toUpperCase() }}</span>
<span aria-hidden="true">{{ locale }}</span>
</span>
</template>
</div>
Expand Down
2 changes: 1 addition & 1 deletion config/i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type Locale = (typeof locales)[number];
export const defaultLocale: Locale = project.defaultLocale;

export const localesMap = {
en: { code: "en", iso: "en", files: ["en/common.json", "en/project.json"] },
en: { code: "en", iso: "en", files: ["en/common.json", "en/project.json", "en/crm.json"] },
} satisfies Record<Locale, LocaleObject>;

export type Messages = typeof en & typeof projectEn;
Expand Down
1 change: 0 additions & 1 deletion e2e/lib/fixtures/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export async function createI18n(_page: Page, locale = defaultLocale): Promise<I
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const messages = { ..._project.default, ..._messages.default } as Messages;

// @ts-expect-error Only messages for single locale provided.
return _createI18n({
legacy: false,
locale,
Expand Down
8 changes: 1 addition & 7 deletions e2e/tests/app/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,10 @@ test("should set document title on not-found page", async ({ createI18n, page })
await expect(page).toHaveTitle(
[i18nEn.t("NotFoundPage.meta.title"), i18nEn.t("Metadata.name")].join(" | "),
);

const i18nDe = await createI18n("de");
await page.goto("/de/unknown");
await expect(page).toHaveTitle(
[i18nDe.t("NotFoundPage.meta.title"), i18nDe.t("Metadata.name")].join(" | "),
);
});

test("should disallow indexing of not-found page", async ({ page }) => {
for (const pathname of ["/unknown", "/de/unknown"]) {
for (const pathname of ["/unknown"]) {
await page.goto(pathname);

const ogTitle = page.locator('meta[name="robots"]');
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/pages/imprint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { locales } from "@/config/i18n.config";
import { expect, test } from "@/e2e/lib/test";

test.describe("imprint page", () => {
test.skip("should have document title", async ({ createImprintPage }) => {
test("should have document title", async ({ createImprintPage }) => {
for (const locale of locales) {
const { i18n, imprintPage } = await createImprintPage(locale);
await imprintPage.goto();
Expand All @@ -13,7 +13,7 @@ test.describe("imprint page", () => {
}
});

test.skip("should have imprint text", async ({ createImprintPage }) => {
test("should have imprint text", async ({ createImprintPage }) => {
const imprints = {
de: "Offenlegung",
en: "Legal disclosure",
Expand All @@ -27,7 +27,7 @@ test.describe("imprint page", () => {
}
});

test.skip("should not have any automatically detectable accessibility issues", async ({
test("should not have any automatically detectable accessibility issues", async ({
createAccessibilityScanner,
createImprintPage,
}) => {
Expand Down
12 changes: 6 additions & 6 deletions messages/en/project.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"__cms__": true,
"Metadata": {
"name": "MAMEMS",
"shortName": "MAMEMS",
"description": "Welcome to the website of the \"Mount Athos in Medieval Eastern Mediterranean Society: Contextualizing the History of a Monastic Republic (ca. 850-1550)\" (MAMEMS) project, funded by a Starting Grant of the European Research Council and hosted first at the Johannes Gutenberg University of Mainz (2020-2024) and now at the Ludwig Maximilian University of Munich (from 2024). MAMEMS constitutes the first comprehensive examination of the monastic communities of Mount Athos as independent actors in medieval Eastern Mediterranean society."
}
"__cms__": true,
"Metadata": {
"name": "MAMEMS",
"shortName": "MAMEMS",
"description": "Welcome to the website of the \"Mount Athos in Medieval Eastern Mediterranean Society: Contextualizing the History of a Monastic Republic (ca. 850-1550)\" (MAMEMS) project, funded by a Starting Grant of the European Research Council and hosted first at the Johannes Gutenberg University of Mainz (2020-2024) and now at the Ludwig Maximilian University of Munich (from 2024). MAMEMS constitutes the first comprehensive examination of the monastic communities of Mount Athos as independent actors in medieval Eastern Mediterranean society."
}
}
4 changes: 2 additions & 2 deletions project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
"imprint": "acdh-ch",
"logos": {
"light": "/assets/images/mamems_logo.png",
"dark": "/assets/images/mamems_logo_inv.png",
"dark": "/assets/images/mamens_logo_inv.png",
"withTextLight": "/assets/images/mamems_logo.png",
"withTextDark": "/assets/images/mamems_logo_inv.png"
"withTextDark": "/assets/images/mamens_logo_inv.png"
},
"twitter": "@openatlas_eu"
}

0 comments on commit 4393015

Please sign in to comment.