mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-11 08:54:23 +01:00
Merge pull request #17536 from Johann-S/testPadding
[Fix #17400] Add tests about padding restoration
This commit is contained in:
commit
c01fa6b369
@ -363,6 +363,44 @@ $(function () {
|
|||||||
.bootstrapModal('show')
|
.bootstrapModal('show')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
QUnit.test('should have a paddingRight when the modal is taller than the viewport', function (assert) {
|
||||||
|
assert.expect(2)
|
||||||
|
var done = assert.async()
|
||||||
|
$('<div class="navbar-fixed-top navbar-fixed-bottom is-fixed">@Johann-S</div>').appendTo('#qunit-fixture')
|
||||||
|
$('.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed').css('padding-right', '10px')
|
||||||
|
|
||||||
|
$('<div id="modal-test"/>')
|
||||||
|
.on('shown.bs.modal', function () {
|
||||||
|
var paddingRight = parseInt($(document.body).css('padding-right'), 10)
|
||||||
|
assert.strictEqual(isNaN(paddingRight), false)
|
||||||
|
assert.strictEqual(paddingRight !== 0, true)
|
||||||
|
$(document.body).css('padding-right', ''); // Because test case "should ignore other inline styles when trying to restore body padding after closing" fail if not
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
.bootstrapModal('show')
|
||||||
|
})
|
||||||
|
|
||||||
|
QUnit.test('should remove padding-right on modal after closing', function (assert) {
|
||||||
|
assert.expect(3)
|
||||||
|
var done = assert.async()
|
||||||
|
$('<div class="navbar-fixed-top navbar-fixed-bottom is-fixed">@Johann-S</div>').appendTo('#qunit-fixture')
|
||||||
|
$('.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed').css('padding-right', '10px')
|
||||||
|
|
||||||
|
$('<div id="modal-test"/>')
|
||||||
|
.on('shown.bs.modal', function () {
|
||||||
|
var paddingRight = parseInt($(document.body).css('padding-right'), 10)
|
||||||
|
assert.strictEqual(isNaN(paddingRight), false)
|
||||||
|
assert.strictEqual(paddingRight !== 0, true)
|
||||||
|
$(this).bootstrapModal('hide')
|
||||||
|
})
|
||||||
|
.on('hidden.bs.modal', function () {
|
||||||
|
var paddingRight = parseInt($(document.body).css('padding-right'), 10)
|
||||||
|
assert.strictEqual(paddingRight, 0)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
.bootstrapModal('show')
|
||||||
|
})
|
||||||
|
|
||||||
QUnit.test('should ignore other inline styles when trying to restore body padding after closing', function (assert) {
|
QUnit.test('should ignore other inline styles when trying to restore body padding after 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