Skip to content

Commit 9cd1d65

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 08ffc56 commit 9cd1d65

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/kendo.listbox.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ var __meta__ = { // jshint ignore:line
748748
var that = this;
749749
var dataSource = that.dataSource;
750750
var dataItem = that.dataItem(item);
751+
var transport = dataSource.transport;
752+
751753
if (!dataItem || !dataSource) {
752754
return;
753755
}
@@ -762,6 +764,10 @@ var __meta__ = { // jshint ignore:line
762764
}
763765
} else {
764766
dataSource.remove(dataItem);
767+
if (transport && (transport.destroy || (transport.options || {}).destroy) &&
768+
(!dataItem.isNew || !dataItem.isNew())) {
769+
dataSource._destroyed.push(dataItem);
770+
}
765771
}
766772
that._removeElement(item);
767773
},

styles/web/Default/listview/_layout.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
flex: 1 1 auto;
4747
align-content: flex-start;
4848
position: relative;
49+
overflow: auto;
4950

5051
&::after {
5152
height: 0;

tests/listbox/api.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@
2525
var SELECTED_STATE_CLASS = "k-state-selected";
2626
var DOT = ".";
2727

28+
function createListBoxCRUD(options, html) {
29+
var listbox = createListBoxFromHtml(html, $.extend({
30+
dataSource: {
31+
transport: {
32+
read: function (e) {
33+
e.success(dataItems);
34+
},
35+
destroy: $.noop,
36+
create: $.noop,
37+
update: $.noop
38+
}
39+
},
40+
dataTextField: "text"
41+
}, options || {}));
42+
43+
return listbox;
44+
}
45+
2846
function createListBox(options, html) {
2947
var listbox = createListBoxFromHtml(html, $.extend({
3048
dataSource: {
@@ -185,6 +203,22 @@
185203
});
186204
});
187205

206+
describe("ListBox api", function() {
207+
beforeEach(function() {
208+
listbox = createListBoxCRUD();
209+
});
210+
afterEach(function() {
211+
destroyListBox(listbox);
212+
kendo.destroy(Mocha.fixture);
213+
});
214+
215+
it("removing item pushes it in the destroyed collection", function() {
216+
listbox.remove(FIRST_ITEM_SELECTOR);
217+
218+
assert.equal(listbox.dataSource._destroyed.length, 1);
219+
});
220+
});
221+
188222
describe("ListBox api", function() {
189223
beforeEach(function() {
190224
listbox = createListBox();

0 commit comments

Comments
 (0)