Skip to content

Commit a71a99b

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

File tree

10 files changed

+2
-220
lines changed

10 files changed

+2
-220
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ vue-jest compiles the script and template of SFCs into a JavaScript file that Je
6363
- **typescript** (`lang="ts"`, `lang="typescript"`)
6464
- **coffeescript** (`lang="coffee"`, `lang="coffeescript"`)
6565

66-
### Natively Supported Vue custom blocks
67-
68-
- **vue-i18n** (`<i18n lang="json">`, `<i18n lang="yaml">`)
69-
7066
### Global Jest options
7167

7268
You can change the behavior of `vue-jest` by using `jest.globals`.

e2e/__projects__/basic/__snapshots__/test.js.snap

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`I18n Processor merges data blocks 1`] = `
4-
VueWrapper {
5-
"_emitted": Object {},
6-
"_emittedByOrder": Array [],
7-
"isFunctionalComponent": undefined,
8-
}
9-
`;
10-
11-
exports[`I18n Processor processes SFC with i18n JSON in external src attribute 1`] = `
12-
VueWrapper {
13-
"_emitted": Object {},
14-
"_emittedByOrder": Array [],
15-
"isFunctionalComponent": undefined,
16-
}
17-
`;
18-
19-
exports[`I18n Processor processes SFC with i18n JSON inline custom block 1`] = `
20-
VueWrapper {
21-
"_emitted": Object {},
22-
"_emittedByOrder": Array [],
23-
"isFunctionalComponent": undefined,
24-
}
25-
`;
26-
27-
exports[`I18n Processor processes SFC with i18n Yaml Inline 1`] = `
28-
VueWrapper {
29-
"_emitted": Object {},
30-
"_emittedByOrder": Array [],
31-
"isFunctionalComponent": undefined,
32-
}
33-
`;
34-
353
exports[`generates source maps for .vue files 1`] = `
364
"\\"use strict\\";
375

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)