Commit d6a6a54c authored by Kushal Pandya's avatar Kushal Pandya

Clear title field on drawer close

Clear Requirement Title input field on drawer close to
prevent having stale title on next drawer open.
parent 3e9c8001
...@@ -62,6 +62,12 @@ export default { ...@@ -62,6 +62,12 @@ export default {
}, },
deep: true, deep: true,
}, },
drawerOpen(value) {
// Clear `title` value on drawer close.
if (!value) {
this.title = '';
}
},
}, },
methods: { methods: {
getDrawerHeaderHeight() { getDrawerHeaderHeight() {
......
...@@ -114,6 +114,22 @@ describe('RequirementForm', () => { ...@@ -114,6 +114,22 @@ describe('RequirementForm', () => {
expect(wrapperWithRequirement.vm.title).toBe(''); expect(wrapperWithRequirement.vm.title).toBe('');
}); });
}); });
describe('drawerOpen', () => {
it('clears `title` value when `drawerOpen` prop is changed to false', async () => {
wrapper.setData({
title: 'Foo',
});
wrapper.setProps({
drawerOpen: false,
});
await wrapper.vm.$nextTick();
expect(wrapper.vm.title).toBe('');
});
});
}); });
describe('methods', () => { describe('methods', () => {
......
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