Skip to content

Commit d0b0d2a

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 64abd9e commit d0b0d2a

File tree

6 files changed

+185
-1
lines changed

6 files changed

+185
-1
lines changed

src/kendo.list.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,18 @@ var __meta__ = { // jshint ignore:line
969969
}
970970
},
971971

972+
_refreshScroll: function () {
973+
var listView = this.listView;
974+
var enableYScroll = listView.element.height() > listView.content.height();
975+
976+
if (this.options.autoWidth) {
977+
listView.content.css({
978+
overflowX: "hidden",
979+
overflowY: enableYScroll ? "scroll" : "auto"
980+
});
981+
}
982+
},
983+
972984
_resizePopup: function(force) {
973985
if (this.options.virtual) {
974986
return;
@@ -980,6 +992,8 @@ var __meta__ = { // jshint ignore:line
980992
this._calculatePopupHeight(force);
981993
}, this);
982994
}).call(this, force));
995+
996+
this.popup.one("activate", proxy(this._refreshScroll, this));
983997
} else {
984998
this._calculatePopupHeight(force);
985999
}

src/kendo.menu.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ var __meta__ = { // jshint ignore:line
10911091
popup = ul.kendoPopup({
10921092
activate: function() { that._triggerEvent({ item: this.wrapper.parent(), type: ACTIVATE }); },
10931093
deactivate: function(e) {
1094+
that._closing = false;
10941095
e.sender.element // Restore opacity after fade.
10951096
.removeData("targetTransform")
10961097
.css({ opacity: "" });
@@ -1107,6 +1108,7 @@ var __meta__ = { // jshint ignore:line
11071108
},
11081109
open: proxy(that._popupOpen, that),
11091110
close: function (e) {
1111+
that._closing = true;
11101112
var li = e.sender.wrapper.parent();
11111113

11121114
if (overflowWrapper) {
@@ -1420,7 +1422,7 @@ var __meta__ = { // jshint ignore:line
14201422
that._openedPopups[popupId.toString()] = true;
14211423
}
14221424

1423-
if (e.delegateTarget != element.parents(menuSelector)[0] && e.delegateTarget != element.parents(".k-menu-scroll-wrapper,.k-popups-wrapper")[0]) {
1425+
if (that._closing || (e.delegateTarget != element.parents(menuSelector)[0] && e.delegateTarget != element.parents(".k-menu-scroll-wrapper,.k-popups-wrapper")[0])) {
14241426
return;
14251427
}
14261428

tests/autocomplete/filtering.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,27 @@ it("autoWidth adds one pixel to avoid browser pixel rounding", function() {
491491
assert.closeTo(autocomplete.popup.element.parent(".k-animation-container").width(), autocomplete.popup.element.outerWidth(true) + 1, 0.1);
492492
});
493493

494+
it("enabled autoWidth disables X scrolling", function() {
495+
var autocomplete = new AutoComplete(input, {
496+
autoWidth: true,
497+
animation:{
498+
open: {
499+
duration:0
500+
},
501+
close: {
502+
duration:0
503+
},
504+
},
505+
dataSource: {
506+
data: ["Short item", "An item with really, really, really, really, really, really, really, really, really, long text","Short item"]
507+
508+
}
509+
});
510+
511+
autocomplete.search("a");
512+
assert.equal(autocomplete.listView.content.css("overflow"), "hidden auto")
513+
});
514+
494515
it("update popup height when no items are found", function(done) {
495516
var autocomplete = new AutoComplete(input, {
496517
dataSource: $.map(new Array(30), function(_, idx) { return "item" + idx.toString() })

tests/combobox/searching.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,55 @@ it("autoWidth adds one pixel to avoid browser pixel rounding", function() {
11281128
assert.closeTo(combobox.popup.element.parent(".k-animation-container").width(), combobox.popup.element.outerWidth(true) + 1, 0.1);
11291129
});
11301130

1131+
it("enabled autoWidth disables X scrolling", function() {
1132+
var combobox = new ComboBox(input, {
1133+
autoWidth: true,
1134+
animation:{
1135+
open: {
1136+
duration:0
1137+
},
1138+
close: {
1139+
duration:0
1140+
},
1141+
},
1142+
dataSource: {
1143+
data: ["Short item", "An item with really, really, really, really, really, really, really, really, really, long text","Short item"]
1144+
1145+
}
1146+
});
1147+
1148+
combobox.open();
1149+
assert.equal(combobox.listView.content.css("overflow"), "hidden auto")
1150+
});
1151+
1152+
it("enabled autoWidth sets overflowX to scroll when scrolling is needed", function() {
1153+
var combobox = new ComboBox(input, {
1154+
autoWidth: true,
1155+
animation:{
1156+
open: {
1157+
duration:0
1158+
},
1159+
close: {
1160+
duration:0
1161+
},
1162+
},
1163+
dataSource: {
1164+
data: [
1165+
"Short item",
1166+
"An item with really, really, really, really, really, really, really, really, really, long text",
1167+
"Short item",
1168+
"Short item",
1169+
"Short item",
1170+
"Short item",
1171+
"Short item"
1172+
]
1173+
}
1174+
});
1175+
1176+
combobox.open();
1177+
assert.equal(combobox.listView.content.css("overflow"), "hidden scroll")
1178+
});
1179+
11311180
it("keep popup opened on empty search result if noDataTemplate", function() {
11321181
var combobox = new ComboBox(input, {
11331182
animation: false,

tests/dropdownlist/searching.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,55 @@
743743
assert.closeTo(dropdownlist.popup.element.parent(".k-animation-container").width(), dropdownlist.popup.element.outerWidth(true) + 1, 0.1);
744744
});
745745

746+
it("enabled autoWidth disables X scrolling", function() {
747+
var dropdownlist = new DropDownList(input, {
748+
autoWidth: true,
749+
animation:{
750+
open: {
751+
duration:0
752+
},
753+
close: {
754+
duration:0
755+
},
756+
},
757+
dataSource: {
758+
data: ["Short item", "An item with really, really, really, really, really, really, really, really, really, long text","Short item"]
759+
760+
}
761+
});
762+
763+
dropdownlist.open();
764+
assert.equal(dropdownlist.listView.content.css("overflow"), "hidden auto")
765+
});
766+
767+
it("enabled autoWidth sets overflowX to scroll when scrolling is needed", function() {
768+
var dropdownlist = new DropDownList(input, {
769+
autoWidth: true,
770+
animation:{
771+
open: {
772+
duration:0
773+
},
774+
close: {
775+
duration:0
776+
},
777+
},
778+
dataSource: {
779+
data: [
780+
"Short item",
781+
"An item with really, really, really, really, really, really, really, really, really, long text",
782+
"Short item",
783+
"Short item",
784+
"Short item",
785+
"Short item",
786+
"Short item"
787+
]
788+
}
789+
});
790+
791+
dropdownlist.open();
792+
assert.equal(dropdownlist.listView.content.css("overflow"), "hidden scroll")
793+
});
794+
746795
it("removes filtering expression if field matches the dataTextField", function() {
747796
var dropdownlist = new DropDownList(input, {
748797
filter: "startswith",

tests/multiselect/filtering.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,55 @@
710710
assert.equal(multiselect.popup.element.parent(".k-animation-container").width(), multiselect.popup.element.outerWidth(true) + 1);
711711
});
712712

713+
it("enabled autoWidth disables X scrolling", function() {
714+
var multiselect = new MultiSelect(select, {
715+
autoWidth: true,
716+
animation:{
717+
open: {
718+
duration:0
719+
},
720+
close: {
721+
duration:0
722+
},
723+
},
724+
dataSource: {
725+
data: ["Short item", "An item with really, really, really, really, really, really, really, really, really, long text","Short item"]
726+
727+
}
728+
});
729+
730+
multiselect.open();
731+
assert.equal(multiselect.listView.content.css("overflow"), "hidden auto")
732+
});
733+
734+
it("enabled autoWidth sets overflowX to scroll when scrolling is needed", function() {
735+
var multiselect = new MultiSelect(select, {
736+
autoWidth: true,
737+
animation:{
738+
open: {
739+
duration:0
740+
},
741+
close: {
742+
duration:0
743+
},
744+
},
745+
dataSource: {
746+
data: [
747+
"Short item",
748+
"An item with really, really, really, really, really, really, really, really, really, long text",
749+
"Short item",
750+
"Short item",
751+
"Short item",
752+
"Short item",
753+
"Short item"
754+
]
755+
}
756+
});
757+
758+
multiselect.open();
759+
assert.equal(multiselect.listView.content.css("overflow"), "hidden scroll")
760+
});
761+
713762
it("update popup height when no items are found", function(done) {
714763
popuplateSelect(30);
715764

0 commit comments

Comments
 (0)