import { shallowMount } from '@vue/test-utils'; import CommentInput from '@/components/rooms/CommentInput.vue'; 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]); }); });