Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Remove hard-coded English aria-labels from About page links (#5842)

Anand Rajaram0d99ae907c12
diff --git a/frontend/src/pages/about.vue b/frontend/src/pages/about.vue
index 71cbef330..97f9492f5 100644
--- a/frontend/src/pages/about.vue
+++ b/frontend/src/pages/about.vue
@@ -121,14 +121,12 @@ useHead({
<i18n-t scope="global" keypath="externalSourcesPage.new.content" tag="p">
<template #issue>
- <VLink
- aria-label="issue"
- href="https://github.com/WordPress/openverse/issues"
- >{{ $t("externalSourcesPage.new.issue") }}</VLink
- >
+ <VLink href="https://github.com/WordPress/openverse/issues">{{
+ $t("externalSourcesPage.new.issue")
+ }}</VLink>
</template>
<template #email>
- <VLink aria-label="email" href="mailto:[email protected]">{{
+ <VLink href="mailto:[email protected]">{{
$t("externalSourcesPage.new.email")
}}</VLink>
</template>
diff --git a/frontend/test/unit/specs/pages/about.spec.ts b/frontend/test/unit/specs/pages/about.spec.ts
new file mode 100644
index 000000000..ab6947eac
--- /dev/null
+++ b/frontend/test/unit/specs/pages/about.spec.ts
@@ -0,0 +1,45 @@
+import { createI18n } from "vue-i18n"
+import { describe, expect, it } from "vitest"
+import { screen } from "@testing-library/vue"
+import { renderSuspended } from "@nuxt/test-utils/runtime"
+import messages from "~~/i18n/locales/en.json"
+
+import AboutPage from "~/pages/about.vue"
+
+const hindi = {
+ "externalSourcesPage.new.issue": "मुद्दा",
+ "externalSourcesPage.new.email": "ईमेल",
+}
+
+const renderInLocale = (locale: "en" | "hi") => {
+ const i18n = createI18n({
+ locale,
+ fallbackLocale: "en",
+ legacy: false,
+ messages: { en: messages, hi: hindi },
+ })
+ return renderSuspended(AboutPage, { global: { plugins: [i18n] } })
+}
+
+describe("About page", () => {
+ it.each`
+ locale | issue | email
+ ${"en"} | ${"issue"} | ${"email"}
+ ${"hi"} | ${"मुद्दा"} | ${"ईमेल"}
+ `(
+ "external source links are named by their visible text in $locale",
+ async ({ locale, issue, email }) => {
+ await renderInLocale(locale)
+
+ for (const [text, href] of [
+ [issue, "https://github.com/WordPress/openverse/issues"],
+ [email, "mailto:[email protected]"],
+ ]) {
+ const link = screen.getByRole("link", { name: text })
+ expect(link.getAttribute("href")).toEqual(href)
+ expect(link.textContent?.trim()).toEqual(text)
+ expect(link.hasAttribute("aria-label")).toBe(false)
+ }
+ }
+ )
+})