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 16, 2020
1 parent d6d6813 commit 6bf1beb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions js/tests/unit/modal.spec.js
Expand Up @@ -625,6 +625,25 @@ 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: 20ms;" /></div>'

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

modalEl.addEventListener('shown.bs.modal', () => {
modalEl.click()
setTimeout(() => {
expect(modalEl.clientHeight === modalEl.scrollHeight).toEqual(true)
done()
}, 20)
})

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 6bf1beb

Please sign in to comment.