From dbea26a9c53daf929c9a9069cdf01cb0aae2981b Mon Sep 17 00:00:00 2001 From: Christopher Gokey Date: Wed, 20 Nov 2024 09:49:28 -0500 Subject: [PATCH] MMT-3943: Added a test to ensure the user's date/time is preserved in the widget --- .../__tests__/CustomDateTimeWidget.test.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/static/src/js/components/CustomDateTimeWidget/__tests__/CustomDateTimeWidget.test.jsx b/static/src/js/components/CustomDateTimeWidget/__tests__/CustomDateTimeWidget.test.jsx index f13215167..a1cb12e41 100644 --- a/static/src/js/components/CustomDateTimeWidget/__tests__/CustomDateTimeWidget.test.jsx +++ b/static/src/js/components/CustomDateTimeWidget/__tests__/CustomDateTimeWidget.test.jsx @@ -170,4 +170,16 @@ describe('CustomDateTimeWidget', () => { expect(field).toHaveValue('2023-12-05T00:00:00.000Z') }) }) + + describe('When a date has a specific time in the form', () => { + test('shows the date and time', async () => { + setup({ + value: '2023-12-05T16:05:59.000Z' + }) + + const field = await screen.findByPlaceholderText('YYYY-MM-DDTHH:MM:SSZ') + + expect(field).toHaveValue('2023-12-05T16:05:59.000Z') + }) + }) })