summaryrefslogtreecommitdiffstats
path: root/js/tests/unit/controller/NavigationControllerSpec.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-13 01:19:39 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-13 01:19:39 +0200
commit8c38ef40bd9b1ff794de218ea71d43971bef4c59 (patch)
tree5547ceda7b7dd350d379073b1cdf7a423e6c7d16 /js/tests/unit/controller/NavigationControllerSpec.js
parent72c4fc9acb1380021eb4665af78ef8e26058c86a (diff)
delete feed + undo
Diffstat (limited to 'js/tests/unit/controller/NavigationControllerSpec.js')
-rw-r--r--js/tests/unit/controller/NavigationControllerSpec.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js
index d502d99c6..f5781dafa 100644
--- a/js/tests/unit/controller/NavigationControllerSpec.js
+++ b/js/tests/unit/controller/NavigationControllerSpec.js
@@ -707,4 +707,63 @@ describe('NavigationController', function () {
expect(ctrl.renamingFolder).toBe(false);
}));
+
+ it('should reversibly delete a feed', inject(function (
+ $controller, FeedResource) {
+ FeedResource.reversiblyDelete = jasmine.createSpy('reversiblyDelete');
+
+ var ctrl = $controller('NavigationController', {
+ FeedResource: FeedResource,
+ });
+
+ var feed = {
+ id: 3,
+ deleted: false
+ };
+
+ ctrl.reversiblyDeleteFeed(feed);
+
+ expect(FeedResource.reversiblyDelete).toHaveBeenCalledWith(3);
+ expect(feed.deleted).toBe(true);
+ }));
+
+
+ it('should undo delete a feed', inject(function (
+ $controller, FeedResource) {
+ FeedResource.undoDelete = jasmine.createSpy('undoDelete');
+
+ var ctrl = $controller('NavigationController', {
+ FeedResource: FeedResource,
+ });
+
+ var feed = {
+ id: 3,
+ deleted: false
+ };
+
+ ctrl.undoDeleteFeed(feed);
+
+ expect(FeedResource.undoDelete).toHaveBeenCalledWith(3);
+ expect(feed.deleted).toBe(false);
+ }));
+
+
+ it('should delete a feed', inject(function (
+ $controller, FeedResource) {
+ FeedResource.delete = jasmine.createSpy('undoDelete');
+
+ var ctrl = $controller('NavigationController', {
+ FeedResource: FeedResource,
+ });
+
+ var feed = {
+ id: 3
+ };
+
+ ctrl.deleteFeed(feed);
+
+ expect(FeedResource.delete).toHaveBeenCalledWith(3);
+ }));
+
+
});