Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit a551d00

Browse files
committed
Merge pull request #266 from thgreasi/v0.13.x-dev
chore rebase to v0.12.11
2 parents 6a7579f + 2e22b0e commit a551d00

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-sortable",
3-
"version": "0.12.10",
3+
"version": "0.12.11",
44
"description": "This directive allows you to jQueryUI Sortable.",
55
"author": "https://github.com/angular-ui/ui-sortable/graphs/contributors",
66
"license": "MIT",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-sortable",
3-
"version": "0.12.10",
3+
"version": "0.12.11",
44
"description": "This directive allows you to jQueryUI Sortable.",
55
"author": "https://github.com/angular-ui/ui-sortable/graphs/contributors",
66
"license": "MIT",

src/sortable.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ angular.module('ui.sortable', [])
150150
// the start and stop of repeat sections and sortable doesn't
151151
// respect their order (even if we cancel, the order of the
152152
// comments are still messed up).
153-
if (hasSortingHelper(element, ui) && !ui.item.sortable.received) {
153+
if (hasSortingHelper(element, ui) && !ui.item.sortable.received &&
154+
element.sortable( 'option', 'appendTo' ) === 'parent') {
154155
// restore all the savedNodes except .ui-sortable-helper element
155156
// (which is placed last). That way it will be garbage collected.
156157
savedNodes = savedNodes.not(savedNodes.last());

test/sortable.e2e.spec.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,36 @@ describe('uiSortable', function() {
381381
});
382382
});
383383

384+
it('should work when "helper: clone" and "appendTo" options are used together', function() {
385+
inject(function($compile, $rootScope) {
386+
var element;
387+
element = $compile('<ul ui-sortable="opts" ng-model="items"><li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li></ul>')($rootScope);
388+
$rootScope.$apply(function() {
389+
$rootScope.opts = {
390+
helper: 'clone',
391+
appendTo: 'body'
392+
};
393+
$rootScope.items = ['One', 'Two', 'Three'];
394+
});
395+
396+
host.append(element);
397+
398+
var li = element.find(':eq(1)');
399+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
400+
li.simulate('drag', { dy: dy });
401+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
402+
expect($rootScope.items).toEqual(listContent(element));
403+
404+
li = element.find(':eq(2)');
405+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
406+
li.simulate('drag', { dy: dy });
407+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
408+
expect($rootScope.items).toEqual(listContent(element));
409+
410+
$(element).remove();
411+
});
412+
});
413+
384414
it('should work when "helper: clone" and "placeholder" options are used together.', function() {
385415
inject(function($compile, $rootScope) {
386416
var element;
@@ -648,4 +678,4 @@ describe('uiSortable', function() {
648678

649679
});
650680

651-
});
681+
});

0 commit comments

Comments
 (0)