diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-01 14:25:05 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-01 14:25:42 +0100 |
commit | b250747c6681dca656b0761f70f53d0295d228d1 (patch) | |
tree | 906be611568fa4c958600697e4c93d825240fcd8 /js/tests | |
parent | 00c4eeb67905f481e4d50e81237873956120c7c5 (diff) |
fix #882
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/unit/controller/NavigationControllerSpec.js | 30 | ||||
-rw-r--r-- | js/tests/unit/service/FeedResourceSpec.js | 12 |
2 files changed, 32 insertions, 10 deletions
diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js index 53d2e139f..a5300453f 100644 --- a/js/tests/unit/controller/NavigationControllerSpec.js +++ b/js/tests/unit/controller/NavigationControllerSpec.js @@ -1022,7 +1022,7 @@ describe('NavigationController', function () { ordering: 0 }); - FeedResource.setOrdering = jasmine.createSpy('ordering'); + FeedResource.patch = jasmine.createSpy('patch'); var route = { reload: jasmine.createSpy('reload') @@ -1033,7 +1033,7 @@ describe('NavigationController', function () { ctrl.setOrdering(FeedResource.getById(2), 2); - expect(FeedResource.setOrdering).toHaveBeenCalledWith(2, 2); + expect(FeedResource.patch).toHaveBeenCalledWith(2, {ordering:2}); expect(route.reload).toHaveBeenCalled(); })); @@ -1049,13 +1049,13 @@ describe('NavigationController', function () { pinned: false }); - FeedResource.setPinned = jasmine.createSpy('pinned'); + FeedResource.patch = jasmine.createSpy('patch'); var ctrl = $controller('NavigationController'); ctrl.togglePinned(2); - expect(FeedResource.setPinned).toHaveBeenCalledWith(2, true); + expect(FeedResource.patch).toHaveBeenCalledWith(2, {pinned: true}); })); @@ -1097,6 +1097,28 @@ describe('NavigationController', function () { })); + it ('should toggle updateModes', + inject(function ($controller, FeedResource) { + + FeedResource.add({ + id: 2, + url: 'http://test.com', + folderId: 3, + ordering: 0, + pinned: false, + updateMode: 1 + }); + + FeedResource.patch = jasmine.createSpy('patch'); + + var ctrl = $controller('NavigationController'); + + ctrl.setUpdateMode(2, 0); + + expect(FeedResource.patch).toHaveBeenCalledWith(2, {updateMode: 0}); + })); + + 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 5c900de3f..1911a9a3a 100644 --- a/js/tests/unit/service/FeedResourceSpec.js +++ b/js/tests/unit/service/FeedResourceSpec.js @@ -290,11 +290,11 @@ describe('FeedResource', function () { it ('should set the feed ordering', inject(function (FeedResource) { - http.expectPOST('base/feeds/3/ordering', { + http.expectPATCH('base/feeds/3', { ordering: 2 }).respond(200, {}); - FeedResource.setOrdering(3, 2); + FeedResource.patch(3, {ordering: 2}); http.flush(); @@ -303,11 +303,11 @@ describe('FeedResource', function () { it ('should set the feed pinning', inject(function (FeedResource) { - http.expectPOST('base/feeds/3/pinned', { - isPinned: true + http.expectPATCH('base/feeds/3', { + pinned: true }).respond(200, {}); - FeedResource.setPinned(3, true); + FeedResource.patch(3, {pinned: true}); http.flush(); @@ -316,7 +316,7 @@ describe('FeedResource', function () { it ('should toggle full text', inject(function (FeedResource) { - http.expectPOST('base/feeds/3/fulltext', { + http.expectPATCH('base/feeds/3', { fullTextEnabled: true }).respond(200, {}); |