Follow-up from "Fix 2+ discussions on one line not working"
The following discussions from !72915 (merged) should be addressed:
-
@thomasrandolph started a discussion: (+1 comment) For these 4 assertions, I tried
expect(wrapper.vm.lines).toBe({ start: diffLines[n], end: diffLines[n] })
.However, Vue failed with a reactivity error, asking me to declare the values in the
data
property (they are).Directly accessing the
start
/end
getters doesn't trigger the error. -
@ekigbo started a discussion: nitpick: This setup seems a little bit more convoluted than it needs to be, we're not really doing anything special so perhaps we could simplify it a little, something like:
diff --git a/spec/frontend/diffs/components/diff_line_note_form_spec.js b/spec/frontend/diffs/components/diff_line_note_form_spec.js index 104a003b12b..2f7db01e445 100644 --- a/spec/frontend/diffs/components/diff_line_note_form_spec.js +++ b/spec/frontend/diffs/components/diff_line_note_form_spec.js @@ -21,18 +21,18 @@ describe('DiffLineNoteForm', () => { store.replaceState({ ...store.state, ...args.state }); + const props = { + diffFileHash: diffFile.file_hash, + diffLines, + line: diffLines[1], + range: { start: diffLines[0], end: diffLines[1] }, + noteTargetLine: diffLines[1], + ...args.props, + } + return shallowMount(DiffLineNoteForm, { store, - propsData: { - ...{ - diffFileHash: diffFile.file_hash, - diffLines, - line: diffLines[1], - range: { start: diffLines[0], end: diffLines[1] }, - noteTargetLine: diffLines[1], - }, - ...(args.props || {}), - }, + propsData: props }); };