Skip to content

Commit

Permalink
fix: regression for API extending (#2340)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon authored Aug 24, 2023
1 parent c276e64 commit 6c2a411
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 14 deletions.
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')
})
})

0 comments on commit 6c2a411

Please sign in to comment.