Skip to content
Snippets Groups Projects
Commit 16288e78 authored by Filipa Lacerda's avatar Filipa Lacerda
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
@@ -79,12 +79,14 @@ export default {
Loading
@@ -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;
Loading
Loading
Loading
@@ -23,7 +23,7 @@ describe('Issuable output', () => {
Loading
@@ -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: {
Loading
@@ -34,8 +34,9 @@ describe('Issuable output', () => {
Loading
@@ -34,8 +34,9 @@ describe('Issuable output', () => {
initialTitle: '', initialTitle: '',
initialDescriptionHtml: '', initialDescriptionHtml: '',
initialDescriptionText: '', initialDescriptionText: '',
showForm: false,
isConfidential: false, isConfidential: false,
markdownPreviewUrl: '/',
markdownDocs: '/',
}, },
}).$mount(); }).$mount();
}); });
Loading
@@ -89,6 +90,22 @@ describe('Issuable output', () => {
Loading
@@ -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) => {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment