Commit a2b2f1ea authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Fix issue spinach tests.

parent c09b5852
...@@ -90,7 +90,9 @@ export default { ...@@ -90,7 +90,9 @@ export default {
this.discard(); this.discard();
} }
}) })
.catch(this.handleError); .catch(() => {
this.discard(false);
});
} }
if (withIssueAction) { if (withIssueAction) {
...@@ -109,12 +111,15 @@ export default { ...@@ -109,12 +111,15 @@ export default {
$(`.js-btn-issue-action.${btnClass}:visible`).trigger('click'); $(`.js-btn-issue-action.${btnClass}:visible`).trigger('click');
} }
}, },
discard() { discard(shouldClear = true) {
// `blur` is needed to clear slash commands autocomplete cache if event fired. // `blur` is needed to clear slash commands autocomplete cache if event fired.
// `focus` is needed to remain cursor in the textarea. // `focus` is needed to remain cursor in the textarea.
this.$refs.textarea.blur(); this.$refs.textarea.blur();
this.$refs.textarea.focus(); this.$refs.textarea.focus();
if (shouldClear) {
this.note = ''; this.note = '';
}
}, },
setNoteType(type) { setNoteType(type) {
this.noteType = type; this.noteType = type;
......
...@@ -251,7 +251,12 @@ const actions = { ...@@ -251,7 +251,12 @@ const actions = {
context.commit('removePlaceholderNotes'); context.commit('removePlaceholderNotes');
return res; return res;
}); })
.catch(() => {
const msg = 'Your comment could not be submitted! Please check your network connection and try again.';
Flash(msg, 'alert', $(noteData.flashContainer));
context.commit('removePlaceholderNotes');
})
}, },
poll(context) { poll(context) {
const { notesPath } = $('.js-notes-wrapper')[0].dataset; const { notesPath } = $('.js-notes-wrapper')[0].dataset;
......
...@@ -46,7 +46,6 @@ Feature: Project Issues ...@@ -46,7 +46,6 @@ Feature: Project Issues
Given I visit issue page "Release 0.4" Given I visit issue page "Release 0.4"
And I leave a comment like "XML attached" And I leave a comment like "XML attached"
Then I should see comment "XML attached" Then I should see comment "XML attached"
And I should see an error alert section within the comment form
@javascript @javascript
Scenario: Visiting Issues after being sorted the list Scenario: Visiting Issues after being sorted the list
......
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