Skip to content

Commit aec4310

Browse files
committed
More realistic testing.
1 parent 64ad29c commit aec4310

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"eslint-config-airbnb-base": "^11.1.0",
3939
"eslint-plugin-html": "^2.0.0",
4040
"eslint-plugin-import": "^2.2.0",
41+
"vue": "^2.1.10",
4142
"vue-loader": "^10.3.0",
4243
"vue-template-compiler": "^2.1.10",
4344
"webpack": "^2.2.1"

test/index.test.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import _ from 'lodash';
2+
import Vue from 'vue';
23
import test from 'ava';
34
import TestComponent from './test.vue';
45

5-
test('it works!', (t) => {
6-
t.true(_.isString(TestComponent._scopeId)); // eslint-disable-line no-underscore-dangle
6+
test('works like it does in a browser', (t) => {
7+
const Constructor = Vue.extend(TestComponent);
8+
const vm = new Constructor().$mount();
9+
t.is(vm.$el.querySelector('h1').textContent, 'Hello, World!');
10+
});
11+
12+
test('sets default data', (t) => {
13+
t.true(_.isFunction(TestComponent.data));
14+
t.deepEqual(TestComponent.data(), { name: 'World' });
715
});

test/test.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<template>
2-
<h1>Hello, {{ name }}!</h1>
2+
<div>
3+
<h1>Hello, {{ name }}!</h1>
4+
</div>
35
</template>
46

57
<script>

0 commit comments

Comments
 (0)