diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-22 18:06:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-22 18:06:00 +0000 |
commit | ea4762d464bb36f3e36e318db47086e41f493377 (patch) | |
tree | c2fb2b7d2eb2b775d9ab149dc3781975fcc4b7d5 /spec/javascripts/notes | |
parent | 68b6846fa6c7b630cc8dab7a8474dcc34e4d67d4 (diff) | |
download | gitlab-ce-ea4762d464bb36f3e36e318db47086e41f493377.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/notes')
-rw-r--r-- | spec/javascripts/notes/components/discussion_counter_spec.js | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/spec/javascripts/notes/components/discussion_counter_spec.js b/spec/javascripts/notes/components/discussion_counter_spec.js index fecc0d604b1..2ad9428dd6f 100644 --- a/spec/javascripts/notes/components/discussion_counter_spec.js +++ b/spec/javascripts/notes/components/discussion_counter_spec.js @@ -27,6 +27,8 @@ describe('DiscussionCounter component', () => { describe('methods', () => { describe('jumpToFirstUnresolvedDiscussion', () => { it('expands unresolved discussion', () => { + window.mrTabs.currentAction = 'show'; + spyOn(vm, 'expandDiscussion').and.stub(); const discussions = [ { @@ -47,14 +49,39 @@ describe('DiscussionCounter component', () => { ...store.state, discussions, }); - setFixtures(` - <div class="discussion" data-discussion-id="${firstDiscussionId}"></div> - `); - vm.jumpToFirstUnresolvedDiscussion(); expect(vm.expandDiscussion).toHaveBeenCalledWith({ discussionId: firstDiscussionId }); }); + + it('jumps to first unresolved discussion from diff tab if all diff discussions are resolved', () => { + window.mrTabs.currentAction = 'diff'; + spyOn(vm, 'switchToDiscussionsTabAndJumpTo').and.stub(); + + const unresolvedId = discussionMock.id + 1; + const discussions = [ + { + ...discussionMock, + id: discussionMock.id, + diff_discussion: true, + notes: [{ ...discussionMock.notes[0], resolvable: true, resolved: true }], + resolved: true, + }, + { + ...discussionMock, + id: unresolvedId, + notes: [{ ...discussionMock.notes[0], resolvable: true, resolved: false }], + resolved: false, + }, + ]; + store.replaceState({ + ...store.state, + discussions, + }); + vm.jumpToFirstUnresolvedDiscussion(); + + expect(vm.switchToDiscussionsTabAndJumpTo).toHaveBeenCalledWith(unresolvedId); + }); }); }); }); |