Skip to content

Commit

Permalink
Widget display '[object Object]' when clear text with the 'text' meth…
Browse files Browse the repository at this point in the history
…od. Fixes #2087
  • Loading branch information
ggkrustev committed Aug 22, 2016
1 parent cb3917b commit 026cde4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/kendo.dropdownlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,10 @@ var __meta__ = { // jshint ignore:line
if (this.hasOptionLabel()) {
if (dataItem === optionLabelText || this._text(dataItem) === optionLabelText) {
template = this.optionLabelTemplate;

if (typeof this.options.optionLabel === "string" && !this.options.optionLabelTemplate) {
dataItem = optionLabelText;
}
}
}

Expand Down
14 changes: 14 additions & 0 deletions tests/dropdownlist/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,20 @@
equal(data.value, "");
});

test("text method passes optionLabel text to the template", 1, function() {
dropdownlist = input.kendoDropDownList({
optionLabel: "test",
dataTextField: "text",
dataValueField: "value",
dataSource: [{ text: "Chai", value: 1 }],
value: 1
}).data("kendoDropDownList");

dropdownlist.text(null);

equal(dropdownlist.text(), "test");
});

test('enable(false) should disable dropDownList', function() {
dropdownlist = new DropDownList(input);

Expand Down

0 comments on commit 026cde4

Please sign in to comment.