summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-08-09 15:08:37 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-08-09 15:08:37 +0100
commit3372ae8b51a15db59bb12a3653215d200aea10d1 (patch)
tree88ed206f4bb3e39edaf53f78b3624002f5137c17 /spec/javascripts/notes
parent02c66dadaec447d9e031d4370f95a14b51186c42 (diff)
downloadgitlab-ce-3372ae8b51a15db59bb12a3653215d200aea10d1.tar.gz
[ci skip] Adds unit tests for issue_system_note component
Diffstat (limited to 'spec/javascripts/notes')
-rw-r--r--spec/javascripts/notes/components/issue_system_note_spec.js44
1 files changed, 40 insertions, 4 deletions
diff --git a/spec/javascripts/notes/components/issue_system_note_spec.js b/spec/javascripts/notes/components/issue_system_note_spec.js
index 779de4ab657..c317ce32716 100644
--- a/spec/javascripts/notes/components/issue_system_note_spec.js
+++ b/spec/javascripts/notes/components/issue_system_note_spec.js
@@ -1,17 +1,53 @@
+import Vue from 'vue';
+import issueSystemNote from '~/notes/components/issue_system_note.vue';
+import store from '~/notes/stores';
+
describe('issue system note', () => {
- it('should render a list item with correct id', () => {
+ let vm;
+ let props;
+
+ beforeEach(() => {
+ props = {
+ note: {
+ id: 1424,
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: 'path',
+ path: '/root',
+ },
+ note_html: '<p dir="auto">closed</p>',
+ system_note_icon_name: 'icon_status_closed',
+ created_at: '2017-08-02T10:51:58.559Z',
+ },
+ };
+ store.dispatch('setTargetNoteHash', `note_${props.note.id}`);
+
+ const Component = Vue.extend(issueSystemNote);
+ vm = new Component({
+ store,
+ propsData: props,
+ }).$mount();
});
- it('should render target class is note is target note', () => {
+ it('should render a list item with correct id', () => {
+ expect(vm.$el.getAttribute('id')).toEqual(`note_${props.note.id}`);
+ });
+ it('should render target class is note is target note', () => {
+ expect(vm.$el.classList).toContain('target');
});
it('should render svg icon', () => {
-
+ expect(vm.$el.querySelector('.timeline-icon svg')).toBeDefined();
});
it('should render note header component', () => {
-
+ expect(
+ vm.$el.querySelector('.system-note-message').innerHTML,
+ ).toEqual(props.note.note_html);
});
});