Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/bootstrap-combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions js/tests/unit/bootstrap-combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,9 @@ $(function () {

combobox.$menu.remove()
})

test("should return with custom template", function () {
var $select = $('<select title="A title"><option></option><option>aa</option><option selected>ab</option><option>ac</option></select>')
ok($($select).combobox({template: '<div class="combobox-container"> <input type="hidden" /> <div class="input-group"> <input type="text" autocomplete="false" /> <span class="input-group-addon dropdown-toggle" data-dropdown="dropdown"> <span class="caret" /> <span class="glyphicon glyphicon-remove" /> </span> </div> </div>'})[0] == $select[0], 'select returned')
})
})