From 51efcae4bf9bba858eb03b47e5c47f2ce9649880 Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Mon, 24 Feb 2025 23:42:12 +0530 Subject: [PATCH 01/11] chore/remove-featurew-flag-DONE --- __tests__/Unit/Components/Tasks/Card.test.tsx | 2 +- .../Components/Tasks/TaskDropDown.test.tsx | 1 - .../Tasks/TaskStatusEditMode.test.tsx | 38 ++++--------------- src/components/tasks/TaskDropDown.tsx | 8 ++-- .../tasks/card/TaskStatusEditMode.tsx | 11 ++---- src/components/tasks/card/index.tsx | 4 +- 6 files changed, 16 insertions(+), 48 deletions(-) diff --git a/__tests__/Unit/Components/Tasks/Card.test.tsx b/__tests__/Unit/Components/Tasks/Card.test.tsx index c09ad7232..05deb8f14 100644 --- a/__tests__/Unit/Components/Tasks/Card.test.tsx +++ b/__tests__/Unit/Components/Tasks/Card.test.tsx @@ -557,7 +557,7 @@ describe('Task card', () => { ); const spanElement = screen.getByTestId('task-status'); - expect(spanElement).toHaveTextContent('Completed'); + expect(spanElement).toHaveTextContent('Done'); }); }); diff --git a/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx b/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx index 935ee282c..6cafb0d7a 100644 --- a/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx +++ b/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx @@ -126,7 +126,6 @@ describe('TaskDropDown', () => { render( { .map(([name, status]) => [status, beautifyStatus(name)]) .filter(([status]) => status !== 'BACKLOG' && status !== 'DONE'); - expect(allOptions).toEqual(allTaskStatus); - }); - - it('renders a list of task under feature flag', () => { - const mockUpdateTask = jest.fn(); - const setEditedTaskDetails = jest.fn(); - - renderWithRouter( - - - - ); - - const statusSelect = screen.getByLabelText('Status:'); - - const allOptions = Array.from( - statusSelect.querySelectorAll('option') - ).map((option) => [option.value, option.textContent]); - - const allTaskStatus = Object.entries(BACKEND_TASK_STATUS) - .map(([name, status]) => [status, beautifyStatus(name)]) - .filter(([status]) => status !== BACKEND_TASK_STATUS.COMPLETED); - + console.log('task list:'); + console.log(allOptions); + console.log(allTaskStatus); expect(allOptions).toEqual(allTaskStatus); }); @@ -181,8 +157,8 @@ describe('test beautifyStatus function', () => { expect(output).toEqual('In Progress'); }); - it('returns DONE when completed is passed and dev mode is one', () => { - const res = beautifyStatus('COMPLETED', true); - expect(res).toEqual('Done'); - }); + // it('returns DONE when completed is passed and dev mode is one', () => { + // const res = beautifyStatus('COMPLETED',true); + // expect(res).toEqual('Done'); + // }); }); diff --git a/src/components/tasks/TaskDropDown.tsx b/src/components/tasks/TaskDropDown.tsx index 2a177c952..76d2ccf3a 100644 --- a/src/components/tasks/TaskDropDown.tsx +++ b/src/components/tasks/TaskDropDown.tsx @@ -24,13 +24,11 @@ export default function TaskDropDown({ newProgress: oldProgress, }); const [message, setMessage] = useState(''); - if (isDevMode && oldStatus === BACKEND_TASK_STATUS.COMPLETED) { + if (oldStatus === BACKEND_TASK_STATUS.COMPLETED) { BACKEND_TASK_STATUS.DONE = BACKEND_TASK_STATUS.COMPLETED; } const taskStatus = Object.entries(BACKEND_TASK_STATUS).filter( - ([key]) => - !(isDevMode && key === 'COMPLETED') && - !(!isDevMode && (key === 'BACKLOG' || key === 'DONE')) + ([key]) => !(key === 'COMPLETED') && !(!isDevMode && key === 'BACKLOG') ); const isCurrentTaskStatusBlock = oldStatus === BACKEND_TASK_STATUS.BLOCKED; @@ -118,7 +116,7 @@ export default function TaskDropDown({ key={status} value={status} > - {beautifyStatus(name, isDevMode)} + {beautifyStatus(name)} ))} diff --git a/src/components/tasks/card/TaskStatusEditMode.tsx b/src/components/tasks/card/TaskStatusEditMode.tsx index 8d4c31b37..e77abbffa 100644 --- a/src/components/tasks/card/TaskStatusEditMode.tsx +++ b/src/components/tasks/card/TaskStatusEditMode.tsx @@ -17,9 +17,9 @@ type Props = { }; // TODO: remove this after fixing the card beautify status -const beautifyStatus = (status: string, isDevMode?: boolean) => { +const beautifyStatus = (status: string) => { let beautifiedStatus = status; - if (beautifiedStatus === 'COMPLETED' && isDevMode) { + if (beautifiedStatus === 'COMPLETED') { beautifiedStatus = 'DONE'; } @@ -29,11 +29,7 @@ const beautifyStatus = (status: string, isDevMode?: boolean) => { ] || status ); }; -const TaskStatusEditMode = ({ - task, - setEditedTaskDetails, - isDevMode, -}: Props) => { +const TaskStatusEditMode = ({ task, setEditedTaskDetails }: Props) => { const [saveStatus, setSaveStatus] = useState(''); const [updateTask] = useUpdateTaskMutation(); @@ -75,7 +71,6 @@ const TaskStatusEditMode = ({ return (
= ({ ) : (
@@ -584,7 +584,7 @@ const Card: FC = ({ data-testid="task-status" className={styles.statusText} > - {beautifyStatus(cardDetails.status, isDevMode)} + {beautifyStatus(cardDetails.status)}

)} From 197e18dd422623b48bad5984925950783457baba Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Tue, 25 Feb 2025 22:50:01 +0530 Subject: [PATCH 02/11] change in task-status.tsx file , reintialize the COMPLETED value --- src/constants/task-status.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/task-status.ts b/src/constants/task-status.ts index 2bc2d32a6..5ee6aa801 100644 --- a/src/constants/task-status.ts +++ b/src/constants/task-status.ts @@ -4,7 +4,7 @@ export const IN_PROGRESS = 'IN_PROGRESS'; export const BACKLOG = 'BACKLOG'; export const BLOCKED = 'BLOCKED'; export const SMOKE_TESTING = 'SMOKE_TESTING'; -export const COMPLETED = 'COMPLETED'; +export const COMPLETED = 'DONE'; export const NEEDS_REVIEW = 'NEEDS_REVIEW'; export const IN_REVIEW = 'IN_REVIEW'; export const APPROVED = 'APPROVED'; From aa86469a9e32b3d93f26d8852892cb114769af41 Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Tue, 25 Feb 2025 23:49:31 +0530 Subject: [PATCH 03/11] revert back from COMPLETED to DONE --- src/constants/task-status.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/task-status.ts b/src/constants/task-status.ts index 5ee6aa801..2bc2d32a6 100644 --- a/src/constants/task-status.ts +++ b/src/constants/task-status.ts @@ -4,7 +4,7 @@ export const IN_PROGRESS = 'IN_PROGRESS'; export const BACKLOG = 'BACKLOG'; export const BLOCKED = 'BLOCKED'; export const SMOKE_TESTING = 'SMOKE_TESTING'; -export const COMPLETED = 'DONE'; +export const COMPLETED = 'COMPLETED'; export const NEEDS_REVIEW = 'NEEDS_REVIEW'; export const IN_REVIEW = 'IN_REVIEW'; export const APPROVED = 'APPROVED'; From 1aa75c3cf5869071c26145e232473dbe23b6538b Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Sun, 2 Mar 2025 10:47:35 +0530 Subject: [PATCH 04/11] resolve test cases --- __tests__/Unit/Components/Tasks/Card.test.tsx | 2 +- .../Unit/Components/Tasks/TaskDetails.test.tsx | 8 +++----- .../Unit/Components/Tasks/TaskDropDown.test.tsx | 2 +- .../Components/Tasks/TaskStatusEditMode.test.tsx | 13 +++++-------- src/components/taskDetails/TaskDetailsSection.tsx | 8 +------- src/components/tasks/TaskDropDown.tsx | 2 +- src/components/tasks/card/TaskStatusEditMode.tsx | 1 - src/components/tasks/card/index.tsx | 3 +-- 8 files changed, 13 insertions(+), 26 deletions(-) diff --git a/__tests__/Unit/Components/Tasks/Card.test.tsx b/__tests__/Unit/Components/Tasks/Card.test.tsx index 05deb8f14..de138c6fe 100644 --- a/__tests__/Unit/Components/Tasks/Card.test.tsx +++ b/__tests__/Unit/Components/Tasks/Card.test.tsx @@ -565,7 +565,7 @@ describe('Task card, color based on status ', () => { const OVER_DUE_CLASS = 'overdueTask'; it('Should not render card in red, if task status is COMPLETED ', () => { const TASK_DATA = DEFAULT_PROPS; - TASK_DATA.content.status = COMPLETED; + TASK_DATA.content.status = DONE; renderWithRouter( diff --git a/__tests__/Unit/Components/Tasks/TaskDetails.test.tsx b/__tests__/Unit/Components/Tasks/TaskDetails.test.tsx index b954d34ef..d9a18fc47 100644 --- a/__tests__/Unit/Components/Tasks/TaskDetails.test.tsx +++ b/__tests__/Unit/Components/Tasks/TaskDetails.test.tsx @@ -222,12 +222,11 @@ describe('TaskDetails Page', () => { expect(getByText('ankur')).toBeInTheDocument(); }); }); - it('Renders Task status Done when task status is Completed, when dev flag is on', async () => { + it('Renders Task status Done when task status is Completed', async () => { const { getByText } = renderWithRouter( - , - { query: { dev: 'true' } } + ); await waitFor(() => { expect(getByText('Done')).toBeInTheDocument(); @@ -251,8 +250,7 @@ describe('TaskDetails Page', () => { renderWithRouter( - , - { query: { dev: 'true' } } + ); await waitFor(() => { const editButton = screen.getByRole('button', { name: 'Edit' }); diff --git a/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx b/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx index 6cafb0d7a..6418b9c72 100644 --- a/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx +++ b/__tests__/Unit/Components/Tasks/TaskDropDown.test.tsx @@ -122,7 +122,7 @@ describe('TaskDropDown', () => { }); it('should show text Done as selected option when a task with completed status is passed down.', () => { const oldProgress = 100; - const oldStatus = BACKEND_TASK_STATUS.COMPLETED; + const oldStatus = BACKEND_TASK_STATUS.DONE; render( { const allTaskStatus = Object.entries(BACKEND_TASK_STATUS) .map(([name, status]) => [status, beautifyStatus(name)]) - .filter(([status]) => status !== 'BACKLOG' && status !== 'DONE'); + .filter(([status]) => status !== BACKEND_TASK_STATUS.COMPLETED); - console.log('task list:'); - console.log(allOptions); - console.log(allTaskStatus); expect(allOptions).toEqual(allTaskStatus); }); @@ -157,8 +154,8 @@ describe('test beautifyStatus function', () => { expect(output).toEqual('In Progress'); }); - // it('returns DONE when completed is passed and dev mode is one', () => { - // const res = beautifyStatus('COMPLETED',true); - // expect(res).toEqual('Done'); - // }); + it('returns DONE when completed is passed ', () => { + const res = beautifyStatus('COMPLETED'); + expect(res).toEqual('Done'); + }); }); diff --git a/src/components/taskDetails/TaskDetailsSection.tsx b/src/components/taskDetails/TaskDetailsSection.tsx index 68c7d254f..912d0891b 100644 --- a/src/components/taskDetails/TaskDetailsSection.tsx +++ b/src/components/taskDetails/TaskDetailsSection.tsx @@ -29,8 +29,6 @@ export const TaskDetailsSection: React.FC = ({ taskDetailsData, }) => { const router = useRouter(); - const { dev } = router.query; - const isDevMode = dev === 'true'; return (
@@ -42,14 +40,10 @@ export const TaskDetailsSection: React.FC = ({ onChange={handleTaskStatusUpdate} oldStatus={status} oldProgress={percentCompleted} - isDevMode={isDevMode} key={status} /> ) : ( -
+
)}
diff --git a/src/components/tasks/TaskDropDown.tsx b/src/components/tasks/TaskDropDown.tsx index 76d2ccf3a..7d31fb4b4 100644 --- a/src/components/tasks/TaskDropDown.tsx +++ b/src/components/tasks/TaskDropDown.tsx @@ -28,7 +28,7 @@ export default function TaskDropDown({ BACKEND_TASK_STATUS.DONE = BACKEND_TASK_STATUS.COMPLETED; } const taskStatus = Object.entries(BACKEND_TASK_STATUS).filter( - ([key]) => !(key === 'COMPLETED') && !(!isDevMode && key === 'BACKLOG') + ([key]) => !(key === 'COMPLETED') ); const isCurrentTaskStatusBlock = oldStatus === BACKEND_TASK_STATUS.BLOCKED; diff --git a/src/components/tasks/card/TaskStatusEditMode.tsx b/src/components/tasks/card/TaskStatusEditMode.tsx index e77abbffa..4a48a191b 100644 --- a/src/components/tasks/card/TaskStatusEditMode.tsx +++ b/src/components/tasks/card/TaskStatusEditMode.tsx @@ -13,7 +13,6 @@ import { TASK_STATUS_MAPING } from '@/constants/constants'; type Props = { task: task; setEditedTaskDetails: React.Dispatch>; - isDevMode?: boolean; }; // TODO: remove this after fixing the card beautify status diff --git a/src/components/tasks/card/index.tsx b/src/components/tasks/card/index.tsx index 091f12e6d..2582b6660 100644 --- a/src/components/tasks/card/index.tsx +++ b/src/components/tasks/card/index.tsx @@ -46,7 +46,7 @@ const Card: FC = ({ onContentChange = () => undefined, }) => { const router = useRouter(); - const isDevMode = router.query.dev === 'true' ? true : false; + const statusRedList = [BLOCKED]; const statusNotOverDueList = [ COMPLETED, @@ -575,7 +575,6 @@ const Card: FC = ({ ) : (
From 9d2feb50370f458344895bfaa3a3bd43d3db156e Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Mon, 10 Mar 2025 06:08:18 +0530 Subject: [PATCH 05/11] resolve test cases --- src/components/tasks/TaskDropDown.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/tasks/TaskDropDown.tsx b/src/components/tasks/TaskDropDown.tsx index 7d31fb4b4..babbcc866 100644 --- a/src/components/tasks/TaskDropDown.tsx +++ b/src/components/tasks/TaskDropDown.tsx @@ -24,11 +24,14 @@ export default function TaskDropDown({ newProgress: oldProgress, }); const [message, setMessage] = useState(''); + if (oldStatus === BACKEND_TASK_STATUS.COMPLETED) { BACKEND_TASK_STATUS.DONE = BACKEND_TASK_STATUS.COMPLETED; } const taskStatus = Object.entries(BACKEND_TASK_STATUS).filter( - ([key]) => !(key === 'COMPLETED') + ([key]) => + (!isDevMode && (key === 'BACKLOG' || key === 'DONE')) || + !(key === 'COMPLETED') ); const isCurrentTaskStatusBlock = oldStatus === BACKEND_TASK_STATUS.BLOCKED; From 599be826891495ca606294cce5307463010d052e Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Mon, 10 Mar 2025 06:19:18 +0530 Subject: [PATCH 06/11] Update TaskDropDown.tsx --- src/components/tasks/TaskDropDown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/tasks/TaskDropDown.tsx b/src/components/tasks/TaskDropDown.tsx index babbcc866..361cba66b 100644 --- a/src/components/tasks/TaskDropDown.tsx +++ b/src/components/tasks/TaskDropDown.tsx @@ -30,7 +30,7 @@ export default function TaskDropDown({ } const taskStatus = Object.entries(BACKEND_TASK_STATUS).filter( ([key]) => - (!isDevMode && (key === 'BACKLOG' || key === 'DONE')) || + (!!isDevMode && !(key === 'BACKLOG' || key === 'DONE')) || !(key === 'COMPLETED') ); From 5b11c2bd5b1a60e7dcc17cc4a6cc7c2946f8282d Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Wed, 12 Mar 2025 23:20:20 +0530 Subject: [PATCH 07/11] Update TaskDropDown.tsx --- .../Unit/Components/Tasks/TaskStatusEditMode.test.tsx | 9 +++++++-- src/components/taskDetails/TaskDetailsSection.tsx | 3 +++ src/components/tasks/TaskDropDown.tsx | 5 ++--- src/components/tasks/card/TaskStatusEditMode.tsx | 8 +++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx b/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx index b1f57d616..67bdc1bcb 100644 --- a/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx +++ b/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx @@ -110,8 +110,13 @@ describe('TaskStatusEditMode', () => { const allTaskStatus = Object.entries(BACKEND_TASK_STATUS) .map(([name, status]) => [status, beautifyStatus(name)]) - .filter(([status]) => status !== BACKEND_TASK_STATUS.COMPLETED); - + .filter( + ([status]) => + status !== BACKEND_TASK_STATUS.COMPLETED && + status !== BACKEND_TASK_STATUS.BACKLOG + ); + console.log(allOptions); + console.log(allTaskStatus); expect(allOptions).toEqual(allTaskStatus); }); diff --git a/src/components/taskDetails/TaskDetailsSection.tsx b/src/components/taskDetails/TaskDetailsSection.tsx index 912d0891b..2cc64200b 100644 --- a/src/components/taskDetails/TaskDetailsSection.tsx +++ b/src/components/taskDetails/TaskDetailsSection.tsx @@ -29,6 +29,8 @@ export const TaskDetailsSection: React.FC = ({ taskDetailsData, }) => { const router = useRouter(); + const { dev } = router.query; + const isDevMode = dev === 'true'; return (
@@ -41,6 +43,7 @@ export const TaskDetailsSection: React.FC = ({ oldStatus={status} oldProgress={percentCompleted} key={status} + isDevMode={isDevMode} /> ) : (
diff --git a/src/components/tasks/TaskDropDown.tsx b/src/components/tasks/TaskDropDown.tsx index 361cba66b..7e103aaa4 100644 --- a/src/components/tasks/TaskDropDown.tsx +++ b/src/components/tasks/TaskDropDown.tsx @@ -28,10 +28,9 @@ export default function TaskDropDown({ if (oldStatus === BACKEND_TASK_STATUS.COMPLETED) { BACKEND_TASK_STATUS.DONE = BACKEND_TASK_STATUS.COMPLETED; } + const taskStatus = Object.entries(BACKEND_TASK_STATUS).filter( - ([key]) => - (!!isDevMode && !(key === 'BACKLOG' || key === 'DONE')) || - !(key === 'COMPLETED') + ([key]) => !(key === 'COMPLETED') && !(!isDevMode && key === 'BACKLOG') ); const isCurrentTaskStatusBlock = oldStatus === BACKEND_TASK_STATUS.BLOCKED; diff --git a/src/components/tasks/card/TaskStatusEditMode.tsx b/src/components/tasks/card/TaskStatusEditMode.tsx index 4a48a191b..5ff783007 100644 --- a/src/components/tasks/card/TaskStatusEditMode.tsx +++ b/src/components/tasks/card/TaskStatusEditMode.tsx @@ -13,6 +13,7 @@ import { TASK_STATUS_MAPING } from '@/constants/constants'; type Props = { task: task; setEditedTaskDetails: React.Dispatch>; + isDevMode?: boolean; }; // TODO: remove this after fixing the card beautify status @@ -28,7 +29,11 @@ const beautifyStatus = (status: string) => { ] || status ); }; -const TaskStatusEditMode = ({ task, setEditedTaskDetails }: Props) => { +const TaskStatusEditMode = ({ + task, + setEditedTaskDetails, + isDevMode, +}: Props) => { const [saveStatus, setSaveStatus] = useState(''); const [updateTask] = useUpdateTaskMutation(); @@ -70,6 +75,7 @@ const TaskStatusEditMode = ({ task, setEditedTaskDetails }: Props) => { return (
Date: Wed, 12 Mar 2025 23:20:20 +0530 Subject: [PATCH 08/11] Update TaskDropDown.tsx --- .../Unit/Components/Tasks/TaskStatusEditMode.test.tsx | 8 ++++++-- src/components/taskDetails/TaskDetailsSection.tsx | 3 +++ src/components/tasks/TaskDropDown.tsx | 5 +++-- src/components/tasks/card/TaskStatusEditMode.tsx | 11 +++++++++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx b/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx index b1f57d616..d21f05a0b 100644 --- a/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx +++ b/__tests__/Unit/Components/Tasks/TaskStatusEditMode.test.tsx @@ -110,7 +110,11 @@ describe('TaskStatusEditMode', () => { const allTaskStatus = Object.entries(BACKEND_TASK_STATUS) .map(([name, status]) => [status, beautifyStatus(name)]) - .filter(([status]) => status !== BACKEND_TASK_STATUS.COMPLETED); + .filter( + ([status]) => + status !== BACKEND_TASK_STATUS.COMPLETED && + status !== BACKEND_TASK_STATUS.BACKLOG + ); expect(allOptions).toEqual(allTaskStatus); }); @@ -155,7 +159,7 @@ describe('test beautifyStatus function', () => { }); it('returns DONE when completed is passed ', () => { - const res = beautifyStatus('COMPLETED'); + const res = beautifyStatus(BACKEND_TASK_STATUS.COMPLETED); expect(res).toEqual('Done'); }); }); diff --git a/src/components/taskDetails/TaskDetailsSection.tsx b/src/components/taskDetails/TaskDetailsSection.tsx index 912d0891b..2cc64200b 100644 --- a/src/components/taskDetails/TaskDetailsSection.tsx +++ b/src/components/taskDetails/TaskDetailsSection.tsx @@ -29,6 +29,8 @@ export const TaskDetailsSection: React.FC = ({ taskDetailsData, }) => { const router = useRouter(); + const { dev } = router.query; + const isDevMode = dev === 'true'; return (
@@ -41,6 +43,7 @@ export const TaskDetailsSection: React.FC = ({ oldStatus={status} oldProgress={percentCompleted} key={status} + isDevMode={isDevMode} /> ) : (
diff --git a/src/components/tasks/TaskDropDown.tsx b/src/components/tasks/TaskDropDown.tsx index 361cba66b..52b3cd130 100644 --- a/src/components/tasks/TaskDropDown.tsx +++ b/src/components/tasks/TaskDropDown.tsx @@ -28,10 +28,11 @@ export default function TaskDropDown({ if (oldStatus === BACKEND_TASK_STATUS.COMPLETED) { BACKEND_TASK_STATUS.DONE = BACKEND_TASK_STATUS.COMPLETED; } + const taskStatus = Object.entries(BACKEND_TASK_STATUS).filter( ([key]) => - (!!isDevMode && !(key === 'BACKLOG' || key === 'DONE')) || - !(key === 'COMPLETED') + !(key === BACKEND_TASK_STATUS.COMPLETED) && + !(!isDevMode && key === BACKEND_TASK_STATUS.BACKLOG) ); const isCurrentTaskStatusBlock = oldStatus === BACKEND_TASK_STATUS.BLOCKED; diff --git a/src/components/tasks/card/TaskStatusEditMode.tsx b/src/components/tasks/card/TaskStatusEditMode.tsx index 4a48a191b..ba1c8b4ba 100644 --- a/src/components/tasks/card/TaskStatusEditMode.tsx +++ b/src/components/tasks/card/TaskStatusEditMode.tsx @@ -9,16 +9,18 @@ import { useUpdateTaskMutation } from '@/app/services/tasksApi'; import { StatusIndicator } from './StatusIndicator'; import TaskDropDown from '../TaskDropDown'; import { TASK_STATUS_MAPING } from '@/constants/constants'; +import { BACKEND_TASK_STATUS } from '@/constants/task-status'; type Props = { task: task; setEditedTaskDetails: React.Dispatch>; + isDevMode?: boolean; }; // TODO: remove this after fixing the card beautify status const beautifyStatus = (status: string) => { let beautifiedStatus = status; - if (beautifiedStatus === 'COMPLETED') { + if (beautifiedStatus === BACKEND_TASK_STATUS.COMPLETED) { beautifiedStatus = 'DONE'; } @@ -28,7 +30,11 @@ const beautifyStatus = (status: string) => { ] || status ); }; -const TaskStatusEditMode = ({ task, setEditedTaskDetails }: Props) => { +const TaskStatusEditMode = ({ + task, + setEditedTaskDetails, + isDevMode, +}: Props) => { const [saveStatus, setSaveStatus] = useState(''); const [updateTask] = useUpdateTaskMutation(); @@ -70,6 +76,7 @@ const TaskStatusEditMode = ({ task, setEditedTaskDetails }: Props) => { return (
Date: Sat, 12 Apr 2025 16:57:13 +0530 Subject: [PATCH 09/11] Update FilterDropdown.test.tsx --- __tests__/Unit/Components/Tasks/FilterDropdown.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx b/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx index 26f2e963d..2d0c9e31d 100644 --- a/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx +++ b/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx @@ -60,7 +60,7 @@ describe('FilterDropdown', () => { test('renders the modal with correct title and buttons', () => { renderWithRouter( { const unassignedButton = screen.getByText(/unassigned/i); expect(unassignedButton).toBeInTheDocument(); + + const doneButton = screen.getByText(/done/i); + expect(doneButton).toBeInTheDocument(); }); test('calls onSelect and onClose when a status button is clicked', () => { @@ -220,6 +223,9 @@ describe('FilterDropdown', () => { const backlogButton = screen.getByText(/backlog/i); expect(backlogButton).toHaveClass('status-button-active'); + + const doneButton = screen.getByText(/done/i); + expect(doneButton).not.toHaveClass('status-button-active'); }); it('Renders Task tab Done', async () => { From ead8afd11dca13d2321e724f34b03a252d8a8aef Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Thu, 17 Apr 2025 00:19:44 +0530 Subject: [PATCH 10/11] Update FilterDropdown.test.tsx --- __tests__/Unit/Components/Tasks/FilterDropdown.test.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx b/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx index 2d0c9e31d..c57b91fa9 100644 --- a/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx +++ b/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx @@ -172,13 +172,13 @@ describe('FilterDropdown', () => { ); - const unassignedButton = screen.getByText(/unassigned/i); - expect(unassignedButton).not.toHaveClass('status-button-active'); + const doneButton = screen.getByText(/done/i); + expect(doneButton).toHaveClass('status-button-active'); }); test('render the filter model having BACKLOG tab with correct title and buttons', () => { From 0817a45f802f807a58b865830c853143661d2347 Mon Sep 17 00:00:00 2001 From: Vaishali Maheshwari <80218238+vaishalimaheshwari2000@users.noreply.github.com> Date: Thu, 24 Apr 2025 23:15:02 +0530 Subject: [PATCH 11/11] Update FilterDropdown.test.tsx --- __tests__/Unit/Components/Tasks/FilterDropdown.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx b/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx index c57b91fa9..eee7fd0f1 100644 --- a/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx +++ b/__tests__/Unit/Components/Tasks/FilterDropdown.test.tsx @@ -179,6 +179,9 @@ describe('FilterDropdown', () => { const doneButton = screen.getByText(/done/i); expect(doneButton).toHaveClass('status-button-active'); + + const unassignedButton = screen.getByText(/unassigned/i); + expect(unassignedButton).not.toHaveClass('status-button-active'); }); test('render the filter model having BACKLOG tab with correct title and buttons', () => {