diff options
| author | Johann-S <[email protected]> | 2017-09-03 13:00:10 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-09-03 13:00:10 +0200 |
| commit | 900da3e235305c2daefe86c0a960e36be6e1b60b (patch) | |
| tree | a4c5d188bf8416fe7b801fbac79a2ad21af7012e | |
| parent | 2e5f1e22860a892f5abdbb65abc14172e0129c1a (diff) | |
| parent | e04e42d08c059732153ff6925fa712464cf12207 (diff) | |
| download | bootstrap-900da3e235305c2daefe86c0a960e36be6e1b60b.tar.xz bootstrap-900da3e235305c2daefe86c0a960e36be6e1b60b.zip | |
Merge pull request #23732 from techdavid/fix-jumping-modal-on-resize
Fix jumping modal when the viewport is resized
| -rw-r--r-- | js/src/modal.js | 2 | ||||
| -rw-r--r-- | js/tests/unit/modal.js | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index 4068471cd..689e93bc1 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -136,6 +136,8 @@ const Modal = (() => { this._checkScrollbar() this._setScrollbar() + this._adjustDialog() + $(document.body).addClass(ClassName.OPEN) this._setEscapeEvent() diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 735dc4f0c..e026cd7f1 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -351,6 +351,20 @@ $(function () { $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) { assert.expect(2) var done = assert.async() |
