From dd5304fa24ca1ac76758194620df696ae741d6e1 Mon Sep 17 00:00:00 2001 From: Matteo Guarnaccia Date: Thu, 25 Apr 2024 11:37:09 +0100 Subject: [PATCH] fixed e2e tests #503 --- .../e2e/with_mock_data/catalogueCategories.cy.ts | 2 +- src/items/itemDialog.component.tsx | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/with_mock_data/catalogueCategories.cy.ts b/cypress/e2e/with_mock_data/catalogueCategories.cy.ts index 7b3c163ac..59ac1bb7b 100644 --- a/cypress/e2e/with_mock_data/catalogueCategories.cy.ts +++ b/cypress/e2e/with_mock_data/catalogueCategories.cy.ts @@ -297,8 +297,8 @@ describe('Catalogue Category', () => { { name: 'Updated Field 2', type: 'number', - unit: 'millimeters', mandatory: false, + unit: 'millimeters', }, ], }) diff --git a/src/items/itemDialog.component.tsx b/src/items/itemDialog.component.tsx index f0661625e..55c045f5b 100644 --- a/src/items/itemDialog.component.tsx +++ b/src/items/itemDialog.component.tsx @@ -243,12 +243,12 @@ function ItemDialog(props: ItemDialogProps) { setItemDetails({ ...updatedItemDetails, - warranty_end_date: itemDetails.warranty_end_date - ? new Date(itemDetails.warranty_end_date) - : null, - delivered_date: itemDetails.delivered_date - ? new Date(itemDetails.delivered_date) - : null, + warranty_end_date: updatedItemDetails.warranty_end_date + ? new Date(updatedItemDetails.warranty_end_date) + : itemDetails.warranty_end_date, + delivered_date: updatedItemDetails.delivered_date + ? new Date(updatedItemDetails.delivered_date) + : itemDetails.delivered_date, }); setFormErrorMessage(undefined); }, @@ -719,6 +719,7 @@ function ItemDialog(props: ItemDialogProps) { @@ -738,6 +739,7 @@ function ItemDialog(props: ItemDialogProps) {