Skip to content

Commit d3e4ddd

Browse files
committed
Sync with Kendo UI Professional
1 parent f3d7dc3 commit d3e4ddd

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/kendo.colorpicker.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,7 @@ var __meta__ = {
6969
options = that.options = kendo.deepExtend({}, that.options, options);
7070
element = that.element;
7171

72-
var value = element.attr("value") || element.val();
73-
if (value) {
74-
value = parseColor(value, true);
75-
} else {
76-
value = parseColor(options.value, true);
77-
}
72+
let value = parseColor(options.value || element.attr("value") || element.val(), true);
7873
that._value = options.value = value;
7974

8075
var _buttonHtml = kendo.html.renderButton('<button class="k-input-button" unselectable="on" aria-label="select" tabindex="-1"></button>', $.extend({}, that.options, {

tests/colorpicker/initialization.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,24 @@
108108

109109
assert.isOk(!cp.wrapper.hasClass("k-disabled"));
110110
});
111+
112+
it("sets value when option is set", function() {
113+
const COLOR = "#008000";
114+
115+
var dom = $("<input tabindex='5' />").appendTo(Mocha.fixture).kendoColorPicker({
116+
value: COLOR
117+
});
118+
assert.equal(dom.val(), COLOR);
119+
});
120+
121+
it("sets value option with higher specificity when value attribute is declared", function() {
122+
const COLOR = "#008000";
123+
124+
var dom = $("<input tabindex='5' color='red' />").appendTo(Mocha.fixture).kendoColorPicker({
125+
value: COLOR
126+
});
127+
128+
assert.equal(dom.val(), COLOR);
129+
});
111130
});
112131
}());

0 commit comments

Comments
 (0)