forked from nuxt-modules/i18n
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: refactor and merge similar tests (nuxt-modules#2886)
- Loading branch information
1 parent
b09f118
commit e234134
Showing
24 changed files
with
100 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...rent_domains_multi_locales_prefix.spec.ts → ...rent_domains_multi_locales_prefix.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
...lti_locales_prefix_except_default.spec.ts → ...lti_locales_prefix_except_default.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { test, expect } from 'vitest' | ||
import { fileURLToPath } from 'node:url' | ||
import { setup, url, createPage } from '../utils' | ||
import { getText } from '../helper' | ||
|
||
await setup({ | ||
rootDir: fileURLToPath(new URL(`../fixtures/different_domains`, import.meta.url)), | ||
nuxtConfig: { | ||
i18n: { | ||
defaultLocale: 'fr', | ||
differentDomains: true, | ||
locales: [ | ||
{ | ||
code: 'en', | ||
domain: 'en.nuxt-app.localhost' | ||
}, | ||
{ | ||
code: 'fr', | ||
domain: 'fr.nuxt-app.localhost' | ||
}, | ||
{ | ||
code: 'nl', | ||
domain: 'localhost' | ||
} | ||
], | ||
strategy: 'no_prefix' | ||
}, | ||
ssr: false | ||
} | ||
}) | ||
|
||
test('(#2313) detection locale from domain', async () => { | ||
async function assertDifferentDomain(locale: string, browserLocale = 'en') { | ||
const page = await createPage(url('/'), { | ||
extraHTTPHeaders: { | ||
'X-Forwarded-Host': `${locale}.nuxt-app.localhost` | ||
}, | ||
locale: browserLocale | ||
}) | ||
|
||
expect(await getText(page, '#lang-switcher-current-locale code')).toEqual(locale) | ||
await page.close() | ||
} | ||
|
||
await assertDifferentDomain('en') | ||
await assertDifferentDomain('fr', 'fr') | ||
}) | ||
|
||
test('(#2334) should not redirect loop, when use no_prefix and ssr: false', async () => { | ||
const page = await createPage(url('/'), { locale: 'fr' }) | ||
|
||
expect(await getText(page, '#lang-switcher-current-locale code')).toEqual('fr') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
specs/experimental/auto_import_translation_functions.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
specs/fixtures/basic_usage/pages/experimental/auto-import-translation-functions.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script setup lang="ts"> | ||
console.log(`[autoImportTranslationFunctions][default]: ${$t('welcome')}`) | ||
console.log(`[autoImportTranslationFunctions][fr]: ${$t('welcome', 1, { locale: 'fr' })}`) | ||
</script> | ||
|
||
<template> | ||
<div>See console logs if experimental feature has logged without error</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
specs/fixtures/locale_codes/layers/i18n-layer/nuxt.config.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.