Commit cf0cc972 authored by Phil Hughes's avatar Phil Hughes

Stops formState from updating if the form is already open

[ci skip]
parent 81c69c28
......@@ -79,12 +79,14 @@ export default {
},
methods: {
openForm() {
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