summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-08-10 20:20:30 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2015-08-12 17:05:18 +0200
commit53679811da855acf9bd944a389a48399ca5d5a15 (patch)
treefa75e06a965fb5751017288a5c135bc179574210 /js/tests
parentc77a6705d34c81cb933f3d4b83eb18e2b586035a (diff)
serverside full text
remove enhancers add full text client side implementation fix bugs and tests for full text feed
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/controller/NavigationControllerSpec.js38
-rw-r--r--js/tests/unit/service/FeedResourceSpec.js14
2 files changed, 52 insertions, 0 deletions
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();
+
+ }));
+
});