Commit a2b2f1ea authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Fix issue spinach tests.

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