Permalink
Browse files

arrange first test about data

  • Loading branch information...
trollepierre committed May 5, 2017
1 parent 360ec50 commit bb5fa7720bc75029add3a8c740a726988daccc90
Showing with 23 additions and 2 deletions.
  1. +23 −2 test/unit/specs/Hello.spec.js
@@ -2,10 +2,31 @@ import Vue from 'vue'
import Hello from '@/components/Hello'
describe('Hello.vue', () => {
let vm
beforeEach(function () {
const Constructor = Vue.extend(Hello)
vm = new Constructor().$mount()
})
it('should check that msg is Welcome to Your Vue.js App', () => {
expect(vm.$data.msg).to.equal('Welcome to Your Vue.js App')
})
it('should render correct contents', () => {
// Given
const data = {
data: {
msg: 'plop'
}
}
const Constructor = Vue.extend(Hello)
const vm = new Constructor().$mount()
// When
vm = new Constructor(data).$mount()
// Then
expect(vm.$el.querySelector('.hello h1').textContent)
.to.equal('Welcome to Your Vue.js App')
.to.equal('plop')
})
})

0 comments on commit bb5fa77

Please sign in to comment.