fix(i18n): render locale switch as links
Use locale-prefixed <Link> elements for EN/DE so language switching works even when client-side hydration is broken. Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
@@ -4,15 +4,15 @@ test.describe("i18n routing", () => {
|
||||
test("language switcher navigates between locales", async ({ page }) => {
|
||||
await page.goto("/en", { waitUntil: "domcontentloaded" });
|
||||
|
||||
// Buttons have aria-labels; click the DE switcher.
|
||||
const deButton = page.getByRole("button", { name: "Sprache auf Deutsch umstellen" });
|
||||
if (await deButton.count()) {
|
||||
// Locale switchers are links (work even without hydration)
|
||||
const deLink = page.getByRole("link", { name: "Sprache auf Deutsch umstellen" });
|
||||
if (await deLink.count()) {
|
||||
// Verify an EN label is present before switching (nav.home)
|
||||
await expect(page.getByRole("link", { name: "Home" })).toBeVisible();
|
||||
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/de(\/|$)/, { timeout: 30000 }),
|
||||
deButton.click(),
|
||||
deLink.click(),
|
||||
]);
|
||||
|
||||
// Verify the nav label updates after switching
|
||||
|
||||
Reference in New Issue
Block a user