[Time] Handle missing time system gracefully

When loading the application and no time system is set,
the url handler should not cause multiple errors to be
logged.

This adds a test for the case but does not specify the
expected behavior in detail, other than "it should not
crash."

Fixes bugs as reported here.
This commit is contained in:
Pete Richards 2017-07-27 15:38:42 -07:00
parent 34c3763421
commit 4571205871
2 changed files with 17 additions and 1 deletions

View File

@ -107,7 +107,9 @@ define([
}
this.last = params;
if (params.clock === 'fixed' && params.bounds) {
if (!params.timeSystem) {
this.updateQueryParams();
} else if (params.clock === 'fixed' && params.bounds) {
if (!this.time.timeSystem() ||
this.time.timeSystem().key !== params.timeSystem) {

View File

@ -132,6 +132,20 @@ define([
};
});
it("initializes with missing time system", function () {
// This handles an odd transitory case where a url does not include
// a timeSystem. It's generally only experienced by those who
// based their code on the tutorial before it specified a time
// system.
search['tc.mode'] = 'clockA';
search['tc.timeSystem'] = undefined;
search['tc.startDelta'] = '123';
search['tc.endDelta'] = '456';
// We don't specify behavior right now other than "don't break."
expect(initialize).not.toThrow();
});
it("can initalize fixed mode from location", function () {
search['tc.mode'] = 'fixed';
search['tc.timeSystem'] = 'timeSystemA';