aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2015-02-24 13:37:08 -0800
committerChris Rebert <[email protected]>2015-02-24 13:37:08 -0800
commit19fc014397b843cb9e47ca4fb7cc42cc0f4a87d2 (patch)
tree4dfc04f1e127c749e8324e99c6e3a43867d2c2ef
parentecd469ec16225ca6de90992ceeb1c700db54df8a (diff)
parent30d8cdf6398f05a58afa303ac324201d08744b90 (diff)
downloadbootstrap-19fc014397b843cb9e47ca4fb7cc42cc0f4a87d2.tar.xz
bootstrap-19fc014397b843cb9e47ca4fb7cc42cc0f4a87d2.zip
Merge pull request #15905 from kkirsche/modalAriaTests
Add unit tests for aria-hidden to modal suite
-rw-r--r--js/tests/unit/modal.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 42f9b6f99..e52b0ab40 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -44,6 +44,17 @@ $(function () {
.bootstrapModal('show')
})
+ QUnit.test('should set aria-hidden to false when show method is called', function (assert) {
+ var done = assert.async()
+
+ $('<div id="modal-test"/>')
+ .on('shown.bs.modal', function () {
+ assert.strictEqual($('#modal-test').attr('aria-hidden'), 'false', 'aria-hidden is set to string "false" when modal shown')
+ done()
+ })
+ .bootstrapModal('show')
+ })
+
QUnit.test('should fire show event', function (assert) {
var done = assert.async()
@@ -86,6 +97,21 @@ $(function () {
.bootstrapModal('show')
})
+ QUnit.test('should set aria-hidden to true when hide is called', function (assert) {
+ var done = assert.async()
+
+ $('<div id="modal-test"/>')
+ .on('shown.bs.modal', function () {
+ assert.strictEqual($('#modal-test').length, 1, 'modal has been inserted into the dom')
+ $(this).bootstrapModal('hide')
+ })
+ .on('hidden.bs.modal', function () {
+ assert.strictEqual($('#modal-test').attr('aria-hidden'), 'true', 'aria-hidden is set to string "true" when modal shown')
+ done()
+ })
+ .bootstrapModal('show')
+ })
+
QUnit.test('should toggle when toggle is called', function (assert) {
var done = assert.async()