From aee7a83449230f8835c6d98838c565303b633fc1 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 12 Sep 2014 02:07:01 +0200 Subject: add styling for error, disable draggable on error --- .../unit/controller/NavigationControllerSpec.js | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js index 162e04516..23f1b3522 100644 --- a/js/tests/unit/controller/NavigationControllerSpec.js +++ b/js/tests/unit/controller/NavigationControllerSpec.js @@ -441,7 +441,7 @@ describe('NavigationController', function () { })); - it('should move a folder', inject(function ($controller, FEED_TYPE, + it('should move a feed', inject(function ($controller, FEED_TYPE, FeedResource) { FeedResource.move = jasmine.createSpy('move'); @@ -462,13 +462,42 @@ describe('NavigationController', function () { $route: route }); + ctrl.moveFeed(1, 4); + + expect(FeedResource.move).toHaveBeenCalledWith(1, 4); + expect(route.reload).not.toHaveBeenCalled(); + })); + + + it('should not move a feed if nothing changed', inject(function ( + $controller, FEED_TYPE, FeedResource) { + FeedResource.move = jasmine.createSpy('move'); + + var route = { + reload: jasmine.createSpy('reload'), + current: { + $$route: { + type: FEED_TYPE.FOLDER + }, + params: { + id: 2 + } + } + }; + + var ctrl = $controller('NavigationController', { + FeedResource: FeedResource, + $route: route + }); + ctrl.moveFeed(1, 3); - expect(FeedResource.move).toHaveBeenCalledWith(1, 3); + expect(FeedResource.move).not.toHaveBeenCalled(); expect(route.reload).not.toHaveBeenCalled(); })); + it('should reload if a feed is moved from active folder', inject( function ($controller, FEED_TYPE, FeedResource) { FeedResource.move = jasmine.createSpy('move'); -- cgit v1.2.3