diff options
| author | Johann-S <[email protected]> | 2018-09-12 10:08:39 +0200 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2018-09-13 22:13:36 +0200 |
| commit | a689120fd2af44bfb317f899b42037c46bfcd2fe (patch) | |
| tree | d7eb34da370314588d296221a3683e6156046d80 /js/tests/unit/util.js | |
| parent | 9efed8252249065b7903731d3a2b578df89d2ce0 (diff) | |
| download | bootstrap-a689120fd2af44bfb317f899b42037c46bfcd2fe.tar.xz bootstrap-a689120fd2af44bfb317f899b42037c46bfcd2fe.zip | |
throw error when folks try to use a bad selector
Diffstat (limited to 'js/tests/unit/util.js')
| -rw-r--r-- | js/tests/unit/util.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/js/tests/unit/util.js b/js/tests/unit/util.js index 37327b868..768afc8fe 100644 --- a/js/tests/unit/util.js +++ b/js/tests/unit/util.js @@ -20,6 +20,19 @@ $(function () { assert.strictEqual(Util.getSelectorFromElement($el2[0]), null) }) + QUnit.test('Util.getSelectorFromElement should throw error when there is a bad selector', function (assert) { + assert.expect(2) + + var $el = $('<div data-target="#1"></div>').appendTo($('#qunit-fixture')) + + try { + assert.ok(true, 'trying to use a bad selector') + Util.getSelectorFromElement($el[0]) + } catch (e) { + assert.ok(e instanceof DOMException) + } + }) + QUnit.test('Util.typeCheckConfig should thrown an error when a bad config is passed', function (assert) { assert.expect(1) var namePlugin = 'collapse' |
