Remove modal after closed
This commit is contained in:
parent
6cd5e9a1e7
commit
beec114717
@ -41,6 +41,11 @@ export function showModal(options: ModalOptions = {}): Promise<ModalResult> {
|
||||
}),
|
||||
}).$mount(container)
|
||||
|
||||
$(instance.$el).modal('show')
|
||||
$(instance.$el)
|
||||
.modal('show')
|
||||
.on('hidden.bs.modal', () => {
|
||||
instance.$el.remove()
|
||||
instance.$destroy()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import $ from 'jquery'
|
||||
import { showModal } from '@/scripts/modal'
|
||||
|
||||
test('show modal', async () => {
|
||||
@ -9,4 +10,7 @@ test('show modal', async () => {
|
||||
})
|
||||
const { value } = await showModal()
|
||||
expect(value).toBe('')
|
||||
|
||||
$('.modal').trigger('hidden.bs.modal')
|
||||
expect(document.querySelector('.modal')).toBeNull()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user