Merged in feature/fix-comment-input-ms-370 (pull request #92)

Clear input after submit

Approved-by: Ramon Wenger
This commit is contained in:
Christian Cueni 2021-11-09 11:48:25 +00:00
commit a41dfae78a
2 changed files with 28 additions and 1 deletions

View File

@ -12,7 +12,7 @@
<a
data-cy="submit-comment"
class="button button--primary"
@click="$emit('submit', text)">Kommentar teilen</a>
@click="submit()">Kommentar teilen</a>
</div>
</template>
@ -40,6 +40,10 @@
},
addEmoji(emoji) {
this.text = this.text + emoji;
},
submit() {
this.$emit('submit', this.text);
this.text = '';
}
},
};

View File

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