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