mount(omponent, options = {})
Creates a mounted Vue component and returns a VueWrapper with helper methods to test the component.
Arguments
component
(Component
): The mounted Vue component
options
(Object
) [optional]: All options which are passed to the component when a new instance is created - see API.
Example
Without options
import { mount } from '@jasoeight/vue-testing';
import { expect } from 'chai';
import Example from './path/to/Example.vue';
describe('Example.vue', () => {
it('mounts component', () => {
const wrapper = mount(Example);
// expect(...);
});
});
With options
import { mount } from '@jasoeight/vue-testing';
import { expect } from 'chai';
import Example from './path/to/Example.vue';
describe('Example.vue', () => {
it('mounts component with props data', () => {
const wrapper = mount(Example, {
propsData: {
firstname: 'John',
lastname: 'Doe'
}
});
// expect(...);
});
});