summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-12-20 09:32:56 +0000
committerPhil Hughes <me@iamphill.com>2018-12-20 09:32:56 +0000
commit70ba4ba2851f42ed1d3a31e4994d89b59c619570 (patch)
treec6142efdc1b53773d7552c858633bc8cb67295d3 /spec/javascripts
parentbec6504a9df249e0aafe2a52ff3fe5d93bdb3fbb (diff)
parent9c18798275d455c78ebdac2f1ed6d25112c558fa (diff)
downloadgitlab-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.js20
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', () => {