[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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user