From c6a4a182b8a3dde5cf0279b2912b46bfbb701f26 Mon Sep 17 00:00:00 2001 From: Darius Williams <dswilliams@contractor.usgs.gov> Date: Thu, 16 Jun 2022 09:13:53 -0500 Subject: [PATCH] tests --- .../time-span-shortcuts.test.js | 22 +++++++++---------- .../vue-components/time-span-shortcuts.vue | 16 +++++++------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.test.js b/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.test.js index 351ab8da2..cd1ca74fe 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.test.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.test.js @@ -81,7 +81,7 @@ describe('monitoring-location/components/hydrograph/components/graph-controls', showCompareIVData: false, selectedTimeSpan: 'P7D', showMedianData: false, - selectedParameterCode: '72019' + selectedParameterCode: '00060' } }); @@ -96,7 +96,7 @@ describe('monitoring-location/components/hydrograph/components/graph-controls', ], provide: { store: store, - siteno: '12345678', + siteno: '11112222', agencyCd: 'USGS' } } @@ -112,13 +112,13 @@ describe('monitoring-location/components/hydrograph/components/graph-controls', expect(wrapper.findAll('.gw-button-container')).toHaveLength(0); expect(radio7Day.attributes('type')).toBe('radio'); - expect(radio7Day.attributes('checked')).toBe(true); + expect(radio7Day.element.checked).toBe(true); expect(radio30Day.attributes('type')).toBe('radio'); - expect(radio30Day.attributes('checked')).toBe(false); + expect(radio30Day.element.checked).toBe(false); expect(radio1Year.attributes('type')).toBe('radio'); - expect(radio1Year.attributes('checked')).toBe(false); + expect(radio1Year.element.checked).toBe(false); }); it('Expects that if the selectedTimeSpan is changed to a days before that is not a shortcut, they are all unset', async() => { @@ -129,9 +129,9 @@ describe('monitoring-location/components/hydrograph/components/graph-controls', const radio30Day = wrapper.find('#P30D-input'); const radio1Year = wrapper.find('#P365D-input'); - expect(radio7Day.attributes('checked')).toBe(false); - expect(radio30Day.attributes('checked')).toBe(false); - expect(radio1Year.attributes('checked')).toBe(false); + expect(radio7Day.element.checked).toBe(false); + expect(radio30Day.element.checked).toBe(false); + expect(radio1Year.element.checked).toBe(false); }); it('Expects that if the selectedTimeSpan is changed to a date range, the shortcut radio buttons are not checked', async() => { @@ -142,9 +142,9 @@ describe('monitoring-location/components/hydrograph/components/graph-controls', const radio30Day = wrapper.find('#P30D-input'); const radio1Year = wrapper.find('#P365D-input'); - expect(radio7Day.attributes('checked')).toBe(false); - expect(radio30Day.attributes('checked')).toBe(false); - expect(radio1Year.attributes('checked')).toBe(false); + expect(radio7Day.element.checked).toBe(false); + expect(radio30Day.element.checked).toBe(false); + expect(radio1Year.element.checked).toBe(false); }); it('Expects that clicking a radio button updates the selectedTimeSpan and retrieve the data', () => { diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.vue b/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.vue index 57aea6676..a5997ce96 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.vue +++ b/assets/src/scripts/monitoring-location/components/hydrograph/vue-components/time-span-shortcuts.vue @@ -103,14 +103,14 @@ export default { const agencyCd = inject('agencyCd'); function setTimeSpan(timeSpan) { - actions.setSelectedTimeSpan(timeSpan); - actions.clearGraphBrushOffset(); - showDataIndicators(true, reduxStore); - const reduxState = reduxStore.getState(); - actions.retrieveHydrographData(siteno, agencyCd, getInputsForRetrieval(reduxState)) - .then(() => { - showDataIndicators(false, reduxStore); - }); + actions.setSelectedTimeSpan(timeSpan); + actions.clearGraphBrushOffset(); + showDataIndicators(true, reduxStore); + const reduxState = reduxStore.getState(); + actions.retrieveHydrographData(siteno, agencyCd, getInputsForRetrieval(reduxState)) + .then(() => { + showDataIndicators(false, reduxStore); + }); }; return { -- GitLab