Commit 288714e9 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'tor/defect/multiple-comments-one-line' into 'master'

Fix 2+ discussions on one line not working

See merge request gitlab-org/gitlab!72915
parents ca4679a0 b6a340c9
......@@ -149,7 +149,11 @@ export default {
},
},
created() {
this.lines = { ...this.range };
if (this.range) {
this.lines = { ...this.range };
} else if (this.line) {
this.lines = { start: this.line, end: this.line };
}
},
mounted() {
if (this.isLoggedIn) {
......
......@@ -24,11 +24,14 @@ describe('DiffLineNoteForm', () => {
return shallowMount(DiffLineNoteForm, {
store,
propsData: {
diffFileHash: diffFile.file_hash,
diffLines,
line: diffLines[1],
range: { start: diffLines[0], end: diffLines[1] },
noteTargetLine: diffLines[1],
...{
diffFileHash: diffFile.file_hash,
diffLines,
line: diffLines[1],
range: { start: diffLines[0], end: diffLines[1] },
noteTargetLine: diffLines[1],
},
...(args.props || {}),
},
});
};
......@@ -119,6 +122,22 @@ describe('DiffLineNoteForm', () => {
});
});
describe('created', () => {
it('should use the provided `range` of lines', () => {
wrapper = createComponent();
expect(wrapper.vm.lines.start).toBe(diffLines[0]);
expect(wrapper.vm.lines.end).toBe(diffLines[1]);
});
it("should fill the internal `lines` data with the provided `line` if there's no provided `range", () => {
wrapper = createComponent({ props: { range: null } });
expect(wrapper.vm.lines.start).toBe(diffLines[1]);
expect(wrapper.vm.lines.end).toBe(diffLines[1]);
});
});
describe('mounted', () => {
it('should init autosave', () => {
const key = 'autosave/Note/Issue/98//DiffNote//1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_2';
......
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