summaryrefslogtreecommitdiffstats
path: root/js/tests/unit/controller/NavigationControllerSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/controller/NavigationControllerSpec.js')
-rw-r--r--js/tests/unit/controller/NavigationControllerSpec.js33
1 files changed, 31 insertions, 2 deletions
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');