From 7165a52c83d45d4a68337645ac32e766b8cae326 Mon Sep 17 00:00:00 2001 From: hklemp Date: Mon, 29 Aug 2016 20:58:56 +0200 Subject: [PATCH] Fix-bug: Combobox crash when a custom template is provided --- js/bootstrap-combobox.js | 2 +- js/tests/unit/bootstrap-combobox.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/js/bootstrap-combobox.js b/js/bootstrap-combobox.js index 70725b1..d3f9c37 100755 --- a/js/bootstrap-combobox.js +++ b/js/bootstrap-combobox.js @@ -47,7 +47,7 @@ constructor: Combobox , setup: function () { - var combobox = $(this.template()); + var combobox = typeof(this.template) == "function" ? $(this.template()) : $(this.template) ; this.$source.before(combobox); this.$source.hide(); return combobox; diff --git a/js/tests/unit/bootstrap-combobox.js b/js/tests/unit/bootstrap-combobox.js index f5dcd29..7c73f80 100644 --- a/js/tests/unit/bootstrap-combobox.js +++ b/js/tests/unit/bootstrap-combobox.js @@ -320,4 +320,9 @@ $(function () { combobox.$menu.remove() }) + + test("should return with custom template", function () { + var $select = $('') + ok($($select).combobox({template: '
'})[0] == $select[0], 'select returned') + }) })