From a689120fd2af44bfb317f899b42037c46bfcd2fe Mon Sep 17 00:00:00 2001 From: Johann-S Date: Wed, 12 Sep 2018 10:08:39 +0200 Subject: throw error when folks try to use a bad selector --- js/tests/unit/util.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'js/tests/unit/util.js') 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 = $('
').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' -- cgit v1.2.3