Show edited officer form on error
This commit is contained in:
@@ -22,6 +22,13 @@ describe('EditOfficerForm', () => {
|
||||
expect(wrapper.vm.$data.editing).toEqual(true)
|
||||
})
|
||||
|
||||
it('does start in editing mode when the form has changes', () => {
|
||||
const wrapper = shallowMount(EditOfficerForm, {
|
||||
propsData: { hasChanges: true },
|
||||
})
|
||||
expect(wrapper.vm.$data.editing).toEqual(true)
|
||||
})
|
||||
|
||||
it('starts editing when edit method called', () => {
|
||||
const wrapper = shallowMount(EditOfficerForm)
|
||||
wrapper.vm.edit({ preventDefault: () => null })
|
||||
|
@@ -13,6 +13,10 @@ export default {
|
||||
},
|
||||
|
||||
props: {
|
||||
hasChanges: {
|
||||
type: Boolean,
|
||||
default: () => false,
|
||||
},
|
||||
hasErrors: {
|
||||
type: Boolean,
|
||||
default: () => false,
|
||||
@@ -21,7 +25,7 @@ export default {
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
editing: this.hasErrors,
|
||||
editing: this.hasErrors || this.hasChanges,
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user