Merged in feature/fix-comment-input-ms-370 (pull request #92)
Clear input after submit Approved-by: Ramon Wenger
This commit is contained in:
commit
a41dfae78a
|
|
@ -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 = '';
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
});
|
||||
|
||||
})
|
||||
Loading…
Reference in New Issue