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

Commit 8117b08

Browse files
committed
Initial commit with working simple test. Added jquery-simulate for drag&drop testing.
1 parent 35484b2 commit 8117b08

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"dependencies": {
1919
"angular": "~1.x",
20-
"jquery-ui": ">= 1.9"
20+
"jquery-ui": ">= 1.9",
21+
"jquery-simulate": "latest"
2122
},
2223
"devDependencies": {
2324
"angular-mocks": "~1.x"

test/sortable.spec.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ describe('uiSortable', function() {
2323

2424
element.find('li:eq(1)').insertAfter(element.find('li:eq(2)'));
2525

26-
// None of this work, one way is to use .bind("sortupdate")
27-
// and then use .trigger("sortupdate", e, ui) but I have no idea how to
28-
// construct ui object
29-
30-
// element.sortable('refresh')
31-
// element.sortable('refreshPositions')
32-
// element.trigger('sortupdate')
33-
34-
// expect($rootScope.items).toEqual(["One", "Three", "Two"])
26+
$('body').append(element);
27+
var li = element.find(':eq(1)');
28+
var dy = 1.25 * li.outerHeight();
29+
li.simulate('drag', { dx: 0, dy: dy });
30+
31+
expect($rootScope.items).toEqual(["One", "Three", "Two"]);
32+
$(element).remove();
3533
});
3634
});
3735

test/test.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ files = [
33
JASMINE,
44
JASMINE_ADAPTER,
55
'bower_components/jquery/jquery.js',
6+
'bower_components/jquery-simulate/jquery.simulate.js',
67
'bower_components/jquery-ui/ui/jquery-ui.js',
78
'bower_components/angular/angular.js',
89
'bower_components/angular-mocks/angular-mocks.js',

0 commit comments

Comments
 (0)