Commit 2f130527 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

FE review changes - remove internal details assertion and look for closest...

FE review changes - remove internal details assertion and look for closest form if no discussion_line_code
parent b5079721
...@@ -415,7 +415,7 @@ export default class Notes { ...@@ -415,7 +415,7 @@ export default class Notes {
this.note_ids.push(noteEntity.id); this.note_ids.push(noteEntity.id);
form = $form || $(`.js-discussion-note-form[data-discussion-id="${noteEntity.discussion_id}"]`); form = $form || $(`.js-discussion-note-form[data-discussion-id="${noteEntity.discussion_id}"]`);
row = form.length ? form.closest('tr') : $(`#${noteEntity.discussion_line_code}`); row = (form.length || !noteEntity.discussion_line_code) ? form.closest('tr') : $(`#${noteEntity.discussion_line_code}`);
if (noteEntity.on_image) { if (noteEntity.on_image) {
row = form; row = form;
......
...@@ -380,13 +380,9 @@ import '~/notes'; ...@@ -380,13 +380,9 @@ import '~/notes';
document.body.appendChild(line); document.body.appendChild(line);
$form.closest.and.returnValues($form); $form.closest.and.returnValues($form);
spyOn(document, 'getElementById').and.callThrough();
spyOn($.fn, 'after').and.callThrough();
Notes.prototype.renderDiscussionNote.call(notes, note, $form); 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); expect(line.nextSibling.outerHTML).toEqual(note.diff_discussion_html);
}); });
}); });
......
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