Skip to content

Commit 416c38e

Browse files
authored
Merge pull request #283 from vuejs/issue-282
Gate typescript behind tsconfig check and added e2e test for project that doesn't use Typescript (Fix #282)
2 parents 98c5d81 + c0e8de1 commit 416c38e

File tree

7 files changed

+4250
-1
lines changed

7 files changed

+4250
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<div class="hello">
3+
<h1 :class="headingClasses">{{ msg }}</h1>
4+
</div>
5+
</template>
6+
7+
<style module="css">
8+
.testA {
9+
background-color: red;
10+
}
11+
</style>
12+
<style module>
13+
.testB {
14+
background-color: blue;
15+
}
16+
</style>
17+
<style>
18+
.testC {
19+
background-color: blue;
20+
}
21+
</style>
22+
23+
<script>
24+
export default {
25+
name: 'basic',
26+
computed: {
27+
headingClasses: function headingClasses() {
28+
return {
29+
red: this.isCrazy,
30+
blue: !this.isCrazy,
31+
shadow: this.isCrazy
32+
}
33+
}
34+
},
35+
data: function data() {
36+
return {
37+
msg: 'Welcome to Your Vue.js App',
38+
isCrazy: false
39+
}
40+
},
41+
methods: {
42+
toggleClass: function toggleClass() {
43+
this.isCrazy = !this.isCrazy
44+
}
45+
}
46+
}
47+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<h1>Coffee</h1>
3+
</template>
4+
5+
<script lang="coffee">
6+
export default
7+
name: 'coffee'
8+
data: -> {}
9+
</script>
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "javascript",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"private": true,
7+
"scripts": {
8+
"test": "jest --no-cache test.js"
9+
},
10+
"dependencies": {
11+
"vue": "3.0.0-alpha.10"
12+
},
13+
"devDependencies": {
14+
"@babel/core": "^7.2.2",
15+
"@babel/preset-env": "^7.2.3",
16+
"jest": "^24.0.0"
17+
},
18+
"jest": {
19+
"moduleFileExtensions": [
20+
"js",
21+
"json",
22+
"vue"
23+
],
24+
"transform": {
25+
"^.+\\.js$": "babel-jest",
26+
"^.+\\.vue$": "../../../lib/index.js"
27+
}
28+
},
29+
"babel": {
30+
"presets": [
31+
"@babel/env"
32+
]
33+
}
34+
}

e2e/__projects__/javascript/test.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { createApp, h } from 'vue'
2+
3+
import Basic from './components/Basic.vue'
4+
import Coffee from './components/Coffee.vue'
5+
6+
function mount(Component, props, slots) {
7+
document.getElementsByTagName('html')[0].innerHTML = ''
8+
const el = document.createElement('div')
9+
el.id = 'app'
10+
document.body.appendChild(el)
11+
const Parent = {
12+
render() {
13+
return h(Component, props, slots)
14+
}
15+
}
16+
createApp(Parent).mount(el)
17+
}
18+
19+
test('processes .vue files', () => {
20+
mount(Basic)
21+
expect(document.querySelector('h1').textContent).toBe(
22+
'Welcome to Your Vue.js App'
23+
)
24+
})
25+
26+
test('processes .vue file with lang set to coffee', () => {
27+
mount(Coffee)
28+
expect(document.querySelector('h1').textContent).toBe('Coffee')
29+
})

0 commit comments

Comments
 (0)