mirror of
https://github.com/nasa/openmct.git
synced 2025-01-20 03:36:44 +00:00
[Mobile] CleanUp/Tests
Added tests inside spec files for the QueryService, TreeNodeController, and InfoGesture. Also cleaned up the tree so that padding is used between buttons instead of margins.
This commit is contained in:
parent
b3bc8b6876
commit
143e3eeb6c
@ -321,19 +321,22 @@ ul.tree {
|
||||
ul.tree li span.tree-item {
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
margin-top: 3px; }
|
||||
/* line 34, ../sass/mobile/_tree.scss */
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
margin-bottom: 0px; }
|
||||
/* line 36, ../sass/mobile/_tree.scss */
|
||||
ul.tree li span.tree-item .view-control {
|
||||
position: absolute;
|
||||
right: 13px;
|
||||
font-size: 1.8em; }
|
||||
/* line 40, ../sass/mobile/_tree.scss */
|
||||
/* line 42, ../sass/mobile/_tree.scss */
|
||||
ul.tree li span.tree-item .label {
|
||||
left: 3px;
|
||||
font-size: 1.2em; }
|
||||
/* line 47, ../sass/mobile/_tree.scss */
|
||||
/* line 49, ../sass/mobile/_tree.scss */
|
||||
ul.tree li span.tree-item .label .title-label {
|
||||
right: 16.9px; }
|
||||
/* line 56, ../sass/mobile/_tree.scss */
|
||||
/* line 58, ../sass/mobile/_tree.scss */
|
||||
ul.tree ul.tree {
|
||||
margin-left: 3px; } }
|
||||
margin-left: 0px;
|
||||
padding-left: 3px; } }
|
||||
|
@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
// Wrapper of the entire 2 panes, only enacted on
|
||||
// phone and tablet. Also for the panes
|
||||
// phone and tablet.
|
||||
.browse-wrapper,
|
||||
.mobile-pane {
|
||||
@include phoneandtablet {
|
||||
|
@ -30,7 +30,9 @@ ul.tree {
|
||||
// Adds some space to the top of each tree item
|
||||
height: $mobile-treeHeight;
|
||||
line-height: $mobile-treeHeight;
|
||||
margin-top: $interiorMarginSm;
|
||||
padding-top: $interiorMarginSm;
|
||||
padding-bottom: $interiorMarginSm;
|
||||
margin-bottom: 0px;
|
||||
.view-control {
|
||||
position: absolute;
|
||||
right: $mobile-treeRight;
|
||||
@ -54,7 +56,8 @@ ul.tree {
|
||||
// Sets the margin on the left, which causes the
|
||||
// running indentation after each folder is made
|
||||
ul.tree {
|
||||
margin-left: $mobile-treeLeft;
|
||||
margin-left: 0px;
|
||||
padding-left: $mobile-treeLeft;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ define(
|
||||
}
|
||||
|
||||
function checkMobile() {
|
||||
return queryService.isMobile();
|
||||
return queryService.isMobile(navigator.userAgent);
|
||||
}
|
||||
|
||||
// Consider the currently-navigated object and update
|
||||
|
@ -40,16 +40,15 @@ define(
|
||||
// Gets the UA name if it is one of the following.
|
||||
// If it is not (a desktop for example) nothing is
|
||||
// returned instead
|
||||
function getDeviceUA() {
|
||||
var ua = navigator.userAgent;
|
||||
function getDeviceUA(ua) {
|
||||
return ua.match(/iPad|iPhone|Android/i) ?
|
||||
ua.match(/iPad|iPhone|Android/i) : "";
|
||||
}
|
||||
|
||||
// Checks if gotten device is mobile,
|
||||
// Mobile is defined as a phone or tablet
|
||||
function isMobile() {
|
||||
if (getDeviceUA()) {
|
||||
function isMobile(ua) {
|
||||
if (getDeviceUA(ua)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -29,6 +29,7 @@ define(
|
||||
describe("The tree node controller", function () {
|
||||
var mockScope,
|
||||
mockTimeout,
|
||||
mockQueryService,
|
||||
controller;
|
||||
|
||||
function TestObject(id, context) {
|
||||
@ -43,7 +44,8 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]);
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
controller = new TreeNodeController(mockScope, mockTimeout);
|
||||
mockQueryService = jasmine.createSpyObj("queryService", ["isMobile"]);
|
||||
controller = new TreeNodeController(mockScope, mockTimeout, mockQueryService);
|
||||
});
|
||||
|
||||
it("allows tracking of expansion state", function () {
|
||||
@ -183,6 +185,10 @@ define(
|
||||
expect(controller.isSelected()).toBeFalsy();
|
||||
|
||||
});
|
||||
|
||||
it("check if tree node is in a mobile device", function () {
|
||||
controller.checkMobile();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -51,15 +51,17 @@ define(
|
||||
});
|
||||
|
||||
it("get current device user agent", function () {
|
||||
queryService.isMobile();
|
||||
mockNavigator.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36";
|
||||
queryService.isMobile(mockNavigator.userAgent);
|
||||
mockNavigator.userAgent = "Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53";
|
||||
queryService.isMobile();
|
||||
queryService.isMobile(mockNavigator.userAgent);
|
||||
});
|
||||
|
||||
it("get orientation of the current device", function () {
|
||||
mockWindow.outerWidth = 768;
|
||||
mockWindow.outerHeight = 1024;
|
||||
queryService.getOrientation();
|
||||
|
||||
mockWindow.outerWidth = 1024;
|
||||
mockWindow.outerHeight = 768;
|
||||
queryService.getOrientation();
|
||||
|
@ -78,7 +78,7 @@ define(
|
||||
// Checks if you are on a mobile device, if the device is
|
||||
// not mobile (queryService.isMobile() = false), then
|
||||
// the pendingBubble and therefore hovering is allowed
|
||||
if (!queryService.isMobile()) {
|
||||
if (!queryService.isMobile(navigator.userAgent)) {
|
||||
// Show the bubble, after a suitable delay (if mouse has
|
||||
// left before this time is up, this will be canceled.)
|
||||
pendingBubble = $timeout(function () {
|
||||
|
Loading…
Reference in New Issue
Block a user