mirror of
https://github.com/nasa/openmct.git
synced 2025-01-04 20:34:09 +00:00
[Mobile] Tests
Adjusted TreeNodeControllerSpec to test setObject prototype.
This commit is contained in:
parent
9cd57614e4
commit
0fa330adff
@ -30,6 +30,8 @@ define(
|
|||||||
var mockScope,
|
var mockScope,
|
||||||
mockTimeout,
|
mockTimeout,
|
||||||
mockAgentService,
|
mockAgentService,
|
||||||
|
mockNgModel,
|
||||||
|
mockDomainObject,
|
||||||
controller;
|
controller;
|
||||||
|
|
||||||
function TestObject(id, context) {
|
function TestObject(id, context) {
|
||||||
@ -42,9 +44,18 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]);
|
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on", "$emit"]);
|
||||||
mockTimeout = jasmine.createSpy("$timeout");
|
mockTimeout = jasmine.createSpy("$timeout");
|
||||||
mockAgentService = jasmine.createSpyObj("agentService", ["isMobile"]);
|
mockAgentService = jasmine.createSpyObj("agentService", ["isMobile", "isPhone", "getOrientation"]);
|
||||||
|
mockNgModel = jasmine.createSpyObj("ngModel", ["selectedObject"]);
|
||||||
|
mockDomainObject = jasmine.createSpyObj(
|
||||||
|
"domainObject",
|
||||||
|
[ "getId", "getCapability", "getModel", "useCapability" ]
|
||||||
|
);
|
||||||
|
|
||||||
|
mockAgentService.getOrientation.andReturn("portrait");
|
||||||
|
mockAgentService.isPhone.andReturn(true);
|
||||||
|
|
||||||
controller = new TreeNodeController(mockScope, mockTimeout, mockAgentService);
|
controller = new TreeNodeController(mockScope, mockTimeout, mockAgentService);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -191,6 +202,11 @@ define(
|
|||||||
controller.checkMobile();
|
controller.checkMobile();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("allows a set object to emit select-obj", function () {
|
||||||
|
controller.setObject(mockNgModel, mockDomainObject);
|
||||||
|
expect(mockScope.$emit).toHaveBeenCalledWith('select-obj');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Loading…
Reference in New Issue
Block a user