From 4c7c898d9cad8770ae75f41604dc795f5e736cd2 Mon Sep 17 00:00:00 2001
From: Mary Bucknell <mbucknell@usgs.gov>
Date: Tue, 17 Apr 2018 13:17:10 -0500
Subject: [PATCH] Updated legend and its test for the new store state

---
 .../scripts/components/hydrograph/legend.js   |  2 +-
 .../components/hydrograph/legend.spec.js      | 30 ++++++++++++-------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/assets/src/scripts/components/hydrograph/legend.js b/assets/src/scripts/components/hydrograph/legend.js
index 59c0c2242..b23099f08 100644
--- a/assets/src/scripts/components/hydrograph/legend.js
+++ b/assets/src/scripts/components/hydrograph/legend.js
@@ -192,7 +192,7 @@ const uniqueClassesSelector = memoize(tsKey => createSelector(
  * Select attributes from the state useful for legend creation
  */
 const legendDisplaySelector = createSelector(
-    (state) => state.showSeries,
+    (state) => state.timeseriesState.showSeries,
     currentVariableTimeSeriesSelector('median'),
     methodsSelector,
     uniqueClassesSelector('current'),
diff --git a/assets/src/scripts/components/hydrograph/legend.spec.js b/assets/src/scripts/components/hydrograph/legend.spec.js
index ee8816eda..21a93da5c 100644
--- a/assets/src/scripts/components/hydrograph/legend.spec.js
+++ b/assets/src/scripts/components/hydrograph/legend.spec.js
@@ -165,11 +165,13 @@ describe('Legend module', () => {
                     }
                 }
             },
-            currentVariableID: '45807197',
-            showSeries: {
-                current: true,
-                compare: true,
-                median: true
+            timeseriesState: {
+                currentVariableID: '45807197',
+                showSeries: {
+                    current: true,
+                    compare: true,
+                    median: true
+                }
             }
         };
 
@@ -199,7 +201,10 @@ describe('Legend module', () => {
         it('Should return markers for a different selected variable', () => {
             const newData = {
                 ...TEST_DATA,
-                currentVariableID: '45807202'
+                timeseriesState: {
+                    ...TEST_DATA.timeseriesState,
+                    currentVariableID: '45807202'
+                }
             };
             const result = legendMarkerRowsSelector(newData);
 
@@ -216,11 +221,14 @@ describe('Legend module', () => {
         it('Should return markers only for time series shown', () => {
             const newData = {
                 ...TEST_DATA,
-                currentVariableID: '45807202',
-                showSeries: {
-                    'current': true,
-                    'compare': false,
-                    'median': true
+                timeseriesState: {
+                    ...TEST_DATA.timeseriesState,
+                    currentVariableID: '45807202',
+                    showSeries: {
+                        'current': true,
+                        'compare': false,
+                        'median': true
+                    }
                 }
             };
 
-- 
GitLab