skillbox/client/tests/unit/text-form.spec.js

26 lines
653 B
JavaScript

import {createLocalVue, shallowMount} from '@vue/test-utils';
import TextForm from '@/components/content-forms/TextForm';
const localVue = createLocalVue();
describe('TextForm.vue', () => {
it('should emit user input and its index', async () => {
const inputText = 'some value';
const props = {
value: { text: '' },
index: 1
};
const wrapper = shallowMount(TextForm, {
propsData: props,
localVue
});
const textInput = wrapper.find('[data-cy="text-form-input"]');
await textInput.setValue(inputText);
expect(wrapper.emitted()['change-text'][0]).toEqual([inputText, props.index]);
});
});