diff options
| author | Shohei Yoshida <[email protected]> | 2019-01-21 06:28:16 +0900 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2019-01-20 23:28:16 +0200 |
| commit | de0bb1e0522d14bcdef70746da277992f992f83c (patch) | |
| tree | b48397d9cd7f0e1f695a9b7beb56abf728e65bf8 /js/tests/unit | |
| parent | 41f85b64bf6dd7aae13c1b9e5ca6ed310bfa1bbf (diff) | |
| download | bootstrap-de0bb1e0522d14bcdef70746da277992f992f83c.tar.xz bootstrap-de0bb1e0522d14bcdef70746da277992f992f83c.zip | |
Scrollable modal (#27769)
Diffstat (limited to 'js/tests/unit')
| -rw-r--r-- | js/tests/unit/modal.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 4d7682aaa..176290480 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -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') + }) }) |
