Render modals in a closed state and hide

I found out that when you umount the modals completely you don't get the
nice hide effect of `<ds-modal>`. It should be safe to still have all
modals in the DOM.
This commit is contained in:
Robert Schäfer 2019-03-10 13:38:17 +01:00
parent 0b9ad5c395
commit b7ca8a426b
2 changed files with 5 additions and 6 deletions

View File

@ -54,9 +54,9 @@ describe('Modal.vue', () => {
describe('shallowMount', () => {
const Wrapper = createWrapper(shallowMount)
it('renders nothing', () => {
it('renders all modals as closed', () => {
wrapper = Wrapper()
expect(wrapper.isEmpty()).toBe(true)
expect(wrapper.find(DisableModal).vm.isOpen).toBe(false)
})
describe('store/modal holds data to disable', () => {
@ -84,10 +84,10 @@ describe('Modal.vue', () => {
})
})
describe('click cancel', () => {
it('empties wrapper', () => {
describe('child component emits close', () => {
it('close DisableModal', () => {
wrapper.find(DisableModal).vm.$emit('close')
expect(wrapper.isEmpty()).toBe(true)
expect(wrapper.find(DisableModal).vm.isOpen).toBe(false)
})
})
})

View File

@ -1,7 +1,6 @@
<template>
<div class="modal-wrapper">
<disable-modal
v-if="open === 'disable'"
:is-open="open === 'disable'"
:resource="data"
@close="close"