diff options
| author | Shinya Maeda <shinya@gitlab.com> | 2017-11-06 20:44:38 +0900 |
|---|---|---|
| committer | Shinya Maeda <shinya@gitlab.com> | 2017-11-06 20:44:38 +0900 |
| commit | 377916ed72cf31ee31e463f395993d1ec0dc579b (patch) | |
| tree | 89f2e9ce00777a8c13ef74f8e50540274c73c41c /spec/javascripts | |
| parent | eba27fe022562e6e5cdae81a08addff6ec152826 (diff) | |
| parent | d4ceec9d47a7da5fa17cb6e161ac491e13fcb8bd (diff) | |
| download | gitlab-ce-377916ed72cf31ee31e463f395993d1ec0dc579b.tar.gz | |
Merge branch 'master' into refactor-clusters
Diffstat (limited to 'spec/javascripts')
| -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', () => { |
