mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 17:14:04 +02:00
Scrollable modal (#27769)
This commit is contained in:
@@ -790,4 +790,31 @@ $(function () {
|
||||
})
|
||||
.bootstrapModal('show')
|
||||
})
|
||||
|
||||
QUnit.test('should scroll to top of the modal body if the modal has .modal-dialog-scrollable class', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var $modal = $([
|
||||
'<div id="modal-test">',
|
||||
' <div class="modal-dialog modal-dialog-scrollable">',
|
||||
' <div class="modal-content">',
|
||||
' <div class="modal-body" style="height: 100px; overflow-y: auto;">',
|
||||
' <div style="height: 200px" />',
|
||||
' </div>',
|
||||
' </div>',
|
||||
' </div>',
|
||||
'</div>'
|
||||
].join('')).appendTo('#qunit-fixture')
|
||||
|
||||
var $modalBody = $('.modal-body')
|
||||
$modalBody.scrollTop(100)
|
||||
assert.strictEqual($modalBody.scrollTop(), 100)
|
||||
|
||||
$modal.on('shown.bs.modal', function () {
|
||||
assert.strictEqual($modalBody.scrollTop(), 0, 'modal body scrollTop should be 0 when opened')
|
||||
done()
|
||||
})
|
||||
.bootstrapModal('show')
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user