2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-05-30 15:24:08 +03:00
Add role="dialog" in modals via JavaScript
This commit is contained in:
XhmikosR
2020-06-04 10:41:47 +03:00
parent 288b9b82b5
commit 8bc6dcd280
4 changed files with 41 additions and 22 deletions
+17
View File
@@ -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()