# Test Custom Status Deletion

# Custom Task Status Deletion Test

## Test Scenarios

1. ### Delete Unused Status

   ✅ Should show simple confirmation dialog

   ✅ Should delete without requiring reassignment

2. ### Delete Status In Use

   ✅ Should show warning about tasks using the status

   ✅ Should display task count

   ✅ Should require reassignment selection

   ✅ Should show dropdown with system and custom statuses

   ✅ Should exclude the status being deleted from dropdown

3. ### Reassignment Logic

   ✅ Delete button should be disabled until reassignment is selected

   ✅ Should call API with reassign_to_status_id query parameter

   ✅ Should show success message with reassignment count

4. ### Error Handling

   ✅ Should handle "last status" error

   ✅ Should handle "status not found" error

   ✅ Should display error messages from backend

5. ### UI Updates

   ✅ Should reload statuses after successful deletion

   ✅ Should emit 'updated' event to parent

   ✅ Should close dialog after successful deletion

   ✅ Should reset reassignment selection when dialog closes

## Manual Testing Steps

1. Navigate to Project Settings → Tasks tab
2. Create a few custom statuses
3. Try deleting a status that's not in use - should work immediately
4. Assign a custom status to some tasks
5. Try deleting that status - should show warning and require reassignment
6. Select a reassignment status and confirm - should succeed
7. Try deleting the last custom status - should show error

## Implementation Details

- ✅ Created CustomTaskStatusDeleteDialog.vue component
- ✅ Updated customTaskStatus service to use query parameters
- ✅ Integrated delete dialog into CustomTaskStatusManager
- ✅ Added delete button to each custom status row
- ✅ Implemented task count display
- ✅ Added reassignment dropdown with system and custom statuses
- ✅ Implemented error handling for various scenarios
- ✅ Added success notifications with reassignment details

## Requirements Coverage

- ✅ 3.1: Check if status is in use by any tasks
- ✅ 3.2: Show confirmation dialog with task count
- ✅ 3.3: If status in use, show reassignment dropdown
- ✅ 3.4: Implement reassignment logic
- ✅ 3.5: Handle deletion success and errors
- ✅ Update UI after deletion