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

Added tests for hidden jump to button

parent d147894b
......@@ -17,7 +17,7 @@
return Object.keys(this.discussions).length;
},
showButton: function () {
return this.discussionsCount > 1 || !this.discussionId;
return this.discussionsCount > 0 && (this.discussionsCount > 1 || !this.discussionId);
}
},
methods: {
......
......@@ -71,6 +71,8 @@
CommentsStore.update(this.discussionId, this.noteId, !this.isResolved, user);
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);
......
......@@ -45,12 +45,16 @@
mergeRequestId,
discussionId
}, {}).then((response) => {
const data = response.data;
const user = data ? data.resolved_by : null;
discussion.resolveAllNotes(user);
discussion.loading = false;
if (response.status === 200) {
const data = response.data;
const user = data ? data.resolved_by : null;
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 @@
mergeRequestId,
discussionId
}, {}).then((response) => {
const data = response.data;
discussion.unResolveAllNotes();
discussion.loading = false;
if (response.status === 200) {
const data = response.data;
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
)
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
before do
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