mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
Add test for modal-content
This commit is contained in:
parent
0f9fd75d6c
commit
569bca54d2
@ -432,6 +432,38 @@ describe('Modal', () => {
|
||||
modal.show()
|
||||
})
|
||||
|
||||
it('should not close modal when clicking on modal-content', done => {
|
||||
fixtureEl.innerHTML = [
|
||||
'<div class="modal">',
|
||||
' <div class="modal-dialog">',
|
||||
' <div class="modal-content"></div>',
|
||||
' </div>',
|
||||
'</div>'
|
||||
].join('')
|
||||
|
||||
const modalEl = fixtureEl.querySelector('.modal')
|
||||
const modal = new Modal(modalEl)
|
||||
|
||||
const shownCallback = () => {
|
||||
setTimeout(() => {
|
||||
expect(modal._isShown).toEqual(true)
|
||||
done()
|
||||
}, 10)
|
||||
}
|
||||
|
||||
modalEl.addEventListener('shown.bs.modal', () => {
|
||||
fixtureEl.querySelector('.modal-dialog').click()
|
||||
fixtureEl.querySelector('.modal-content').click()
|
||||
shownCallback()
|
||||
})
|
||||
|
||||
modalEl.addEventListener('hidden.bs.modal', () => {
|
||||
throw new Error('Should not hide a modal')
|
||||
})
|
||||
|
||||
modal.show()
|
||||
})
|
||||
|
||||
it('should not close modal when clicking outside of modal-content if backdrop = false', done => {
|
||||
fixtureEl.innerHTML = '<div class="modal"><div class="modal-dialog"></div></div>'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user