Skip to content

Commit f01f9b1

Browse files
authored
test: add test for component that uses JSX (vuejs#142)
1 parent ff3a777 commit f01f9b1

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module.exports = {
2-
presets: ['@babel/preset-env']
2+
presets: ['@babel/preset-env'],
3+
plugins: ['transform-vue-jsx']
34
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script>
2+
export default {
3+
render(h) {
4+
return <div />
5+
}
6+
}
7+
</script>

e2e/__projects__/babel-config/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"@babel/preset-env": "^7.2.3",
1717
"@vue/test-utils": "^1.0.0-beta.28",
1818
"babel-core": "^7.0.0-bridge.0",
19+
"babel-helper-vue-jsx-merge-props": "^2.0.3",
20+
"babel-plugin-syntax-jsx": "^6.18.0",
21+
"babel-plugin-transform-vue-jsx": "^3.7.0",
1922
"jest": "^23.6.0",
2023
"node-sass": "^4.11.0",
2124
"vue-jest": "file:../../../"

e2e/__projects__/babel-config/test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Less from './components/Less.vue'
2020
import PostCss from './components/PostCss.vue'
2121
import Pug from './components/Pug.vue'
2222
import PugRelative from './components/PugRelativeExtends.vue'
23+
import Jsx from './components/Jsx.vue'
2324

2425
test('processes .vue files', () => {
2526
const wrapper = mount(Basic)
@@ -57,6 +58,11 @@ test('generates source maps using src attributes', () => {
5758
expect(code).toMatchSnapshot()
5859
})
5960

61+
test('processes .vue file using jsx', () => {
62+
const wrapper = mount(Jsx)
63+
expect(wrapper.vm).toBeTruthy()
64+
})
65+
6066
test('processes .vue file with lang set to coffee', () => {
6167
const wrapper = mount(Coffee)
6268
expect(wrapper.vm).toBeTruthy()

0 commit comments

Comments
 (0)