Commit 36df19e7 authored by Phil Hughes's avatar Phil Hughes

Stop passing through the store object

[ci skip]
parent 14387b49
...@@ -59,6 +59,9 @@ export default { ...@@ -59,6 +59,9 @@ export default {
elementType() { elementType() {
return this.showForm ? 'form' : 'div'; return this.showForm ? 'form' : 'div';
}, },
formState() {
return this.store.formState;
},
}, },
components: { components: {
descriptionComponent, descriptionComponent,
...@@ -142,7 +145,7 @@ export default { ...@@ -142,7 +145,7 @@ export default {
<template> <template>
<div :is="elementType"> <div :is="elementType">
<title-component <title-component
:store="store" :form-state="formState"
:show-form="showForm" :show-form="showForm"
:issuable-ref="issuableRef" :issuable-ref="issuableRef"
:title-html="state.titleHtml" :title-html="state.titleHtml"
......
<script> <script>
export default { export default {
props: { props: {
store: { formState: {
type: Object, type: Object,
required: true, required: true,
}, },
}, },
data() {
return {
state: this.store.formState,
};
},
}; };
</script> </script>
...@@ -27,6 +22,6 @@ ...@@ -27,6 +22,6 @@
type="text" type="text"
placeholder="Issue title" placeholder="Issue title"
aria-label="Issue title" aria-label="Issue title"
v-model="state.title" /> v-model="formState.title" />
</fieldset> </fieldset>
</template> </template>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
type: String, type: String,
required: true, required: true,
}, },
store: { formState: {
type: Object, type: Object,
required: true, required: true,
}, },
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div> <div>
<title-field <title-field
v-if="showForm" v-if="showForm"
:store="store" /> :form-state="formState" />
<h2 <h2
v-else v-else
class="title" class="title"
......
...@@ -17,7 +17,7 @@ describe('Title field component', () => { ...@@ -17,7 +17,7 @@ describe('Title field component', () => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
store, formState: store.formState,
}, },
}).$mount(); }).$mount();
}); });
......
...@@ -7,17 +7,18 @@ describe('Title component', () => { ...@@ -7,17 +7,18 @@ describe('Title component', () => {
beforeEach(() => { beforeEach(() => {
const Component = Vue.extend(titleComponent); const Component = Vue.extend(titleComponent);
const store = new Store({
titleHtml: '',
descriptionHtml: '',
issuableRef: '',
});
vm = new Component({ vm = new Component({
propsData: { propsData: {
issuableRef: '#1', issuableRef: '#1',
titleHtml: 'Testing <img />', titleHtml: 'Testing <img />',
titleText: 'Testing', titleText: 'Testing',
showForm: false, showForm: false,
store: new Store({ formState: store.formState,
titleHtml: '',
descriptionHtml: '',
issuableRef: '',
}),
}, },
}).$mount(); }).$mount();
}); });
......
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