Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: regression for API extending #2340

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"unplugin": "^1.3.2",
"unstorage": "^1.5.0",
"vue-i18n": "9.3.0-beta.26",
"vue-i18n-routing": "^0.13.3"
"vue-i18n-routing": "^0.13.4"
},
"devDependencies": {
"@babel/parser": "^7.22.7",
Expand Down
26 changes: 13 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions specs/fixtures/issues/2338/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<NuxtPage />
</div>
</template>
9 changes: 9 additions & 0 deletions specs/fixtures/issues/2338/components/Hello.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<code id="local">{{ localeProperties }}</code>
</template>

<script setup lang="ts">
const { localeProperties } = useI18n({
useScope: 'local'
})
</script>
10 changes: 10 additions & 0 deletions specs/fixtures/issues/2338/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ['@nuxtjs/i18n'],
i18n: {
locales: [{ code: 'nl', iso: 'nl-NL' }],
debug: false,
defaultLocale: 'nl',
strategy: 'prefix_except_default'
}
})
14 changes: 14 additions & 0 deletions specs/fixtures/issues/2338/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "nuxt3-test-issues-2338",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"@nuxtjs/i18n": "latest",
"nuxt": "latest"
}
}
10 changes: 10 additions & 0 deletions specs/fixtures/issues/2338/pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>
<Hello />
<code id="global">{{ localeProperties }}</code>
</div>
</template>

<script setup lang="ts">
const { localeProperties } = useI18n()
</script>
21 changes: 21 additions & 0 deletions specs/issues/2338.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { test, expect, describe } from 'vitest'
import { fileURLToPath } from 'node:url'
import { setup, url, createPage } from '../utils'
import { getData } from '../helper'

describe('#2338', async () => {
await setup({
rootDir: fileURLToPath(new URL(`../fixtures/issues/2338`, import.meta.url))
})

test('should be extened API', async () => {
const home = url('/')
const page = await createPage()
await page.goto(home)

const globalData = await getData(page, '#global')
expect(globalData.code).toEqual('nl')
const localeData = await getData(page, '#local')
expect(localeData.code).toEqual('nl')
})
})