Releases: wrseward/vue-unit
Releases · wrseward/vue-unit
0.3.0
0.2.2
0.2.1
0.2.0
Add waitForUpdate
The waitForUpdate()
helper function can be used to clean up a chain of async DOM assertions that you would normally have to use Vue.nextTick()
for.
For example we could rewrite the following test:
const Component = {
template: `<p>{{ message }}</p>`,
props: ['message']
}
it('tests message updates', () => {
const vm = mount(Component, { message: 'Hello' })
expect($(vm.$el)).to.have.text('Hello')
vm.message = 'World'
return vm.$nextTick().then(() => {
expect($(vm.$el)).to.have.text('World')
vm.message = 'VueUnit'
return vm.$nextTick()
}).then(() => {
expect($(vm.$el)).to.have.text('VueUnit')
})
})
like so:
it('tests message updates', () => {
const vm = mount(Component, { message: 'Hello' })
expect($(vm.$el)).to.have.text('Hello')
vm.message = 'World'
waitForUpdate(() => {
expect($(vm.$el)).to.have.text('World')
vm.message = 'VueUnit'
}).then(() => {
expect($(vm.$el)).to.have.text('VueUnit')
}).end(done)
Please note when using waitForUpdate()
use must end your chain of assertions with .end(done)
to avoid errors.
Initial Public Release
- Easily test props, events, and slots (including named slots)
- Optionally shallow render components
- Simulate simple DOM events (click, input, etc.)
- Use any test runner / assertion library
- Fake vuex getters and actions