diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 15:57:10 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 15:57:18 +0200 |
commit | 2824b43b7332e847810f042c4183ce95ee90e852 (patch) | |
tree | 9a10f31c8acbf01d72336d3d065f8c8fda4b83c5 /js/vendor/angular-ui/modules/directives/sortable/test/sortableSpec.js | |
parent | f0abeddd07fcf21e30c95d58885416ef40d65391 (diff) |
use bower for managing deps
Diffstat (limited to 'js/vendor/angular-ui/modules/directives/sortable/test/sortableSpec.js')
-rw-r--r-- | js/vendor/angular-ui/modules/directives/sortable/test/sortableSpec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/vendor/angular-ui/modules/directives/sortable/test/sortableSpec.js b/js/vendor/angular-ui/modules/directives/sortable/test/sortableSpec.js new file mode 100644 index 000000000..04a46a072 --- /dev/null +++ b/js/vendor/angular-ui/modules/directives/sortable/test/sortableSpec.js @@ -0,0 +1,40 @@ +describe('uiSortable', function() { + + // Ensure the sortable angular module is loaded + beforeEach(module('ui.directives')); + + describe('simple use', function() { + + it('should have a ui-sortable class', function() { + inject(function($compile, $rootScope) { + var element; + element = $compile("<ul ui-sortable></ul>")($rootScope); + expect(element.hasClass("ui-sortable")).toBeTruthy(); + }); + }); + + it('should update model when order changes', function() { + inject(function($compile, $rootScope) { + var element; + element = $compile('<ul ui-sortable ng-model="items"><li ng-repeat="item in items" id="s-{{$index}}">{{ item }}</li></ul>')($rootScope); + $rootScope.$apply(function() { + return $rootScope.items = ["One", "Two", "Three"]; + }); + + element.find('li:eq(1)').insertAfter(element.find('li:eq(2)')); + + // None of this work, one way is to use .bind("sortupdate") + // and then use .trigger("sortupdate", e, ui) but I have no idea how to + // construct ui object + + // element.sortable('refresh') + // element.sortable('refreshPositions') + // element.trigger('sortupdate') + + // expect($rootScope.items).toEqual(["One", "Three", "Two"]) + }); + }); + + }); + +});
\ No newline at end of file |