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

Commit 3dcefe9

Browse files
committed
test: add data-ng-repeat test
1 parent 9520c98 commit 3dcefe9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/sortable.e2e.spec.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,35 @@ describe('uiSortable', function() {
166166
});
167167
});
168168

169+
it('should work when "placeholder" option equals the class of items [data-ng-repeat]', function() {
170+
inject(function($compile, $rootScope) {
171+
var element;
172+
element = $compile('<ul ui-sortable="opts" ng-model="items"><li data-ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li></ul>')($rootScope);
173+
$rootScope.$apply(function() {
174+
$rootScope.opts = {
175+
placeholder: 'sortable-item'
176+
};
177+
$rootScope.items = ['One', 'Two', 'Three'];
178+
});
179+
180+
host.append(element);
181+
182+
var li = element.find(':eq(1)');
183+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
184+
li.simulate('drag', { dy: dy });
185+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
186+
expect($rootScope.items).toEqual(listContent(element));
187+
188+
li = element.find(':eq(1)');
189+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
190+
li.simulate('drag', { dy: dy });
191+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
192+
expect($rootScope.items).toEqual(listContent(element));
193+
194+
$(element).remove();
195+
});
196+
});
197+
169198
it('should continue to work after a drag is reverted', function() {
170199
inject(function($compile, $rootScope) {
171200
var element;

0 commit comments

Comments
 (0)