skillbox/client/tests/unit/comment-input.spec.js

22 lines
560 B
JavaScript

import { shallowMount } from '@vue/test-utils';
import CommentInput from '@/components/rooms/CommentInput';
describe('CommentInput.vue', () => {
it('should clear input after submit', async () => {
const inputText = 'some value';
const wrapper = shallowMount(CommentInput, {
directives: {
'auto-grow': {},
},
});
const textInput = wrapper.find('[data-cy="comment-textarea"]');
await textInput.setValue(inputText);
wrapper.vm.submit();
expect(wrapper.emitted()['submit'][0]).toEqual([inputText]);
});
});