diff --git a/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js b/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js index 7ccff88343..a388ef3d6c 100644 --- a/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js +++ b/platform/commonUI/inspect/test/gestures/InfoButtonGestureSpec.js @@ -27,12 +27,14 @@ define( "use strict"; describe("The info button gesture", function () { - var mockDocument, + var mockTimeout, + mockDocument, mockAgentService, mockInfoService, testDelay = 12321, mockElement, mockDomainObject, + mockEvent, mockScope, mockOff, testMetadata, @@ -40,7 +42,16 @@ define( mockHide, gesture; + function fireEvent(evt, value) { + mockElement.on.calls.forEach(function (call) { + if (call.args[0] === evt) { + call.args[1](value); + } + }); + } + beforeEach(function () { + mockTimeout = jasmine.createSpy('$timeout'); mockDocument = jasmine.createSpyObj('$document', ['find']); mockAgentService = jasmine.createSpyObj('agentService', ['isMobile', 'isPhone']); mockInfoService = jasmine.createSpyObj( @@ -63,13 +74,15 @@ define( ); mockElement = jasmine.createSpyObj( 'element', - [ 'on', 'off', 'scope', 'css' ] + [ 'on', 'off', 'scope', 'css', 'click' ] ); mockDomainObject = jasmine.createSpyObj( 'domainObject', [ 'getId', 'getCapability', 'useCapability', 'getModel' ] ); - + mockEvent = jasmine.createSpyObj("event", ["preventDefault", "stopPropagation"]); + mockEvent.pageX = 0; + mockEvent.pageY = 0; mockScope = jasmine.createSpyObj('$scope', [ '$on' ]); mockOff = jasmine.createSpy('$off'); testMetadata = [ { name: "Test name", value: "Test value" } ]; @@ -92,11 +105,12 @@ define( ); }); - it("listens for click on the representation", function () { + it("expect click on the representation", function () { expect(mockElement.on) .toHaveBeenCalledWith('click', jasmine.any(Function)); + }); - + }); } ); diff --git a/platform/commonUI/inspect/test/services/InfoServiceSpec.js b/platform/commonUI/inspect/test/services/InfoServiceSpec.js index 58adbbec51..e878afb268 100644 --- a/platform/commonUI/inspect/test/services/InfoServiceSpec.js +++ b/platform/commonUI/inspect/test/services/InfoServiceSpec.js @@ -138,7 +138,7 @@ define( mockAgentService ); service.display('', '', {}, [0, 0]); - }); + }); }); }); diff --git a/platform/representation/test/actions/ContextMenuActionSpec.js b/platform/representation/test/actions/ContextMenuActionSpec.js index 9f6c94b910..8e1ac5768a 100644 --- a/platform/representation/test/actions/ContextMenuActionSpec.js +++ b/platform/representation/test/actions/ContextMenuActionSpec.js @@ -166,7 +166,7 @@ define( expect(mockBody.off).not.toHaveBeenCalled(); }); - it("mobile", function () { + it("keeps a menu when menu is clicked on mobile", function () { mockAgentService.isMobile.andReturn(true); action = new ContextMenuAction( mockCompile,