Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-09-20 15:51:14 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-09-20 15:51:14 +0300
commitac3157a0d5c3cd32ebc68c0f29e48d7a9c64edc5 (patch)
tree09f9f2825528b5d656a8f77c8ae45b20d4687a82 /spec
parent8c2192943a5efc4d0a28c67b04bf9b979def66a1 (diff)
parent305ce57094b5ed38c27a3e8cb84b35c1d871d383 (diff)
Merge branch 'mr-discussion-expanding-bug-fixes' into 'master'
Fixed hidden truncated diff lines not showing when expanded See merge request gitlab-org/gitlab-ce!21801
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/notes/stores/mutation_spec.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/javascripts/notes/stores/mutation_spec.js b/spec/javascripts/notes/stores/mutation_spec.js
index 6b7f61468d5..1ecfe914859 100644
--- a/spec/javascripts/notes/stores/mutation_spec.js
+++ b/spec/javascripts/notes/stores/mutation_spec.js
@@ -156,6 +156,41 @@ describe('Notes Store mutations', () => {
expect(state.discussions[2].notes[0].note).toBe(legacyNote.notes[1].note);
expect(state.discussions.length).toEqual(3);
});
+
+ it('adds truncated_diff_lines if discussion is a diffFile', () => {
+ const state = {
+ discussions: [],
+ };
+
+ mutations.SET_INITIAL_DISCUSSIONS(state, [
+ {
+ ...note,
+ diff_file: {
+ file_hash: 'a',
+ },
+ truncated_diff_lines: ['a'],
+ },
+ ]);
+
+ expect(state.discussions[0].truncated_diff_lines).toEqual(['a']);
+ });
+
+ it('adds empty truncated_diff_lines when not in discussion', () => {
+ const state = {
+ discussions: [],
+ };
+
+ mutations.SET_INITIAL_DISCUSSIONS(state, [
+ {
+ ...note,
+ diff_file: {
+ file_hash: 'a',
+ },
+ },
+ ]);
+
+ expect(state.discussions[0].truncated_diff_lines).toEqual([]);
+ });
});
describe('SET_LAST_FETCHED_AT', () => {