0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-29 21:52:22 +01:00

Merge pull request #23732 from techdavid/fix-jumping-modal-on-resize

Fix jumping modal when the viewport is resized
This commit is contained in:
Johann-S 2017-09-03 13:00:10 +02:00 committed by GitHub
commit 900da3e235
2 changed files with 16 additions and 0 deletions

View File

@ -136,6 +136,8 @@ const Modal = (() => {
this._checkScrollbar()
this._setScrollbar()
this._adjustDialog()
$(document.body).addClass(ClassName.OPEN)
this._setEscapeEvent()

View File

@ -351,6 +351,20 @@ $(function () {
$toggleBtn.trigger('click')
})
QUnit.test('should adjust the inline padding of the modal when opening', function (assert) {
assert.expect(1)
var done = assert.async()
$('<div id="modal-test"/>')
.on('shown.bs.modal', function () {
var expectedPadding = $(this).getScrollbarWidth() + 'px'
var currentPadding = $(this).css('padding-right')
assert.strictEqual(currentPadding, expectedPadding, 'modal padding should be adjusted while opening')
done()
})
.bootstrapModal('show')
})
QUnit.test('should adjust the inline body padding when opening and restore when closing', function (assert) {
assert.expect(2)
var done = assert.async()