diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-11-06 09:55:02 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-11-06 09:55:02 +0000 |
commit | 46dc343f605f0c98d2b9ec44617d313a1548b4e2 (patch) | |
tree | ddc72be3af3001ee1c452f41298955e6393df316 /spec/javascripts/notes_spec.js | |
parent | 823a9d351b49a6be8c12cfe06edb4aa6ec08fe95 (diff) | |
parent | 727561f4cac6d39f285519c3e5eca4559d51b131 (diff) | |
download | gitlab-ce-46dc343f605f0c98d2b9ec44617d313a1548b4e2.tar.gz |
Merge branch '38677-render-new-discussions-on-diff-tab' into 'master'36248-repo-editor-double-border-under-repo-file-buttons
Added discussion_line_code value to note response and use it to query the right…
Closes #38677
See merge request gitlab-org/gitlab-ce!14981
Diffstat (limited to 'spec/javascripts/notes_spec.js')
-rw-r--r-- | spec/javascripts/notes_spec.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index 53d8faae911..928a4b461cc 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -343,6 +343,7 @@ import '~/notes'; diff_discussion_html: false, }; $form = jasmine.createSpyObj('$form', ['closest', 'find']); + $form.length = 1; row = jasmine.createSpyObj('row', ['prevAll', 'first', 'find']); notes = jasmine.createSpyObj('notes', [ @@ -371,13 +372,29 @@ import '~/notes'; $form.closest.and.returnValues(row, $form); $form.find.and.returnValues(discussionContainer); body.attr.and.returnValue(''); - - Notes.prototype.renderDiscussionNote.call(notes, note, $form); }); it('should call Notes.animateAppendNote', () => { + Notes.prototype.renderDiscussionNote.call(notes, note, $form); + expect(Notes.animateAppendNote).toHaveBeenCalledWith(note.discussion_html, $('.main-notes-list')); }); + + it('should append to row selected with line_code', () => { + $form.length = 0; + note.discussion_line_code = 'line_code'; + note.diff_discussion_html = '<tr></tr>'; + + const line = document.createElement('div'); + line.id = note.discussion_line_code; + document.body.appendChild(line); + + $form.closest.and.returnValues($form); + + Notes.prototype.renderDiscussionNote.call(notes, note, $form); + + expect(line.nextSibling.outerHTML).toEqual(note.diff_discussion_html); + }); }); describe('Discussion sub note', () => { |