diff options
Diffstat (limited to 'js/tests/unit/controller/ContentControllerSpec.js')
-rw-r--r-- | js/tests/unit/controller/ContentControllerSpec.js | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js index decdceeab..e413df672 100644 --- a/js/tests/unit/controller/ContentControllerSpec.js +++ b/js/tests/unit/controller/ContentControllerSpec.js @@ -58,11 +58,18 @@ describe('ContentController', function () { it('should return order by', inject(function ($controller, - SettingsResource) { + SettingsResource, FEED_TYPE) { + var route = { + current: { + $$route: { + type: FEED_TYPE.FOLDER + } + } + }; var ctrl = $controller('ContentController', { - SettingsResource: SettingsResource, data: {}, + $route: route }); expect(ctrl.orderBy()).toBe('-id'); @@ -72,6 +79,33 @@ describe('ContentController', function () { expect(ctrl.orderBy()).toBe('id'); })); + it('should return order if custom ordering', inject(function ($controller, + SettingsResource, FeedResource, FEED_TYPE) { + var route = { + current: { + $$route: { + type: FEED_TYPE.FEED + } + } + }; + FeedResource.receive([ + {id: 1, folderId: 3, url: 'ye', unreadCount: 45, ordering: 1}, + ]); + var ctrl = $controller('ContentController', { + data: {}, + $route: route, + $routeParams: { + id: 1 + } + }); + + expect(ctrl.orderBy()).toBe('id'); + + SettingsResource.set('oldestFirst', true); + + expect(ctrl.orderBy()).toBe('id'); + })); + it('should mark read', inject(function ($controller, ItemResource, FeedResource, Publisher) { |