mirror of
https://github.com/nasa/openmct.git
synced 2025-01-19 03:06:54 +00:00
[Spec] Update spec for new usage
Add a test for new bounds setting behavior, update other tests to provide correct mocks for new usage of APIs. https://github.com/nasa/openmct/issues/1582
This commit is contained in:
parent
fbf736aaf7
commit
9f32b4b9cd
@ -136,26 +136,35 @@ define(['./TimeAPI'], function (TimeAPI) {
|
||||
var anotherMockTickSource;
|
||||
var mockOffsets = {
|
||||
start: 0,
|
||||
end: 0
|
||||
end: 1
|
||||
};
|
||||
|
||||
beforeEach(function () {
|
||||
mockTickSource = jasmine.createSpyObj("clock", [
|
||||
"on",
|
||||
"off"
|
||||
"off",
|
||||
"currentValue"
|
||||
]);
|
||||
mockTickSource.currentValue.andReturn(10);
|
||||
mockTickSource.key = "mts";
|
||||
|
||||
anotherMockTickSource = jasmine.createSpyObj("clock", [
|
||||
"on",
|
||||
"off"
|
||||
"off",
|
||||
"currentValue"
|
||||
]);
|
||||
anotherMockTickSource.key = "amts";
|
||||
anotherMockTickSource.currentValue.andReturn(10);
|
||||
|
||||
api.addClock(mockTickSource);
|
||||
api.addClock(anotherMockTickSource);
|
||||
});
|
||||
|
||||
it("sets bounds based on current value", function () {
|
||||
api.clock("mts", mockOffsets);
|
||||
expect(api.bounds()).toEqual({start: 10, end: 11});
|
||||
});
|
||||
|
||||
it("a new tick listener is registered", function () {
|
||||
api.clock("mts", mockOffsets);
|
||||
expect(mockTickSource.on).toHaveBeenCalledWith("tick", jasmine.any(Function));
|
||||
@ -180,8 +189,10 @@ define(['./TimeAPI'], function (TimeAPI) {
|
||||
it("on tick, observes offsets, and indicates tick in bounds callback", function () {
|
||||
var mockTickSource = jasmine.createSpyObj("clock", [
|
||||
"on",
|
||||
"off"
|
||||
"off",
|
||||
"currentValue"
|
||||
]);
|
||||
mockTickSource.currentValue.andReturn(100);
|
||||
var tickCallback;
|
||||
var boundsCallback = jasmine.createSpy("boundsCallback");
|
||||
var clockOffsets = {
|
||||
|
Loading…
Reference in New Issue
Block a user