Commit b5079721 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Add spec for root diff discussion note

parent 1ae013da
...@@ -362,13 +362,33 @@ import '~/notes'; ...@@ -362,13 +362,33 @@ import '~/notes';
$form.closest.and.returnValues(row, $form); $form.closest.and.returnValues(row, $form);
$form.find.and.returnValues(discussionContainer); $form.find.and.returnValues(discussionContainer);
body.attr.and.returnValue(''); body.attr.and.returnValue('');
Notes.prototype.renderDiscussionNote.call(notes, note, $form);
}); });
it('should call Notes.animateAppendNote', () => { it('should call Notes.animateAppendNote', () => {
Notes.prototype.renderDiscussionNote.call(notes, note, $form);
expect(Notes.animateAppendNote).toHaveBeenCalledWith(note.discussion_html, $('.main-notes-list')); 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);
spyOn(document, 'getElementById').and.callThrough();
spyOn($.fn, 'after').and.callThrough();
Notes.prototype.renderDiscussionNote.call(notes, note, $form);
expect(document.getElementById).toHaveBeenCalledWith(note.discussion_line_code);
expect($.fn.after).toHaveBeenCalled();
expect(line.nextSibling.outerHTML).toEqual(note.diff_discussion_html);
});
}); });
describe('Discussion sub note', () => { describe('Discussion sub note', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment