mirror of
https://github.com/nasa/openmct.git
synced 2025-01-02 19:36:41 +00:00
[Timeline] Update failing specs
This commit is contained in:
parent
0a75a5be1f
commit
952f95aa4c
@ -68,6 +68,14 @@ define(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fireWatch(expr, value) {
|
||||||
|
mockScope.$watch.calls.forEach(function (call) {
|
||||||
|
if (call.args[0] === expr) {
|
||||||
|
call.args[1](value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
var mockA, mockB, mockUtilization, mockPromise, mockGraph, testCapabilities;
|
var mockA, mockB, mockUtilization, mockPromise, mockGraph, testCapabilities;
|
||||||
@ -149,8 +157,7 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("repopulates when modifications are made", function () {
|
it("repopulates when modifications are made", function () {
|
||||||
var fnWatchCall,
|
var fnWatchCall;
|
||||||
strWatchCall;
|
|
||||||
|
|
||||||
// Find the $watch that was given a function
|
// Find the $watch that was given a function
|
||||||
mockScope.$watch.calls.forEach(function (call) {
|
mockScope.$watch.calls.forEach(function (call) {
|
||||||
@ -158,16 +165,11 @@ define(
|
|||||||
// white-box: we know the first call is
|
// white-box: we know the first call is
|
||||||
// the one we're looking for
|
// the one we're looking for
|
||||||
fnWatchCall = fnWatchCall || call;
|
fnWatchCall = fnWatchCall || call;
|
||||||
} else if (typeof call.args[0] === 'string') {
|
|
||||||
strWatchCall = strWatchCall || call;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Make sure string watch was for domainObject
|
// Make sure string watch was for domainObject
|
||||||
expect(strWatchCall.args[0]).toEqual('domainObject');
|
fireWatch('domainObject', mockDomainObject);
|
||||||
// Initially populate
|
|
||||||
strWatchCall.args[1](mockDomainObject);
|
|
||||||
|
|
||||||
// There should be to swimlanes
|
// There should be to swimlanes
|
||||||
expect(controller.swimlanes().length).toEqual(2);
|
expect(controller.swimlanes().length).toEqual(2);
|
||||||
|
|
||||||
@ -189,23 +191,23 @@ define(
|
|||||||
// order of $watch calls in TimelineController.
|
// order of $watch calls in TimelineController.
|
||||||
|
|
||||||
// Initially populate
|
// Initially populate
|
||||||
mockScope.$watch.calls[0].args[1](mockDomainObject);
|
fireWatch('domainObject', mockDomainObject);
|
||||||
|
|
||||||
// Verify precondition - no graphs
|
// Verify precondition - no graphs
|
||||||
expect(controller.graphs().length).toEqual(0);
|
expect(controller.graphs().length).toEqual(0);
|
||||||
|
|
||||||
// Execute the watch function for graph state
|
// Execute the watch function for graph state
|
||||||
tmp = mockScope.$watch.calls[2].args[0]();
|
tmp = mockScope.$watch.calls[3].args[0]();
|
||||||
|
|
||||||
// Change graph state
|
// Change graph state
|
||||||
testConfiguration.graph = { a: true, b: true };
|
testConfiguration.graph = { a: true, b: true };
|
||||||
|
|
||||||
// Verify that this would have triggered a watch
|
// Verify that this would have triggered a watch
|
||||||
expect(mockScope.$watch.calls[2].args[0]())
|
expect(mockScope.$watch.calls[3].args[0]())
|
||||||
.not.toEqual(tmp);
|
.not.toEqual(tmp);
|
||||||
|
|
||||||
// Run the function the watch would have triggered
|
// Run the function the watch would have triggered
|
||||||
mockScope.$watch.calls[2].args[1]();
|
mockScope.$watch.calls[3].args[1]();
|
||||||
|
|
||||||
// Should have some graphs now
|
// Should have some graphs now
|
||||||
expect(controller.graphs().length).toEqual(2);
|
expect(controller.graphs().length).toEqual(2);
|
||||||
@ -218,7 +220,7 @@ define(
|
|||||||
mockZoom.duration.andReturn(12345);
|
mockZoom.duration.andReturn(12345);
|
||||||
|
|
||||||
// Initially populate
|
// Initially populate
|
||||||
mockScope.$watch.calls[0].args[1](mockDomainObject);
|
fireWatch('domainObject', mockDomainObject);
|
||||||
|
|
||||||
expect(controller.width(mockZoom)).toEqual(54321);
|
expect(controller.width(mockZoom)).toEqual(54321);
|
||||||
// Verify interactions; we took zoom's duration for our start/end,
|
// Verify interactions; we took zoom's duration for our start/end,
|
||||||
|
Loading…
Reference in New Issue
Block a user