Add spec for root diff discussion note
This commit is contained in:
parent
1ae013dad5
commit
b5079721bf
1 changed files with 22 additions and 2 deletions
|
@ -362,13 +362,33 @@ 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);
|
||||
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', () => {
|
||||
|
|
Loading…
Reference in a new issue