fix(sidebar): dismissable property should still be reactive after mount

pull/5568/head
xavierchevalier 2024-04-11 09:24:23 +02:00
parent 8365a30f5b
commit b10e2c5994
2 changed files with 18 additions and 1 deletions

View File

@ -52,6 +52,15 @@ export default {
return { return {
$parentInstance: this $parentInstance: this
}; };
} },
watch: {
dismissable(newValue) {
if (newValue) {
this.bindOutsideClickListener();
} else {
this.unbindOutsideClickListener();
}
}
},
}; };
</script> </script>

View File

@ -119,4 +119,12 @@ describe('Sidebar.vue', () => {
expect(wrapper.vm.containerVisible).toBeFalsy(); expect(wrapper.vm.containerVisible).toBeFalsy();
}); });
it('When component is mounted , dismissable property should still be reactive', async () => {
await wrapper.setProps({ dismissable: false, visible: true });
await wrapper.setProps({ dismissable: true });
expect(wrapper.vm.containerVisible).toBeTruthy();
});
}); });