From 9b8356ba52d89fd065d6061979b5946b8c5f44fa Mon Sep 17 00:00:00 2001 From: Johann-S Date: Mon, 25 Sep 2017 12:41:54 +0200 Subject: Collapse - Allow to pass jQuery object or DOM element to the parent option --- js/tests/unit/collapse.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'js/tests') diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index 9ecb60994..c36fe25be 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -698,4 +698,48 @@ $(function () { $target.trigger($.Event('click')) }) + + QUnit.test('should allow jquery object in parent config', function (assert) { + assert.expect(1) + var html = + '
' + + '
' + + ' Toggle item' + + '
Lorem ipsum
' + + '
' + + '
' + + $(html).appendTo('#qunit-fixture') + try { + $('[data-toggle="collapse"]').bootstrapCollapse({ + parent: $('.my-collapse') + }) + assert.ok(true, 'collapse correctly created') + } + catch (e) { + assert.ok(false, 'collapse not created') + } + }) + + QUnit.test('should allow DOM object in parent config', function (assert) { + assert.expect(1) + var html = + '
' + + '
' + + ' Toggle item' + + '
Lorem ipsum
' + + '
' + + '
' + + $(html).appendTo('#qunit-fixture') + try { + $('[data-toggle="collapse"]').bootstrapCollapse({ + parent: $('.my-collapse')[0] + }) + assert.ok(true, 'collapse correctly created') + } + catch (e) { + assert.ok(false, 'collapse not created') + } + }) }) -- cgit v1.2.3