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:
commit
900da3e235
@ -136,6 +136,8 @@ const Modal = (() => {
|
|||||||
this._checkScrollbar()
|
this._checkScrollbar()
|
||||||
this._setScrollbar()
|
this._setScrollbar()
|
||||||
|
|
||||||
|
this._adjustDialog()
|
||||||
|
|
||||||
$(document.body).addClass(ClassName.OPEN)
|
$(document.body).addClass(ClassName.OPEN)
|
||||||
|
|
||||||
this._setEscapeEvent()
|
this._setEscapeEvent()
|
||||||
|
@ -351,6 +351,20 @@ $(function () {
|
|||||||
$toggleBtn.trigger('click')
|
$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) {
|
QUnit.test('should adjust the inline body padding when opening and restore when closing', function (assert) {
|
||||||
assert.expect(2)
|
assert.expect(2)
|
||||||
var done = assert.async()
|
var done = assert.async()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user