Skip to content

Commit

Permalink
Sync with Kendo UI Professional
Browse files Browse the repository at this point in the history
  • Loading branch information
kendo-bot committed May 3, 2024
1 parent 7280c27 commit 108b499
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/kendo.colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@ var __meta__ = {
options = that.options = kendo.deepExtend({}, that.options, options);
element = that.element;

var value = element.attr("value") || element.val();
if (value) {
value = parseColor(value, true);
} else {
value = parseColor(options.value, true);
}
let value = parseColor(options.value || element.attr("value") || element.val(), true);
that._value = options.value = value;

var _buttonHtml = kendo.html.renderButton('<button class="k-input-button" unselectable="on" aria-label="select" tabindex="-1"></button>', $.extend({}, that.options, {
Expand Down
19 changes: 19 additions & 0 deletions tests/colorpicker/initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,24 @@

assert.isOk(!cp.wrapper.hasClass("k-disabled"));
});

it("sets value when option is set", function() {
const COLOR = "#008000";

var dom = $("<input tabindex='5' />").appendTo(Mocha.fixture).kendoColorPicker({
value: COLOR
});
assert.equal(dom.val(), COLOR);
});

it("sets value option with higher specificity when value attribute is declared", function() {
const COLOR = "#008000";

var dom = $("<input tabindex='5' color='red' />").appendTo(Mocha.fixture).kendoColorPicker({
value: COLOR
});

assert.equal(dom.val(), COLOR);
});
});
}());

0 comments on commit 108b499

Please sign in to comment.