mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 00:45:41 +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 {
|
ul.tree li span.tree-item {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
line-height: 38px;
|
line-height: 38px;
|
||||||
margin-top: 3px; }
|
padding-top: 3px;
|
||||||
/* line 34, ../sass/mobile/_tree.scss */
|
padding-bottom: 3px;
|
||||||
|
margin-bottom: 0px; }
|
||||||
|
/* line 36, ../sass/mobile/_tree.scss */
|
||||||
ul.tree li span.tree-item .view-control {
|
ul.tree li span.tree-item .view-control {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 13px;
|
right: 13px;
|
||||||
font-size: 1.8em; }
|
font-size: 1.8em; }
|
||||||
/* line 40, ../sass/mobile/_tree.scss */
|
/* line 42, ../sass/mobile/_tree.scss */
|
||||||
ul.tree li span.tree-item .label {
|
ul.tree li span.tree-item .label {
|
||||||
left: 3px;
|
left: 3px;
|
||||||
font-size: 1.2em; }
|
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 {
|
ul.tree li span.tree-item .label .title-label {
|
||||||
right: 16.9px; }
|
right: 16.9px; }
|
||||||
/* line 56, ../sass/mobile/_tree.scss */
|
/* line 58, ../sass/mobile/_tree.scss */
|
||||||
ul.tree ul.tree {
|
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
|
// Wrapper of the entire 2 panes, only enacted on
|
||||||
// phone and tablet. Also for the panes
|
// phone and tablet.
|
||||||
.browse-wrapper,
|
.browse-wrapper,
|
||||||
.mobile-pane {
|
.mobile-pane {
|
||||||
@include phoneandtablet {
|
@include phoneandtablet {
|
||||||
|
@ -30,7 +30,9 @@ ul.tree {
|
|||||||
// Adds some space to the top of each tree item
|
// Adds some space to the top of each tree item
|
||||||
height: $mobile-treeHeight;
|
height: $mobile-treeHeight;
|
||||||
line-height: $mobile-treeHeight;
|
line-height: $mobile-treeHeight;
|
||||||
margin-top: $interiorMarginSm;
|
padding-top: $interiorMarginSm;
|
||||||
|
padding-bottom: $interiorMarginSm;
|
||||||
|
margin-bottom: 0px;
|
||||||
.view-control {
|
.view-control {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: $mobile-treeRight;
|
right: $mobile-treeRight;
|
||||||
@ -54,7 +56,8 @@ ul.tree {
|
|||||||
// Sets the margin on the left, which causes the
|
// Sets the margin on the left, which causes the
|
||||||
// running indentation after each folder is made
|
// running indentation after each folder is made
|
||||||
ul.tree {
|
ul.tree {
|
||||||
margin-left: $mobile-treeLeft;
|
margin-left: 0px;
|
||||||
|
padding-left: $mobile-treeLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkMobile() {
|
function checkMobile() {
|
||||||
return queryService.isMobile();
|
return queryService.isMobile(navigator.userAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consider the currently-navigated object and update
|
// Consider the currently-navigated object and update
|
||||||
|
@ -40,16 +40,15 @@ define(
|
|||||||
// Gets the UA name if it is one of the following.
|
// Gets the UA name if it is one of the following.
|
||||||
// If it is not (a desktop for example) nothing is
|
// If it is not (a desktop for example) nothing is
|
||||||
// returned instead
|
// returned instead
|
||||||
function getDeviceUA() {
|
function getDeviceUA(ua) {
|
||||||
var ua = navigator.userAgent;
|
|
||||||
return ua.match(/iPad|iPhone|Android/i) ?
|
return ua.match(/iPad|iPhone|Android/i) ?
|
||||||
ua.match(/iPad|iPhone|Android/i) : "";
|
ua.match(/iPad|iPhone|Android/i) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if gotten device is mobile,
|
// Checks if gotten device is mobile,
|
||||||
// Mobile is defined as a phone or tablet
|
// Mobile is defined as a phone or tablet
|
||||||
function isMobile() {
|
function isMobile(ua) {
|
||||||
if (getDeviceUA()) {
|
if (getDeviceUA(ua)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -29,6 +29,7 @@ define(
|
|||||||
describe("The tree node controller", function () {
|
describe("The tree node controller", function () {
|
||||||
var mockScope,
|
var mockScope,
|
||||||
mockTimeout,
|
mockTimeout,
|
||||||
|
mockQueryService,
|
||||||
controller;
|
controller;
|
||||||
|
|
||||||
function TestObject(id, context) {
|
function TestObject(id, context) {
|
||||||
@ -43,7 +44,8 @@ define(
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]);
|
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]);
|
||||||
mockTimeout = jasmine.createSpy("$timeout");
|
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 () {
|
it("allows tracking of expansion state", function () {
|
||||||
@ -183,6 +185,10 @@ define(
|
|||||||
expect(controller.isSelected()).toBeFalsy();
|
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 () {
|
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";
|
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 () {
|
it("get orientation of the current device", function () {
|
||||||
mockWindow.outerWidth = 768;
|
mockWindow.outerWidth = 768;
|
||||||
mockWindow.outerHeight = 1024;
|
mockWindow.outerHeight = 1024;
|
||||||
queryService.getOrientation();
|
queryService.getOrientation();
|
||||||
|
|
||||||
mockWindow.outerWidth = 1024;
|
mockWindow.outerWidth = 1024;
|
||||||
mockWindow.outerHeight = 768;
|
mockWindow.outerHeight = 768;
|
||||||
queryService.getOrientation();
|
queryService.getOrientation();
|
||||||
|
@ -78,7 +78,7 @@ define(
|
|||||||
// Checks if you are on a mobile device, if the device is
|
// Checks if you are on a mobile device, if the device is
|
||||||
// not mobile (queryService.isMobile() = false), then
|
// not mobile (queryService.isMobile() = false), then
|
||||||
// the pendingBubble and therefore hovering is allowed
|
// 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
|
// Show the bubble, after a suitable delay (if mouse has
|
||||||
// left before this time is up, this will be canceled.)
|
// left before this time is up, this will be canceled.)
|
||||||
pendingBubble = $timeout(function () {
|
pendingBubble = $timeout(function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user