[Imagery] Start off with empty timestamp

Show nothing in the timestamp area when there is no
data yet available for image telemetry, WTD-1170.
This commit is contained in:
Victor Woeltjen 2015-06-22 13:34:02 -07:00 committed by Pete Richards
parent 1e332da11b
commit 6aaa887e65
2 changed files with 23 additions and 4 deletions

View File

@ -59,6 +59,7 @@ define(
releaseSubscription();
self.date = "";
self.time = "";
self.zone = "";
self.imageUrl = "";
self.handle = domainObject && telemetryHandler.handle(
domainObject,
@ -78,11 +79,16 @@ define(
ImageryController.prototype.updateValues = function () {
var imageObject =
this.handle && this.handle.getTelemetryObjects()[0],
timestamp,
m;
if (imageObject && !this.isPaused) {
m = moment.utc(this.handle.getDomainValue(imageObject));
this.date = m.format(DATE_FORMAT);
this.time = m.format(TIME_FORMAT);
timestamp = this.handle.getDomainValue(imageObject);
m = timestamp !== undefined ?
moment.utc(timestamp) :
undefined;
this.date = m ? m.format(DATE_FORMAT) : "";
this.time = m ? m.format(TIME_FORMAT) : "";
this.zone = m ? "UTC" : "";
this.imageUrl = this.handle.getRangeValue(imageObject);
}
};
@ -112,7 +118,7 @@ define(
* @returns {string} the time
*/
ImageryController.prototype.getZone = function () {
return "UTC";
return this.zone;
};
/**

View File

@ -146,6 +146,19 @@ define(
expect(controller.getImageUrl()).toEqual(testUrl);
});
it("initially shows an empty string for date/time", function () {
// Call the subscription listener while domain/range
// values are still undefined
mockHandle.getDomainValue.andReturn(undefined);
mockHandle.getRangeValue.andReturn(undefined);
mockTelemetryHandler.handle.mostRecentCall.args[1]();
// Should have empty strings for date/time/zone
expect(controller.getTime()).toEqual("");
expect(controller.getDate()).toEqual("");
expect(controller.getZone()).toEqual("");
expect(controller.getImageUrl()).toBeUndefined();
});
});
}
);