avoriaz
a Vue.js testing utility library
Installation
npm install --save-dev avoriaz
Docs
Examples
Call DOM events on the Vue wrapper
import { mount } from 'avoriaz';
import sinon from 'sinon';
import Foo from './Foo.vue';
const clickHandler = sinon.stub();
const wrapper = mount(Foo, {
propsData: { clickHandler },
});
wrapper.trigger('click');
Assert wrapper contains a child
import { mount } from 'avoriaz';
import Foo from './Foo.vue';
const wrapper = mount(Foo);
expect(wrapper.contains('.bar')).to.equal(true);
Assert wrapper contains text
import { mount } from 'avoriaz';
import Foo from './Foo.vue';
const wrapper = mount(Foo);
expect(wrapper.text()).to.equal('some text');
Call DOM events on a child
import { mount } from 'avoriaz';
import sinon from 'sinon';
import Foo from './Foo.vue';
const clickHandler = sinon.stub();
const wrapper = mount(Foo, {
propsData: { clickHandler },
});
const bar = wrapper.find('#bar')[0];
bar.dispatch('click');
expect(clickHandler.called()).to.equal(true)