Skip to content

Gate typescript behind tsconfig check and added e2e test for project that doesn't use Typescript (Fix #282) #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions e2e/__projects__/javascript/components/Basic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<div class="hello">
<h1 :class="headingClasses">{{ msg }}</h1>
</div>
</template>

<style module="css">
.testA {
background-color: red;
}
</style>
<style module>
.testB {
background-color: blue;
}
</style>
<style>
.testC {
background-color: blue;
}
</style>

<script>
export default {
name: 'basic',
computed: {
headingClasses: function headingClasses() {
return {
red: this.isCrazy,
blue: !this.isCrazy,
shadow: this.isCrazy
}
}
},
data: function data() {
return {
msg: 'Welcome to Your Vue.js App',
isCrazy: false
}
},
methods: {
toggleClass: function toggleClass() {
this.isCrazy = !this.isCrazy
}
}
}
</script>
9 changes: 9 additions & 0 deletions e2e/__projects__/javascript/components/Coffee.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<h1>Coffee</h1>
</template>

<script lang="coffee">
export default
name: 'coffee'
data: -> {}
</script>
34 changes: 34 additions & 0 deletions e2e/__projects__/javascript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "javascript",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"test": "jest --no-cache test.js"
},
"dependencies": {
"vue": "3.0.0-alpha.10"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"jest": "^24.0.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.vue$": "../../../lib/index.js"
}
},
"babel": {
"presets": [
"@babel/env"
]
}
}
29 changes: 29 additions & 0 deletions e2e/__projects__/javascript/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { createApp, h } from 'vue'

import Basic from './components/Basic.vue'
import Coffee from './components/Coffee.vue'

function mount(Component, props, slots) {
document.getElementsByTagName('html')[0].innerHTML = ''
const el = document.createElement('div')
el.id = 'app'
document.body.appendChild(el)
const Parent = {
render() {
return h(Component, props, slots)
}
}
createApp(Parent).mount(el)
}

test('processes .vue files', () => {
mount(Basic)
expect(document.querySelector('h1').textContent).toBe(
'Welcome to Your Vue.js App'
)
})

test('processes .vue file with lang set to coffee', () => {
mount(Coffee)
expect(document.querySelector('h1').textContent).toBe('Coffee')
})
Loading