diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/frontend/notes/components/noteable_note_spec.js | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/frontend/notes/components/noteable_note_spec.js')
-rw-r--r-- | spec/frontend/notes/components/noteable_note_spec.js | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/spec/frontend/notes/components/noteable_note_spec.js b/spec/frontend/notes/components/noteable_note_spec.js index aa3eaa97e20..fc238feb974 100644 --- a/spec/frontend/notes/components/noteable_note_spec.js +++ b/spec/frontend/notes/components/noteable_note_spec.js @@ -34,7 +34,13 @@ describe('issue_note', () => { note, }, localVue, - stubs: ['note-header', 'user-avatar-link', 'note-actions', 'note-body'], + stubs: [ + 'note-header', + 'user-avatar-link', + 'note-actions', + 'note-body', + 'multiline-comment-form', + ], }); }); @@ -46,12 +52,30 @@ describe('issue_note', () => { it('should render if has multiline comment', () => { const position = { line_range: { - start_line_code: 'abc_1_1', - end_line_code: 'abc_2_2', + start: { + line_code: 'abc_1_1', + type: null, + old_line: '1', + new_line: '1', + }, + end: { + line_code: 'abc_2_2', + type: null, + old_line: '2', + new_line: '2', + }, }, }; + const line = { + line_code: 'abc_1_1', + type: null, + old_line: '1', + new_line: '1', + }; wrapper.setProps({ note: { ...note, position }, + discussionRoot: true, + line, }); return wrapper.vm.$nextTick().then(() => { @@ -59,15 +83,51 @@ describe('issue_note', () => { }); }); + it('should render multiline comment if editing discussion root', () => { + wrapper.setProps({ discussionRoot: true }); + wrapper.vm.isEditing = true; + + return wrapper.vm.$nextTick().then(() => { + expect(findMultilineComment().exists()).toBe(true); + }); + }); + + it('should not render multiline comment form unless it is the discussion root', () => { + wrapper.setProps({ discussionRoot: false }); + wrapper.vm.isEditing = true; + + return wrapper.vm.$nextTick().then(() => { + expect(findMultilineComment().exists()).toBe(false); + }); + }); + it('should not render if has single line comment', () => { const position = { line_range: { - start_line_code: 'abc_1_1', - end_line_code: 'abc_1_1', + start: { + line_code: 'abc_1_1', + type: null, + old_line: '1', + new_line: '1', + }, + end: { + line_code: 'abc_1_1', + type: null, + old_line: '1', + new_line: '1', + }, }, }; + const line = { + line_code: 'abc_1_1', + type: null, + old_line: '1', + new_line: '1', + }; wrapper.setProps({ note: { ...note, position }, + discussionRoot: true, + line, }); return wrapper.vm.$nextTick().then(() => { @@ -139,6 +199,7 @@ describe('issue_note', () => { store.hotUpdate({ actions: { updateNote() {}, + setSelectedCommentPositionHover() {}, }, }); const noteBodyComponent = wrapper.find(NoteBody); |