1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-28 23:59:53 +02:00

Merge branch 'v4-dev' into fix-jumping-modal-on-resize

This commit is contained in:
Johann-S
2017-09-03 12:56:04 +02:00
committed by GitHub
28 changed files with 276 additions and 95 deletions

View File

@@ -21,6 +21,8 @@ $(function () {
document.body.removeChild(scrollDiv)
return scrollbarWidth
}
// Simulate scrollbars in PhantomJS
$('html').css('padding-right', '16px')
},
beforeEach: function () {
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
@@ -405,6 +407,30 @@ $(function () {
.bootstrapModal('show')
})
QUnit.test('should not adjust the inline body padding when it does not overflow', function (assert) {
assert.expect(1)
var done = assert.async()
var $body = $(document.body)
var originalPadding = $body.css('padding-right')
// Hide scrollbars to prevent the body overflowing
$body.css('overflow', 'hidden') // real scrollbar (for in-browser testing)
$('html').css('padding-right', '0px') // simulated scrollbar (for PhantomJS)
$('<div id="modal-test"/>')
.on('shown.bs.modal', function () {
var currentPadding = $body.css('padding-right')
assert.strictEqual(currentPadding, originalPadding, 'body padding should not be adjusted')
$(this).bootstrapModal('hide')
// restore scrollbars
$body.css('overflow', 'auto')
$('html').css('padding-right', '16px')
done()
})
.bootstrapModal('show')
})
QUnit.test('should adjust the inline padding of fixed elements when opening and restore when closing', function (assert) {
assert.expect(2)
var done = assert.async()
@@ -539,7 +565,7 @@ $(function () {
$('<div id="modal-test"/>')
.on('hidden.bs.modal', function () {
assert.ok(!$body.attr('style'), 'body does not have inline padding set')
assert.strictEqual($body.attr('style').indexOf('padding-right'), -1, 'body does not have inline padding set')
$style.remove()
done()
})