Commit 16288e78 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'issue-edit-inline-stop-edit-button-reseting-state' into 'issue-edit-inline'

Stops formState from updating if the form is already open

See merge request !11443
parents 81c69c28 cf0cc972
......@@ -79,12 +79,14 @@ export default {
},
methods: {
openForm() {
this.showForm = true;
this.store.formState = {
title: this.state.titleText,
confidential: this.isConfidential,
description: this.state.descriptionText,
};
if (!this.showForm) {
this.showForm = true;
this.store.formState = {
title: this.state.titleText,
confidential: this.isConfidential,
description: this.state.descriptionText,
};
}
},
closeForm() {
this.showForm = false;
......
......@@ -23,7 +23,7 @@ describe('Issuable output', () => {
const IssuableDescriptionComponent = Vue.extend(issuableApp);
Vue.http.interceptors.push(issueShowInterceptor(issueShowData.initialRequest));
spyOn(eventHub, '$emit');
spyOn(eventHub, '$emit').and.callThrough();
vm = new IssuableDescriptionComponent({
propsData: {
......@@ -34,8 +34,9 @@ describe('Issuable output', () => {
initialTitle: '',
initialDescriptionHtml: '',
initialDescriptionText: '',
showForm: false,
isConfidential: false,
markdownPreviewUrl: '/',
markdownDocs: '/',
},
}).$mount();
});
......@@ -89,6 +90,22 @@ describe('Issuable output', () => {
});
});
it('does not update formState if form is already open', (done) => {
vm.openForm();
vm.state.titleText = 'testing 123';
vm.openForm();
Vue.nextTick(() => {
expect(
vm.store.formState.title,
).not.toBe('testing 123');
done();
});
});
describe('updateIssuable', () => {
it('correctly updates issuable data', (done) => {
spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => {
......
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