Commit 03ea267f authored by Phil Hughes's avatar Phil Hughes

Added tests for hidden jump to button

parent d147894b
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
return Object.keys(this.discussions).length; return Object.keys(this.discussions).length;
}, },
showButton: function () { showButton: function () {
return this.discussionsCount > 1 || !this.discussionId; return this.discussionsCount > 0 && (this.discussionsCount > 1 || !this.discussionId);
} }
}, },
methods: { methods: {
......
...@@ -71,6 +71,8 @@ ...@@ -71,6 +71,8 @@
CommentsStore.update(this.discussionId, this.noteId, !this.isResolved, user); CommentsStore.update(this.discussionId, this.noteId, !this.isResolved, user);
ResolveService.updateUpdatedHtml(this.discussionId, data); ResolveService.updateUpdatedHtml(this.discussionId, data);
} else {
new Flash('An error occurred when trying to resolve a comment. Please try again.', 'alert');
} }
this.$nextTick(this.updateTooltip); this.$nextTick(this.updateTooltip);
......
...@@ -45,12 +45,16 @@ ...@@ -45,12 +45,16 @@
mergeRequestId, mergeRequestId,
discussionId discussionId
}, {}).then((response) => { }, {}).then((response) => {
const data = response.data; if (response.status === 200) {
const user = data ? data.resolved_by : null; const data = response.data;
discussion.resolveAllNotes(user); const user = data ? data.resolved_by : null;
discussion.loading = false; discussion.resolveAllNotes(user);
discussion.loading = false;
this.updateUpdatedHtml(discussionId, data); this.updateUpdatedHtml(discussionId, data);
} else {
new Flash('An error occurred when trying to resolve a discussion. Please try again.', 'alert');
}
}); });
} }
...@@ -66,11 +70,15 @@ ...@@ -66,11 +70,15 @@
mergeRequestId, mergeRequestId,
discussionId discussionId
}, {}).then((response) => { }, {}).then((response) => {
const data = response.data; if (response.status === 200) {
discussion.unResolveAllNotes(); const data = response.data;
discussion.loading = false; discussion.unResolveAllNotes();
discussion.loading = false;
this.updateUpdatedHtml(discussionId, data); this.updateUpdatedHtml(discussionId, data);
} else {
new Flash('An error occurred when trying to unresolve a discussion. Please try again.', 'alert');
}
}); });
} }
......
...@@ -16,6 +16,20 @@ feature 'Diff notes resolve', feature: true, js: true do ...@@ -16,6 +16,20 @@ feature 'Diff notes resolve', feature: true, js: true do
) )
end end
context 'no discussions' do
before do
project.team << [user, :master]
login_as user
note.destroy
visit_merge_request
end
it 'displays no discussion resolved data' do
expect(page).not_to have_content('discussion resolved')
expect(page).not_to have_selector('.discussion-next-btn')
end
end
context 'as authorized user' do context 'as authorized user' do
before do before do
project.team << [user, :master] project.team << [user, :master]
......
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