diff options
author | Phil Hughes <me@iamphill.com> | 2018-12-20 09:32:56 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-12-20 09:32:56 +0000 |
commit | 70ba4ba2851f42ed1d3a31e4994d89b59c619570 (patch) | |
tree | c6142efdc1b53773d7552c858633bc8cb67295d3 /spec/javascripts | |
parent | bec6504a9df249e0aafe2a52ff3fe5d93bdb3fbb (diff) | |
parent | 9c18798275d455c78ebdac2f1ed6d25112c558fa (diff) | |
download | gitlab-ce-70ba4ba2851f42ed1d3a31e4994d89b59c619570.tar.gz |
Merge branch '51606-expanding-a-diff-while-having-an-open-comment-form-will-always-scroll-down-to-the-comment' into 'master'
Resolve "Expanding a diff while having an open comment form will always scroll down to the comment"
Closes #51606
See merge request gitlab-org/gitlab-ce!23849
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/diffs/store/utils_spec.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/javascripts/diffs/store/utils_spec.js b/spec/javascripts/diffs/store/utils_spec.js index f096638e3d6..4268634d302 100644 --- a/spec/javascripts/diffs/store/utils_spec.js +++ b/spec/javascripts/diffs/store/utils_spec.js @@ -294,10 +294,14 @@ describe('DiffsStoreUtils', () => { }); describe('prepareDiffData', () => { - it('sets the renderIt and collapsed attribute on files', () => { - const preparedDiff = { diff_files: [getDiffFileMock()] }; + let preparedDiff; + + beforeEach(() => { + preparedDiff = { diff_files: [getDiffFileMock()] }; utils.prepareDiffData(preparedDiff); + }); + it('sets the renderIt and collapsed attribute on files', () => { const firstParallelDiffLine = preparedDiff.diff_files[0].parallel_diff_lines[2]; expect(firstParallelDiffLine.left.discussions.length).toBe(0); @@ -323,6 +327,18 @@ describe('DiffsStoreUtils', () => { expect(preparedDiff.diff_files[0].renderIt).toBeTruthy(); expect(preparedDiff.diff_files[0].collapsed).toBeFalsy(); }); + + it('adds line_code to all lines', () => { + expect( + preparedDiff.diff_files[0].parallel_diff_lines.filter(line => !line.line_code), + ).toHaveLength(0); + }); + + it('uses right line code if left has none', () => { + const firstLine = preparedDiff.diff_files[0].parallel_diff_lines[0]; + + expect(firstLine.line_code).toEqual(firstLine.right.line_code); + }); }); describe('isDiscussionApplicableToLine', () => { |