Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ysds committed Mar 13, 2020
1 parent d6d6813 commit 84de27f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions js/tests/unit/modal.spec.js
Expand Up @@ -625,6 +625,29 @@ describe('Modal', () => {
modal.show()
})

it('should not overflow when clicking outside of modal-content if backdrop = static', done => {
fixtureEl.innerHTML = '<div class="modal" data-backdrop="static"><div class="modal-dialog" style="transition-duration: 5ms;" /></div>'

const modalEl = fixtureEl.querySelector('.modal')
const modal = new Modal(modalEl, {
backdrop: 'static'
})

modalEl.addEventListener('shown.bs.modal', () => {
modalEl.click()
setTimeout(() => {
expect(modalEl.style.overflowY).toEqual('hidden')
}, 15)

setTimeout(() => {
expect(modalEl.style.overflowY).toEqual('')
done()
}, 30)
})

modal.show()
})

it('should not adjust the inline body padding when it does not overflow', done => {
fixtureEl.innerHTML = '<div class="modal"><div class="modal-dialog" /></div>'

Expand Down

0 comments on commit 84de27f

Please sign in to comment.