gitlab-org--gitlab-foss/spec/javascripts/notes/components/issue_note_body_spec.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

import Vue from 'vue';
import store from '~/notes/stores';
import noteBody from '~/notes/components/issue_note_body.vue';
import { issueDataMock, notesDataMock, note } from '../mock_data';
2017-08-04 11:51:35 -04:00
describe('issue_note_body component', () => {
let vm;
beforeEach(() => {
const Component = Vue.extend(noteBody);
2017-08-04 11:51:35 -04:00
store.dispatch('setIssueData', issueDataMock);
store.dispatch('setNotesData', notesDataMock);
vm = new Component({
store,
propsData: {
note,
canEdit: true,
},
}).$mount();
2017-08-04 11:51:35 -04:00
});
afterEach(() => {
vm.$destroy();
});
2017-08-04 11:51:35 -04:00
it('should render the note', () => {
expect(vm.$el.querySelector('.note-text').innerHTML).toEqual(note.note_html);
2017-08-04 11:51:35 -04:00
});
it('should be render form if user is editing', (done) => {
vm.isEditing = true;
2017-08-04 11:51:35 -04:00
Vue.nextTick(() => {
expect(vm.$el.querySelector('textarea.js-task-list-field')).toBeDefined();
done();
});
2017-08-04 11:51:35 -04:00
});
it('should render awards list', () => {
2017-08-11 19:35:44 -04:00
expect(vm.$el.querySelector('.js-awards-block button [data-name="baseball"]')).toBeDefined();
expect(vm.$el.querySelector('.js-awards-block button [data-name="bath_tone3"]')).toBeDefined();
2017-08-04 11:51:35 -04:00
});
});