From 97163796dda8a9efb77acb3adb116b0c6cedaea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20St=C4=99pniak?= Date: Mon, 31 Oct 2022 11:15:05 +0100 Subject: TPE-34: split function in two --- .../containers/labels/modals/EditLabelModal.tsx | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/components/containers/labels/modals/EditLabelModal.tsx b/packages/components/containers/labels/modals/EditLabelModal.tsx index 12c099ae95..0e94a827cf 100644 --- a/packages/components/containers/labels/modals/EditLabelModal.tsx +++ b/packages/components/containers/labels/modals/EditLabelModal.tsx @@ -169,25 +169,25 @@ const EditLabelModal = ({ }); }; - // we might divide it to just getTitle function and getFolderTestId or something - const getTitleAndTestId = () => { + const getTitle = () => { const isFolder = model.Type === LABEL_TYPE.MESSAGE_FOLDER; if (mode === 'create') { - return { - title: isFolder ? c('Label/folder modal').t`Create folder` : c('Label/folder modal').t`Create label`, - testId: isFolder ? 'create-folder-modal' : 'create-label-modal', - }; + return isFolder ? c('Label/folder modal').t`Create folder` : c('Label/folder modal').t`Create label`; } - return { - title: isFolder ? c('Label/folder modal').t`Edit folder` : c('Label/folder modal').t`Edit label`, - testId: isFolder ? 'edit-folder-modal' : 'edit-label-modal', - }; + return isFolder ? c('Label/folder modal').t`Edit folder` : c('Label/folder modal').t`Edit label`; }; + const getTestId = () => { + const isFolder = model.Type === LABEL_TYPE.MESSAGE_FOLDER; + if (mode === 'create') { + return isFolder ? 'create-folder-modal' : 'create-label-modal'; + } + return isFolder ? 'edit-folder-modal' : 'edit-label-modal'; + }; return ( - - + +