From 7cc14a195b968ad337278d35b6e4ccdccee18fc9 Mon Sep 17 00:00:00 2001 From: Shivam Dave <sdave@ucsc.edu> Date: Wed, 29 Jul 2015 10:00:03 -0700 Subject: [PATCH] [Mobile] Tests/Header Removes back arrow on desktops. Also added queryService to tests for the context menu action and gesture. --- .../browse/res/templates/browse/object-header.html | 2 +- .../representation/test/actions/ContextMenuActionSpec.js | 3 +++ .../representation/test/gestures/ContextMenuGestureSpec.js | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/browse/res/templates/browse/object-header.html b/platform/commonUI/browse/res/templates/browse/object-header.html index 884f4fa888..a7bb8029fc 100644 --- a/platform/commonUI/browse/res/templates/browse/object-header.html +++ b/platform/commonUI/browse/res/templates/browse/object-header.html @@ -21,7 +21,7 @@ --> <div class='object-header object-header-mobile'> <span class="label s-label"> - <mct-representation key="'back-arrow'"></mct-representation> + <mct-representation class="desktop-hide" key="'back-arrow'"></mct-representation> <span class='type-icon icon ui-symbol'>{{type.getGlyph()}}</span> <span ng-if="parameters.mode" class='action'>{{parameters.mode}}</span> <span class='type-name'>{{type.getName()}}</span> diff --git a/platform/representation/test/actions/ContextMenuActionSpec.js b/platform/representation/test/actions/ContextMenuActionSpec.js index 73b877ddc3..8d94a30766 100644 --- a/platform/representation/test/actions/ContextMenuActionSpec.js +++ b/platform/representation/test/actions/ContextMenuActionSpec.js @@ -43,6 +43,7 @@ define( mockBody, mockWindow, mockRootScope, + mockQueryService, mockScope, mockElement, mockDomainObject, @@ -58,6 +59,7 @@ define( mockBody = jasmine.createSpyObj("body", JQLITE_FUNCTIONS); mockWindow = { innerWidth: MENU_DIMENSIONS[0] * 4, innerHeight: MENU_DIMENSIONS[1] * 4 }; mockRootScope = jasmine.createSpyObj("$rootScope", ["$new"]); + mockQueryService = jasmine.createSpyObj("queryService", ["isMobile"]); mockScope = {}; mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS); mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS); @@ -77,6 +79,7 @@ define( mockDocument, mockWindow, mockRootScope, + mockQueryService, mockActionContext ); }); diff --git a/platform/representation/test/gestures/ContextMenuGestureSpec.js b/platform/representation/test/gestures/ContextMenuGestureSpec.js index 655e68ff2e..ec687e3983 100644 --- a/platform/representation/test/gestures/ContextMenuGestureSpec.js +++ b/platform/representation/test/gestures/ContextMenuGestureSpec.js @@ -35,7 +35,8 @@ define( describe("The 'context menu' gesture", function () { - var mockElement, + var mockTimeout, + mockElement, mockQueryService, mockDomainObject, mockEvent, @@ -44,11 +45,13 @@ define( beforeEach(function () { mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS); + mockTimeout = jasmine.createSpy("$timeout"); + mockQueryService = jasmine.createSpyObj("queryService", ["isMobile"]); mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS); mockEvent = jasmine.createSpyObj("event", ["preventDefault"]); mockQueryService = jasmine.createSpyObj("queryService", ["isMobile"]); - gesture = new ContextMenuGesture(mockQueryService, mockElement, mockDomainObject); + gesture = new ContextMenuGesture(mockTimeout, mockQueryService, mockElement, mockDomainObject); // Capture the contextmenu callback fireGesture = mockElement.on.mostRecentCall.args[1];