@belsrc/vue-test-functional-wrapper
v1.0.1
Published
Wrap a functional component in order to test against it
Downloads
83
Maintainers
Readme
vue-test-functional-wrapper
Install
npm i -D @belsrc/vue-test-functional-wrapper
Use
// functional-component.test.js
import wrapFunctional from '@belsrc/vue-test-functional-wrapper';
import FunctionalComponent from './functional-component';
let wrapped;
describe('FunctionalComponent', () => {
beforeEach(() => {
wrapped = wrapFunctional(FunctionalComponent, {
methods: { click() { this.$emit('click'); } },
on(vm) { return { click: vm.click } },
});
});
describe('Rendering', () => {
test('should do somthing', () => {
const wrapper = mount(wrapped, {
propsData: { foo: 'bar' },
});
...
});
});
});