Commit 69b87a97 authored by Fatih Acet's avatar Fatih Acet

Stop closing issue edit form in error state

parent 42f6be1b
...@@ -270,7 +270,6 @@ export default { ...@@ -270,7 +270,6 @@ export default {
errMsg += `. ${response.data.errors.join(' ')}`; errMsg += `. ${response.data.errors.join(' ')}`;
} }
eventHub.$emit('close.form');
createFlash(errMsg); createFlash(errMsg);
} }
}); });
...@@ -295,7 +294,6 @@ export default { ...@@ -295,7 +294,6 @@ export default {
visitUrl(data.web_url); visitUrl(data.web_url);
}) })
.catch(() => { .catch(() => {
eventHub.$emit('close.form');
createFlash( createFlash(
sprintf(s__('Error deleting %{issuableType}'), { issuableType: this.issuableType }), sprintf(s__('Error deleting %{issuableType}'), { issuableType: this.issuableType }),
); );
......
...@@ -263,11 +263,11 @@ describe('Issuable output', () => { ...@@ -263,11 +263,11 @@ describe('Issuable output', () => {
describe('error when updating', () => { describe('error when updating', () => {
it('closes form on error', done => { it('closes form on error', done => {
spyOn(vm.service, 'updateIssuable').and.callFake(() => Promise.resolve()); spyOn(vm.service, 'updateIssuable').and.callFake(() => Promise.reject());
vm.updateIssuable(); vm.updateIssuable();
setTimeout(() => { setTimeout(() => {
expect(eventHub.$emit).toHaveBeenCalledWith('close.form'); expect(eventHub.$emit).not.toHaveBeenCalledWith('close.form');
expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe( expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(
`Error updating issue`, `Error updating issue`,
); );
...@@ -284,7 +284,7 @@ describe('Issuable output', () => { ...@@ -284,7 +284,7 @@ describe('Issuable output', () => {
vm.updateIssuable(); vm.updateIssuable();
setTimeout(() => { setTimeout(() => {
expect(eventHub.$emit).toHaveBeenCalledWith('close.form'); expect(eventHub.$emit).not.toHaveBeenCalledWith('close.form');
expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe( expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(
`Error updating merge request`, `Error updating merge request`,
); );
......
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