diff options
| author | Kevin Kirsche <[email protected]> | 2015-02-24 15:28:57 -0500 |
|---|---|---|
| committer | Kevin Kirsche <[email protected]> | 2015-02-24 16:29:40 -0500 |
| commit | 30d8cdf6398f05a58afa303ac324201d08744b90 (patch) | |
| tree | 4dfc04f1e127c749e8324e99c6e3a43867d2c2ef | |
| parent | ecd469ec16225ca6de90992ceeb1c700db54df8a (diff) | |
| download | bootstrap-30d8cdf6398f05a58afa303ac324201d08744b90.tar.xz bootstrap-30d8cdf6398f05a58afa303ac324201d08744b90.zip | |
Add tests for aria-hidden of modal
Add tests for `aria-hidden` of modal
Use strictEqual of 1 here instead of 2 asserts
| -rw-r--r-- | js/tests/unit/modal.js | 26 |
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() |
