Stop passing through the store object

[ci skip]
This commit is contained in:
Phil Hughes 2017-05-15 15:34:01 +01:00
parent 14387b49a5
commit 36df19e71b
5 changed files with 15 additions and 16 deletions

View file

@ -59,6 +59,9 @@ export default {
elementType() {
return this.showForm ? 'form' : 'div';
},
formState() {
return this.store.formState;
},
},
components: {
descriptionComponent,
@ -142,7 +145,7 @@ export default {
<template>
<div :is="elementType">
<title-component
:store="store"
:form-state="formState"
:show-form="showForm"
:issuable-ref="issuableRef"
:title-html="state.titleHtml"

View file

@ -1,16 +1,11 @@
<script>
export default {
props: {
store: {
formState: {
type: Object,
required: true,
},
},
data() {
return {
state: this.store.formState,
};
},
};
</script>
@ -27,6 +22,6 @@
type="text"
placeholder="Issue title"
aria-label="Issue title"
v-model="state.title" />
v-model="formState.title" />
</fieldset>
</template>

View file

@ -27,7 +27,7 @@
type: String,
required: true,
},
store: {
formState: {
type: Object,
required: true,
},
@ -56,7 +56,7 @@
<div>
<title-field
v-if="showForm"
:store="store" />
:form-state="formState" />
<h2
v-else
class="title"

View file

@ -17,7 +17,7 @@ describe('Title field component', () => {
vm = new Component({
propsData: {
store,
formState: store.formState,
},
}).$mount();
});

View file

@ -7,17 +7,18 @@ describe('Title component', () => {
beforeEach(() => {
const Component = Vue.extend(titleComponent);
const store = new Store({
titleHtml: '',
descriptionHtml: '',
issuableRef: '',
});
vm = new Component({
propsData: {
issuableRef: '#1',
titleHtml: 'Testing <img />',
titleText: 'Testing',
showForm: false,
store: new Store({
titleHtml: '',
descriptionHtml: '',
issuableRef: '',
}),
formState: store.formState,
},
}).$mount();
});