From 53679811da855acf9bd944a389a48399ca5d5a15 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 10 Aug 2015 20:20:30 +0200 Subject: serverside full text remove enhancers add full text client side implementation fix bugs and tests for full text feed --- .../unit/controller/NavigationControllerSpec.js | 38 ++++++++++++++++++++++ js/tests/unit/service/FeedResourceSpec.js | 14 ++++++++ 2 files changed, 52 insertions(+) (limited to 'js/tests') diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js index d6b016c9a..78d2fc914 100644 --- a/js/tests/unit/controller/NavigationControllerSpec.js +++ b/js/tests/unit/controller/NavigationControllerSpec.js @@ -1038,6 +1038,44 @@ describe('NavigationController', function () { })); + it ('should set the full text feed', + inject(function ($controller, FeedResource, $rootScope) { + + FeedResource.add({ + id: 2, + url: 'http://test.com', + folderId: 3, + fullTextEnabled: false + }); + + $rootScope.$broadcast = jasmine.createSpy('broadcast'); + + FeedResource.toggleFullText = jasmine.createSpy('ordering'); + FeedResource.toggleFullText.and.callFake(function () { + return { + finally: function (cb) { + cb(); + } + }; + }); + + var route = { + reload: jasmine.createSpy('reload') + }; + var ctrl = $controller('NavigationController', { + $route: route + }); + + ctrl.toggleFullText(FeedResource.getById(2)); + + expect($rootScope.$broadcast).toHaveBeenCalledWith('$routeChangeStart'); + expect($rootScope.$broadcast). + toHaveBeenCalledWith('$routeChangeSuccess'); + expect(FeedResource.toggleFullText).toHaveBeenCalledWith(2); + expect(route.reload).toHaveBeenCalled(); + })); + + it ('should set location on search', inject(function ($controller) { var location = { search: jasmine.createSpy('search') diff --git a/js/tests/unit/service/FeedResourceSpec.js b/js/tests/unit/service/FeedResourceSpec.js index 75aa35deb..15c237929 100644 --- a/js/tests/unit/service/FeedResourceSpec.js +++ b/js/tests/unit/service/FeedResourceSpec.js @@ -301,4 +301,18 @@ describe('FeedResource', function () { expect(FeedResource.getById(3).ordering).toBe(2); })); + + it ('should toggle full text', inject(function (FeedResource) { + http.expectPOST('base/feeds/3/fulltext', { + fullTextEnabled: true + }).respond(200, {}); + + FeedResource.getById(3).fullTextEnabled = false; + FeedResource.toggleFullText(3); + + expect(FeedResource.getById(3).fullTextEnabled).toBe(true); + http.flush(); + + })); + }); -- cgit v1.2.3