diff --git a/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.js b/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.js index 1a9630b6c1f146014eca9924bed63b071a1991a2..c3ce8b79a442057ef9240c6b89d883c50e9bf76a 100644 --- a/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.js +++ b/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.js @@ -24,7 +24,7 @@ export const getCurrentTimeSeriesPoints = createSelector( return zip( timeSeries.properties.result, timeSeries.properties.timeStep.map((timeStep) => { - return new DateTime.fromISO(timeStep, ).toMillis(); + return new DateTime.fromISO(timeStep, {zone: 'UTC'}).toMillis(); }), timeSeries.properties.nilReason, timeSeries.properties.approvals, @@ -109,7 +109,6 @@ export const getCursorEpochTime = createSelector( (cursorOffset, xScale) => { if (!cursorOffset) { - console.log('') return xScale.domain()[1]; } return xScale.domain()[0] + cursorOffset; diff --git a/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.spec.js b/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.spec.js index 837b69c6a2c1f54489afc7b715682dfb015db94a..a932fa0946a0464b5df61c6201e43ad739a238b3 100644 --- a/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.spec.js +++ b/assets/src/scripts/components/dailyValueHydrograph/selectors/time-series-data.spec.js @@ -140,8 +140,8 @@ describe('time-series-data module', () => { }); describe('getCursorEpochTime', () => { - it('should return null if cursor offset is not set', () => { - expect(getCursorEpochTime(TEST_STATE)).toBeNull(); + it('should return latest time if cursor offset is not set', () => { + expect(getCursorEpochTime(TEST_STATE)).toEqual(1515110400000); }); it('should return the epoch time of the offset', () => { @@ -156,8 +156,15 @@ describe('time-series-data module', () => { }); describe('getDataAtCursor', () => { - it('should return null if cursor offset is not set', () => { - expect(getDataAtCursor(TEST_STATE)).toBeNull(); + it('should return last point if cursor offset is not set', () => { + expect(getDataAtCursor(TEST_STATE)).toEqual({ + value: '3.2', + dateTime: 1515110400000, + approvals: ['Approved'], + nilReason: null, + qualifiers: ['ICE'], + grades: ['60'] + }); }); it('should return the point nearest the cursor offset', () => { @@ -174,7 +181,6 @@ describe('time-series-data module', () => { nilReason: 'AA', qualifiers: null, grades: ['50'] - }); }); }); diff --git a/assets/src/scripts/components/hydrograph/tooltip.spec.js b/assets/src/scripts/components/hydrograph/tooltip.spec.js index a93b040554a4967be7f38bf9c3f8b12a4a18a2fa..88786192425fb1265e38720314cea2ab36cf4b4f 100644 --- a/assets/src/scripts/components/hydrograph/tooltip.spec.js +++ b/assets/src/scripts/components/hydrograph/tooltip.spec.js @@ -379,8 +379,8 @@ describe('Hydrograph tooltip module', () => { svg.call(createTooltipFocus, store); expect(svg.selectAll('.focus-line').size()).toBe(1); - expect(svg.selectAll('circle').size()).toBe(2); - expect(svg.select('.focus').size()).toBe(1); + expect(svg.selectAll('.focus-circle').size()).toBe(2); + expect(svg.select('.focus-overlay').size()).toBe(1); }); it('Focus circles and line are displayed if cursor is set', () => { @@ -408,8 +408,9 @@ describe('Hydrograph tooltip module', () => { svg.call(createTooltipFocus, store); - expect(svg.select('.focus:first-child').style('display')).not.toBe('none'); - expect(svg.select('.focus:nth-child(2)').style('display')).not.toBe('none'); + expect(svg.selectAll('.focus-line').size()).toBe(1); + expect(svg.selectAll('.focus-circle').size()).toBe(2); + expect(svg.select('.focus-overlay').size()).toBe(1); }); }); });