Skip to content

Commit 6bf1beb

Browse files
committed
Add unit test
1 parent d6d6813 commit 6bf1beb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

js/tests/unit/modal.spec.js

+19
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,25 @@ describe('Modal', () => {
625625
modal.show()
626626
})
627627

628+
it('should not overflow when clicking outside of modal-content if backdrop = static', done => {
629+
fixtureEl.innerHTML = '<div class="modal" data-backdrop="static"><div class="modal-dialog" style="transition-duration: 20ms;" /></div>'
630+
631+
const modalEl = fixtureEl.querySelector('.modal')
632+
const modal = new Modal(modalEl, {
633+
backdrop: 'static'
634+
})
635+
636+
modalEl.addEventListener('shown.bs.modal', () => {
637+
modalEl.click()
638+
setTimeout(() => {
639+
expect(modalEl.clientHeight === modalEl.scrollHeight).toEqual(true)
640+
done()
641+
}, 20)
642+
})
643+
644+
modal.show()
645+
})
646+
628647
it('should not adjust the inline body padding when it does not overflow', done => {
629648
fixtureEl.innerHTML = '<div class="modal"><div class="modal-dialog" /></div>'
630649

0 commit comments

Comments
 (0)