diff --git a/platform/commonUI/browse/test/MenuArrowControllerSpec.js b/platform/commonUI/browse/test/MenuArrowControllerSpec.js index 7b58b20a7c..b8aa345489 100644 --- a/platform/commonUI/browse/test/MenuArrowControllerSpec.js +++ b/platform/commonUI/browse/test/MenuArrowControllerSpec.js @@ -29,11 +29,7 @@ define( function (MenuArrowController) { "use strict"; - //var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ], - // DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ]; - - - describe("The menu arrow controller", function () { + describe("The menu arrow controller ", function () { var mockScope, mockDomainObject, mockEvent, @@ -44,7 +40,7 @@ define( beforeEach(function () { mockScope = jasmine.createSpyObj( "$scope", - [ "$on", "$watch" ] + [ "" ] ); mockDomainObject = jasmine.createSpyObj( "domainObject", @@ -55,30 +51,31 @@ define( [ "preventDefault" ] ); mockContextMenuAction = jasmine.createSpyObj( - "menu", - [ "perform", "destroy" ] + "action", + [ "perform", "getActions" ] + ); + mockActionContext = jasmine.createSpyObj( + "actionContext", + [ "" ] ); - mockActionContext = {key: 'menu', domainObject: mockDomainObject, event: mockEvent}; + mockActionContext.domainObject = mockDomainObject; + mockActionContext.event = mockEvent; mockScope.domainObject = mockDomainObject; - mockDomainObject.getCapability.andReturn(function (c) { - //return c === 'action' ? mockContextMenuAction : undefined; - return mockContextMenuAction; - }); + mockDomainObject.getCapability.andReturn(mockContextMenuAction); + mockContextMenuAction.perform.andReturn(jasmine.any(Function)); controller = new MenuArrowController(mockScope); }); - it(" calls the context menu action when clicked", function () { + it("calls the context menu action when clicked", function () { // Simulate a click on the menu arrow controller.showMenu(mockEvent); - //stop = $scope.domainObject.getCapability('action').perform(actionContext); - - expect(mockDomainObject.getCapability).toHaveBeenCalled(); - //.toHaveBeenCalledWith('action'); + // Expect the menu action to be performed + expect(mockDomainObject.getCapability).toHaveBeenCalledWith('action'); + expect(mockContextMenuAction.perform).toHaveBeenCalled(); }); - }); } ); diff --git a/platform/representation/test/gestures/ContextMenuGestureSpec.js b/platform/representation/test/gestures/ContextMenuGestureSpec.js index 98076e6e82..098e687217 100644 --- a/platform/representation/test/gestures/ContextMenuGestureSpec.js +++ b/platform/representation/test/gestures/ContextMenuGestureSpec.js @@ -70,26 +70,6 @@ define( mockDomainObject.calls ); }); - - ////// Is this one here or in action spec? (shale) - /* - it("removes listeners from body if destroyed while menu is showing", function () { - // Show the menu - fireGesture(mockEvent); - - // Verify preconditions - expect(mockBody.off).not.toHaveBeenCalled(); - expect(mockMenu.remove).not.toHaveBeenCalled(); - - // Destroy the menu - gesture.destroy(); - - // Verify menu was removed and listener detached - expect(mockBody.off).toHaveBeenCalled(); - expect(mockMenu.remove).toHaveBeenCalled(); - }); - */ - }); } ); \ No newline at end of file