Skip to content

Commit 89d272f

Browse files
committed
1 parent 9eb1771 commit 89d272f

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

angular-legacy-sortable.js

-3
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@
137137
evt.from.insertBefore(nextSibling, evt.item.nextSibling);
138138
}
139139
}
140-
141-
scope.$apply();
142140
}
143141

144142
function _destroy() {
@@ -177,7 +175,6 @@
177175
onAdd: function (/**Event*/evt) {
178176
_sync(evt);
179177
_emitEvent(evt, removed);
180-
scope.$apply();
181178
},
182179
onUpdate: function (/**Event*/evt) {
183180
_sync(evt);

e2e/nested-drag-drop.e2e.js

+8
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,13 @@ describe('nested drag and drop', () => {
1717
expect(value).toBe('item1');
1818
})
1919
})
20+
21+
it('should allow list with nested list to be dropped in a nested list', () => {
22+
browser.get('http://localhost:8080/nested.html')
23+
browser.executeAsyncScript('var done = arguments[0]; window.onerror = done; $("#item2").simulate("drag-n-drop", { dragTarget: $("#subitem1"), interpolation: {stepWidth: 2, stepDelay: 30}}); setTimeout(done, 1000)').then(response =>{
24+
expect(response).toBeFalsy()
25+
})
26+
browser.sleep(1000)
27+
})
2028
})
2129

example/nestedApp.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
angular.module('nestedApp', ['ng-sortable'])
22
.component('nestedDragAndDropExample', {
33
template: `<ul id='main-list' ng-sortable="$ctrl.sortableConf">
4-
<li ng-repeat="item in $ctrl.items" >
5-
<span id={{item.name}}> {{ item.name }} </span>
4+
<li ng-repeat="item in $ctrl.items" id="{{item.name}}">
5+
{{ item.name }}
66
<div ng-if="item.items">
77
<ul class='nested-list' ng-sortable="$ctrl.nestedSortableConf">
8-
<li ng-repeat="subitem in item.items" >
9-
<span id={{subitem.name}}> {{ subitem.name }} </span>
8+
<li ng-repeat="subitem in item.items" id="{{subitem.name}}">
9+
{{ subitem.name }}
1010
</li>
1111
</ul>
1212
</div>
@@ -25,6 +25,11 @@ angular.module('nestedApp', ['ng-sortable'])
2525
},
2626
{
2727
name: 'item2',
28+
items: [
29+
{
30+
name: 'subitem2',
31+
}
32+
]
2833
},
2934
{
3035
name: 'item3'

0 commit comments

Comments
 (0)