Adds unit tests for discussion component
This commit is contained in:
parent
3e92f44ff2
commit
cf77cdba51
|
@ -179,7 +179,7 @@
|
|||
v-if="canReply && !isReplying"
|
||||
@click="showReplyForm"
|
||||
type="button"
|
||||
class="btn btn-text-field"
|
||||
class="js-vue-discussion-reply btn btn-text-field"
|
||||
title="Add a reply">Reply...</button>
|
||||
<issue-note-form
|
||||
v-if="isReplying"
|
||||
|
|
|
@ -1,42 +1,49 @@
|
|||
import Vue from 'vue';
|
||||
import store from '~/notes/stores';
|
||||
import issueDiscussion from '~/notes/components/issue_discussion.vue';
|
||||
import { issueDataMock, discussionMock, notesDataMock } from '../mock_data';
|
||||
|
||||
describe('issue_discussion component', () => {
|
||||
let vm;
|
||||
|
||||
beforeEach(() => {
|
||||
const Component = Vue.extend(issueDiscussion);
|
||||
|
||||
store.dispatch('setIssueData', issueDataMock);
|
||||
store.dispatch('setNotesData', notesDataMock);
|
||||
|
||||
vm = new Component({
|
||||
store,
|
||||
propsData: {
|
||||
note: discussionMock,
|
||||
},
|
||||
}).$mount();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vm.$destroy();
|
||||
});
|
||||
|
||||
it('should render user avatar', () => {
|
||||
expect(vm.$el.querySelector('.user-avatar-link')).toBeDefined();
|
||||
});
|
||||
|
||||
it('should render discussion header', () => {
|
||||
|
||||
expect(vm.$el.querySelector('.discussion-header')).toBeDefined();
|
||||
expect(vm.$el.querySelectorAll('.notes li').length).toEqual(discussionMock.notes.length);
|
||||
});
|
||||
|
||||
describe('updated note', () => {
|
||||
it('should show information about update', () => {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('with open discussion', () => {
|
||||
it('should render system note', () => {
|
||||
|
||||
describe('actions', () => {
|
||||
it('should render reply button', () => {
|
||||
expect(vm.$el.querySelector('.js-vue-discussion-reply').textContent.trim()).toEqual('Reply...');
|
||||
});
|
||||
|
||||
it('should render placeholder note', () => {
|
||||
|
||||
});
|
||||
|
||||
it('should render regular note', () => {
|
||||
|
||||
});
|
||||
|
||||
describe('actions', () => {
|
||||
it('should render reply button', () => {
|
||||
|
||||
});
|
||||
|
||||
it('should toggle reply form', () => {
|
||||
|
||||
});
|
||||
|
||||
it('should render signout widget when user is logged out', () => {
|
||||
|
||||
it('should toggle reply form', (done) => {
|
||||
vm.$el.querySelector('.js-vue-discussion-reply').click();
|
||||
Vue.nextTick(() => {
|
||||
expect(vm.$refs.noteForm).toBeDefined();
|
||||
expect(vm.isReplying).toEqual(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue