diff options
| author | XhmikosR <[email protected]> | 2020-06-04 10:41:47 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-06-04 17:53:16 +0300 |
| commit | 8bc6dcd280f096189214561b1f87f015cd2dcba1 (patch) | |
| tree | fcda9b0cad8c9bd49f46a4b8d2e9119d5e7167bd /js/tests/unit | |
| parent | 288b9b82b5a5cb64ec3aaadef13ac934a957e5d2 (diff) | |
| download | bootstrap-8bc6dcd280f096189214561b1f87f015cd2dcba1.tar.xz bootstrap-8bc6dcd280f096189214561b1f87f015cd2dcba1.zip | |
Backport #30936
Add role="dialog" in modals via JavaScript
Diffstat (limited to 'js/tests/unit')
| -rw-r--r-- | js/tests/unit/modal.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index fefd84fce..5434987d8 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -297,6 +297,23 @@ $(function () { .bootstrapModal('show') }) + QUnit.test('should add role="dialog" attribute when shown, remove it again when hidden', function (assert) { + assert.expect(3) + var done = assert.async() + + $('<div id="modal-test"/>') + .on('shown.bs.modal', function () { + assert.ok($('#modal-test').is('[role]'), 'role attribute added') + assert.strictEqual($('#modal-test').attr('role'), 'dialog', 'correct role="dialog" added') + $(this).bootstrapModal('hide') + }) + .on('hidden.bs.modal', function () { + assert.notOk($('#modal-test').is('[role]'), 'role attribute removed') + done() + }) + .bootstrapModal('show') + }) + QUnit.test('should close reopened modal with [data-dismiss="modal"] click', function (assert) { assert.expect(2) var done = assert.async() |
