Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
filipkis committed Mar 16, 2019
1 parent 9eb1771 commit 89d272f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
3 changes: 0 additions & 3 deletions angular-legacy-sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@
evt.from.insertBefore(nextSibling, evt.item.nextSibling);
}
}

scope.$apply();
}

function _destroy() {
Expand Down Expand Up @@ -177,7 +175,6 @@
onAdd: function (/**Event*/evt) {
_sync(evt);
_emitEvent(evt, removed);
scope.$apply();
},
onUpdate: function (/**Event*/evt) {
_sync(evt);
Expand Down
8 changes: 8 additions & 0 deletions e2e/nested-drag-drop.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,13 @@ describe('nested drag and drop', () => {
expect(value).toBe('item1');
})
})

it('should allow list with nested list to be dropped in a nested list', () => {
browser.get('http://localhost:8080/nested.html')
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 =>{
expect(response).toBeFalsy()
})
browser.sleep(1000)
})
})

13 changes: 9 additions & 4 deletions example/nestedApp.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
angular.module('nestedApp', ['ng-sortable'])
.component('nestedDragAndDropExample', {
template: `<ul id='main-list' ng-sortable="$ctrl.sortableConf">
<li ng-repeat="item in $ctrl.items" >
<span id={{item.name}}> {{ item.name }} </span>
<li ng-repeat="item in $ctrl.items" id="{{item.name}}">
{{ item.name }}
<div ng-if="item.items">
<ul class='nested-list' ng-sortable="$ctrl.nestedSortableConf">
<li ng-repeat="subitem in item.items" >
<span id={{subitem.name}}> {{ subitem.name }} </span>
<li ng-repeat="subitem in item.items" id="{{subitem.name}}">
{{ subitem.name }}
</li>
</ul>
</div>
Expand All @@ -25,6 +25,11 @@ angular.module('nestedApp', ['ng-sortable'])
},
{
name: 'item2',
items: [
{
name: 'subitem2',
}
]
},
{
name: 'item3'
Expand Down

0 comments on commit 89d272f

Please sign in to comment.