diff --git a/angular-legacy-sortable.js b/angular-legacy-sortable.js index ba8f868..f93497c 100644 --- a/angular-legacy-sortable.js +++ b/angular-legacy-sortable.js @@ -137,8 +137,6 @@ evt.from.insertBefore(nextSibling, evt.item.nextSibling); } } - - scope.$apply(); } function _destroy() { @@ -175,7 +173,6 @@ onAdd: function (/**Event*/evt) { _sync(evt); _emitEvent(evt, removed); - scope.$apply(); }, onUpdate: function (/**Event*/evt) { _sync(evt); diff --git a/e2e/conf.js b/e2e/conf.js index f469e30..ec0f6c1 100644 --- a/e2e/conf.js +++ b/e2e/conf.js @@ -1,4 +1,4 @@ exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', - specs: ['./basic-drag-drop.e2e.js'], + specs: ['./basic-drag-drop.e2e.js', './nested-drag-drop.e2e.js'], } diff --git a/e2e/nested-drag-drop.e2e.js b/e2e/nested-drag-drop.e2e.js new file mode 100644 index 0000000..4f04c71 --- /dev/null +++ b/e2e/nested-drag-drop.e2e.js @@ -0,0 +1,11 @@ +describe('nested drag and drop', () => { + + 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) + }) +}) + \ No newline at end of file diff --git a/example/nested.html b/example/nested.html new file mode 100644 index 0000000..b7612fd --- /dev/null +++ b/example/nested.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/example/nestedApp.js b/example/nestedApp.js new file mode 100644 index 0000000..c79e4b5 --- /dev/null +++ b/example/nestedApp.js @@ -0,0 +1,53 @@ +angular.module('nestedApp', ['ng-sortable']) +.component('nestedDragAndDropExample', { + template: ``, + controller: class ExampleAppController { + constructor() { + var _this = this; + this.items = [{ + name: 'item1', + items: [ + { + name: 'subitem1', + } + ] + }, + { + name: 'item2', + items: [ + { + name: 'subitem2', + } + ] + }, + { + name: 'item3' + }] + this.onEnd = function(event) { + _this.lastDragged = event.model; + } + + this.sortableConf = { + group: 'all', + forceFallback: true, + onEnd: this.onEnd + } + this.nestedSortableConf = { + group: 'all', + forceFallback: true, + onEnd: this.onEnd + } + } + }, +})