From 6e60088b11def414d750fa7eb765d06707d28593 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Wed, 29 Jul 2015 11:58:53 -0700 Subject: [PATCH] [Mobile] RemoveAction Removed console and added navigationService (mock) to the spec version. --- platform/commonUI/edit/src/actions/RemoveAction.js | 6 ++---- .../commonUI/edit/test/actions/RemoveActionSpec.js | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index f0ed09d161..0a60f6d358 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -70,11 +70,9 @@ define( } function checkCurrentObjectNavigation(parent) { - var currParent = navigationService.getNavigation().getCapability('context').getParent() - if(currParent.getId() === parent.getId()) { + var currParent = navigationService.getNavigation().getCapability('context').getParent(); + if (currParent.getId() === parent.getId()) { navigationService.setNavigation(parent); - } else { - console.log("ALL GOOD"); } } diff --git a/platform/commonUI/edit/test/actions/RemoveActionSpec.js b/platform/commonUI/edit/test/actions/RemoveActionSpec.js index d23542f0ee..e0776c1712 100644 --- a/platform/commonUI/edit/test/actions/RemoveActionSpec.js +++ b/platform/commonUI/edit/test/actions/RemoveActionSpec.js @@ -28,6 +28,7 @@ define( describe("The Remove action", function () { var mockQ, + mockNavigationService, mockDomainObject, mockParent, mockContext, @@ -70,7 +71,16 @@ define( mockMutation = jasmine.createSpyObj("mutation", [ "invoke" ]); mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); mockType = jasmine.createSpyObj("type", [ "hasFeature" ]); - + mockNavigationService = jasmine.createSpyObj( + "navigationService", + [ + "getNavigation", + "setNavigation", + "addListener", + "removeListener" + ] + ); + mockDomainObject.getId.andReturn("test"); mockDomainObject.getCapability.andReturn(mockContext); mockContext.getParent.andReturn(mockParent); @@ -88,7 +98,7 @@ define( actionContext = { domainObject: mockDomainObject }; - action = new RemoveAction(mockQ, actionContext); + action = new RemoveAction(mockQ, mockNavigationService, actionContext); }); it("only applies to objects with parents", function () {