From 7c7a7383ade15103bdb33573ae898bb59bc5ee5c Mon Sep 17 00:00:00 2001 From: daniel-zamora Date: Mon, 13 Jan 2025 11:14:31 -0500 Subject: [PATCH] EDSC-4125 test fix test --- .../TemporalDisplay/TemporalSelectionDropdown.jsx | 7 +++++-- .../__tests__/TemporalSelectionDropdown.test.js | 3 +-- .../js/components/TemporalSelection/TemporalSelection.jsx | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/static/src/js/components/TemporalDisplay/TemporalSelectionDropdown.jsx b/static/src/js/components/TemporalDisplay/TemporalSelectionDropdown.jsx index c894c594ad..fcbc603fa0 100644 --- a/static/src/js/components/TemporalDisplay/TemporalSelectionDropdown.jsx +++ b/static/src/js/components/TemporalDisplay/TemporalSelectionDropdown.jsx @@ -161,13 +161,16 @@ const TemporalSelectionDropdown = ({ // When only start date exists and is in current year, use full range if (existingStartDate && !existingEndDate) { - const startYear = moment(existingStartDate).utc().year() + const startYear = moment.utc(existingStartDate).year() + console.log('🚀 ~ onRecurringToggle ~ existingStartDate:', existingStartDate) const currentYear = moment().utc().year() + console.log('🚀 ~ onRecurringToggle ~ currentYear:', currentYear) + console.log('🚀 ~ onRecurringToggle ~ startYear:', startYear) if (startYear === currentYear) { setTemporal({ ...temporal, isRecurring: isChecked, - startDate: minDate.startOf('year').toISOString(), + startDate: minDate.toISOString(), endDate: moment().utc().toISOString() }) diff --git a/static/src/js/components/TemporalDisplay/__tests__/TemporalSelectionDropdown.test.js b/static/src/js/components/TemporalDisplay/__tests__/TemporalSelectionDropdown.test.js index dc782cfce9..891c2b8de7 100644 --- a/static/src/js/components/TemporalDisplay/__tests__/TemporalSelectionDropdown.test.js +++ b/static/src/js/components/TemporalDisplay/__tests__/TemporalSelectionDropdown.test.js @@ -704,7 +704,7 @@ describe('TemporalSelectionDropdown component', () => { }) describe('TemporalSelectionDropdown when dates aren\'t set', () => { - test('handles recurring toggle with only start date set', async () => { + test.only('handles recurring toggle with only start date set', async () => { MockDate.set('2024-02-01T06:00:00.000Z') const onChangeQueryMock = jest.fn() const user = userEvent.setup() @@ -823,7 +823,6 @@ describe('TemporalSelectionDropdown component', () => { const onChangeQueryMock = jest.fn() const user = userEvent.setup() - console.log('HERE0') setup({ onChangeQuery: onChangeQueryMock, temporalSearch: { diff --git a/static/src/js/components/TemporalSelection/TemporalSelection.jsx b/static/src/js/components/TemporalSelection/TemporalSelection.jsx index bd11b1a8fa..b1ae601b08 100644 --- a/static/src/js/components/TemporalSelection/TemporalSelection.jsx +++ b/static/src/js/components/TemporalSelection/TemporalSelection.jsx @@ -129,7 +129,7 @@ export class TemporalSelection extends Component { } const { minimumTemporalDateString, temporalDateFormatFull } = getApplicationConfig() - const minimumTemporalDate = moment(minimumTemporalDateString, temporalDateFormatFull).utc() + const minimumTemporalDate = moment(minimumTemporalDateString, temporalDateFormatFull) let sliderStartDate = moment(temporal.startDate).utc() if (!sliderStartDate.isValid()) {