-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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)
- Loading branch information
Showing
7 changed files
with
4,250 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}) |
Oops, something went wrong.