Skip to content

Commit 1684495

Browse files
committed
feat: support custom blocks without i18n natively
1 parent df2bfa2 commit 1684495

File tree

8 files changed

+2
-184
lines changed

8 files changed

+2
-184
lines changed

e2e/__projects__/basic/components/I18nJSONFromSrc.vue

Lines changed: 0 additions & 11 deletions
This file was deleted.

e2e/__projects__/basic/components/I18nJSONInline.vue

Lines changed: 0 additions & 17 deletions
This file was deleted.

e2e/__projects__/basic/components/I18nMergingMultipleBlocks.vue

Lines changed: 0 additions & 24 deletions
This file was deleted.

e2e/__projects__/basic/components/I18nYamlInline.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.

e2e/__projects__/basic/components/locales.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

e2e/__projects__/basic/test.js

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { mount, createLocalVue } from '@vue/test-utils'
1+
import { mount } from '@vue/test-utils'
22
import TypeScript from './components/TypeScript.vue'
33
import { resolve } from 'path'
44
import { readFileSync } from 'fs'
5-
import VueI18n from 'vue-i18n'
65
import jestVue from 'vue-jest'
76
import RenderFunction from './components/RenderFunction.vue'
87
import Jade from './components/Jade.vue'
@@ -13,10 +12,6 @@ import { randomExport } from './components/NamedExport.vue'
1312
import Coffee from './components/Coffee.vue'
1413
import CoffeeScript from './components/CoffeeScript.vue'
1514
import FunctionalSFCParent from './components/FunctionalSFCParent.vue'
16-
import I18nJSONInline from './components/I18nJSONInline.vue'
17-
import I18nJSONFromSrc from './components/I18nJSONFromSrc.vue'
18-
import I18nYamlInline from './components/I18nYamlInline.vue'
19-
import I18nMergingMultipleBlocks from './components/I18nMergingMultipleBlocks.vue'
2015
import NoScript from './components/NoScript.vue'
2116
import Pug from './components/Pug.vue'
2217
import PugRelative from './components/PugRelativeExtends.vue'
@@ -130,42 +125,3 @@ test('processes SFC with no template', () => {
130125
const wrapper = mount(RenderFunction)
131126
expect(wrapper.is('section')).toBe(true)
132127
})
133-
134-
describe('I18n Processor', () => {
135-
const setup = (opts = { locale: 'en' }) => {
136-
const localVue = createLocalVue()
137-
localVue.use(VueI18n)
138-
const i18n = new VueI18n(opts)
139-
return { i18n, localVue }
140-
}
141-
142-
test('processes SFC with i18n JSON inline custom block', () => {
143-
const { i18n, localVue } = setup()
144-
const wrapper = mount(I18nJSONInline, { i18n, localVue })
145-
expect(wrapper.text()).toBe('Hello i18n in SFC!')
146-
expect(wrapper).toMatchSnapshot()
147-
})
148-
149-
test('processes SFC with i18n JSON in external src attribute', () => {
150-
const { i18n, localVue } = setup()
151-
const wrapper = mount(I18nJSONFromSrc, { i18n, localVue })
152-
expect(wrapper.text()).toBe('Hello i18n in SFC!')
153-
expect(wrapper).toMatchSnapshot()
154-
})
155-
156-
test('processes SFC with i18n Yaml Inline', () => {
157-
const { i18n, localVue } = setup()
158-
const wrapper = mount(I18nYamlInline, { i18n, localVue })
159-
expect(wrapper.text()).toBe('hello world!')
160-
expect(wrapper).toMatchSnapshot()
161-
})
162-
163-
test('merges data blocks', () => {
164-
const { i18n, localVue } = setup()
165-
const wrapper = mount(I18nMergingMultipleBlocks, { i18n, localVue })
166-
expect(wrapper.text()).toBe('hello world!')
167-
expect(typeof wrapper.vm.$t('additionalKey')).toEqual('string')
168-
169-
expect(wrapper).toMatchSnapshot()
170-
})
171-
})

lib/constants.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module.exports = {
22
vueOptionsNamespace: '__options__',
33
defaultVueJestConfig: {
4-
transform: {
5-
i18n: require('./transformers/i18n')
6-
}
4+
transform: {}
75
}
86
}

lib/transformers/i18n.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)