[Time Conductor] Update specs

Update specs to reflect merge of latest from master into
topic branch for nasa/openmctweb#115, domain selector.
This commit is contained in:
Victor Woeltjen 2015-10-09 11:17:57 -07:00
parent 2accf21518
commit 5763511ec8
3 changed files with 40 additions and 37 deletions

View File

@ -129,11 +129,12 @@ define(
it("exposes conductor state in scope", function () { it("exposes conductor state in scope", function () {
mockConductor.displayStart.andReturn(1977); mockConductor.displayStart.andReturn(1977);
mockConductor.displayEnd.andReturn(1984); mockConductor.displayEnd.andReturn(1984);
mockConductor.domain.andReturn('d');
representer.represent(testViews[0], {}); representer.represent(testViews[0], {});
expect(mockNewScope.ngModel.conductor).toEqual({ expect(mockNewScope.ngModel.conductor).toEqual({
inner: { start: 1977, end: 1984 }, inner: { start: 1977, end: 1984, domain: 'd' },
outer: { start: 1977, end: 1984 } outer: { start: 1977, end: 1984, domain: 'd' }
}); });
}); });
@ -163,7 +164,9 @@ define(
}); });
describe("when bounds are changing", function () { describe("when bounds are changing", function () {
var mockThrottledFn = jasmine.createSpy('throttledFn'), var startWatch = "ngModel.conductor.inner.start",
endWatch = "ngModel.conductor.inner.end",
mockThrottledFn = jasmine.createSpy('throttledFn'),
testBounds; testBounds;
function fireThrottledFn() { function fireThrottledFn() {
@ -174,7 +177,7 @@ define(
mockThrottle.andReturn(mockThrottledFn); mockThrottle.andReturn(mockThrottledFn);
representer.represent(testViews[0], {}); representer.represent(testViews[0], {});
testBounds = { start: 0, end: 1000 }; testBounds = { start: 0, end: 1000 };
mockNewScope.conductor.inner = testBounds; mockNewScope.ngModel.conductor.inner = testBounds;
mockConductor.displayStart.andCallFake(function () { mockConductor.displayStart.andCallFake(function () {
return testBounds.start; return testBounds.start;
}); });
@ -186,14 +189,14 @@ define(
it("does not broadcast while bounds are changing", function () { it("does not broadcast while bounds are changing", function () {
expect(mockScope.$broadcast).not.toHaveBeenCalled(); expect(mockScope.$broadcast).not.toHaveBeenCalled();
testBounds.start = 100; testBounds.start = 100;
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start); fireWatch(mockNewScope, startWatch, testBounds.start);
testBounds.end = 500; testBounds.end = 500;
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end); fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn(); fireThrottledFn();
testBounds.start = 200; testBounds.start = 200;
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start); fireWatch(mockNewScope, startWatch, testBounds.start);
testBounds.end = 400; testBounds.end = 400;
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end); fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn(); fireThrottledFn();
expect(mockScope.$broadcast).not.toHaveBeenCalled(); expect(mockScope.$broadcast).not.toHaveBeenCalled();
}); });
@ -201,12 +204,12 @@ define(
it("does broadcast when bounds have stabilized", function () { it("does broadcast when bounds have stabilized", function () {
expect(mockScope.$broadcast).not.toHaveBeenCalled(); expect(mockScope.$broadcast).not.toHaveBeenCalled();
testBounds.start = 100; testBounds.start = 100;
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start); fireWatch(mockNewScope, startWatch, testBounds.start);
testBounds.end = 500; testBounds.end = 500;
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end); fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn(); fireThrottledFn();
fireWatch(mockNewScope, 'conductor.inner.start', testBounds.start); fireWatch(mockNewScope, startWatch, testBounds.start);
fireWatch(mockNewScope, 'conductor.inner.end', testBounds.end); fireWatch(mockNewScope, endWatch, testBounds.end);
fireThrottledFn(); fireThrottledFn();
expect(mockScope.$broadcast).toHaveBeenCalled(); expect(mockScope.$broadcast).toHaveBeenCalled();
}); });

View File

@ -75,8 +75,6 @@ define(
return j * j * j; return j * j * j;
}); });
mockConductor.queryStart.andReturn(-12321);
mockConductor.queryEnd.andReturn(-12321);
mockConductor.displayStart.andReturn(42); mockConductor.displayStart.andReturn(42);
mockConductor.displayEnd.andReturn(1977); mockConductor.displayEnd.andReturn(1977);
mockConductor.domain.andReturn("testDomain"); mockConductor.domain.andReturn("testDomain");
@ -132,29 +130,29 @@ define(
expect(request.domain).toEqual(mockConductor.domain()); expect(request.domain).toEqual(mockConductor.domain());
}); });
}); });
//
// it("adds display start/end times & domain selection to historical requests", function () { it("adds display start/end times & domain selection to historical requests", function () {
// decorator.requestTelemetry([{ someKey: "some value" }]); decorator.requestTelemetry([{ someKey: "some value" }]);
// expect(mockTelemetryService.requestTelemetry) expect(mockTelemetryService.requestTelemetry)
// .toHaveBeenCalledWith([{ .toHaveBeenCalledWith([{
// someKey: "some value", someKey: "some value",
// start: mockConductor.displayStart(), start: mockConductor.displayStart(),
// end: mockConductor.displayEnd(), end: mockConductor.displayEnd(),
// domain: jasmine.any(String) domain: jasmine.any(String)
// }]); }]);
// }); });
//
// it("adds display start/end times & domain selection to subscription requests", function () { it("adds display start/end times & domain selection to subscription requests", function () {
// var mockCallback = jasmine.createSpy('callback'); var mockCallback = jasmine.createSpy('callback');
// decorator.subscribe(mockCallback, [{ someKey: "some value" }]); decorator.subscribe(mockCallback, [{ someKey: "some value" }]);
// expect(mockTelemetryService.subscribe) expect(mockTelemetryService.subscribe)
// .toHaveBeenCalledWith(jasmine.any(Function), [{ .toHaveBeenCalledWith(jasmine.any(Function), [{
// someKey: "some value", someKey: "some value",
// start: mockConductor.displayStart(), start: mockConductor.displayStart(),
// end: mockConductor.displayEnd(), end: mockConductor.displayEnd(),
// domain: jasmine.any(String) domain: jasmine.any(String)
// }]); }]);
// }); });
}); });

View File

@ -24,6 +24,8 @@
define( define(
["../src/TimeConductor"], ["../src/TimeConductor"],
function (TimeConductor) { function (TimeConductor) {
'use strict';
function TestTimeConductor() { function TestTimeConductor() {
var self = this; var self = this;