]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add tests for aria-hidden of modal 15905/head
authorKevin Kirsche <kkirsche@ansfederal.com>
Tue, 24 Feb 2015 20:28:57 +0000 (15:28 -0500)
committerKevin Kirsche <kkirsche@ansfederal.com>
Tue, 24 Feb 2015 21:29:40 +0000 (16:29 -0500)
Add tests for `aria-hidden` of modal

Use strictEqual of 1 here instead of 2 asserts

js/tests/unit/modal.js

index 42f9b6f99288441ac9498097d76f22182eadfe26..e52b0ab40b8f4a0872f10dd2143ccde020ece81d 100644 (file)
@@ -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()