5.7 KiB
Task Selection Behavior Test Guide
Spec: task-browser-refactor
Task: 15. Test selection behavior
Requirements: 3.1, 3.2, 3.3, 3.4, 3.5
Overview
This document provides a comprehensive guide for testing the selection behavior of the TasksDataTable component. The tests validate that the component correctly implements all selection requirements.
Test Execution
Open frontend/test-task-selection-behavior.html in a browser to access the interactive test suite.
Test Scenarios
1. Single-Click Selection (Requirement 3.1)
Requirement: WHEN a user clicks a row without modifiers THEN the system SHALL clear all selections and select only the clicked row
Test Cases:
- 1.1: Initial single selection
- 1.2: Selection replacement
- 1.3: Selection count display
Steps:
- Navigate to a project's Tasks view
- Click on Task A
- Verify only Task A is selected
- Click on Task B
- Verify only Task B is selected, Task A is deselected
- Check selection count shows "1 task selected"
2. Ctrl+Click Toggle Selection (Requirement 3.2)
Requirement: WHEN a user Ctrl+clicks (or Cmd+clicks on Mac) a row THEN the system SHALL toggle that row's selection state without affecting other selections
Test Cases:
- 2.1: Add to selection
- 2.2: Remove from selection
- 2.3: Preserve other selections
- 2.4: Multiple selection count
Steps:
- Click Task A to select it
- Hold Ctrl (or Cmd) and click Task B
- Verify both are selected
- Hold Ctrl and click Task A again
- Verify Task A is deselected, Task B remains selected
- Hold Ctrl and click Task C
- Verify Task B and Task C are selected
3. Shift+Click Range Selection (Requirement 3.3)
Requirement: WHEN a user Shift+clicks a row THEN the system SHALL select all rows between the last clicked row and the current row
Test Cases:
- 3.1: Forward range selection
- 3.2: Backward range selection
- 3.3: Range selection count
Steps:
- Click Task 1
- Hold Shift and click Task 5
- Verify Tasks 1-5 are all selected
- Click Task 3 (without modifiers)
- Hold Shift and click Task 7
- Verify Tasks 3-7 are selected
- Hold Shift and click Task 1
- Verify Tasks 1-3 are selected (backwards range)
4. Select-All Checkbox (Requirement 3.4)
Requirement: WHEN a user clicks the header checkbox THEN the system SHALL toggle selection of all visible (filtered) rows
Test Cases:
- 4.1: Select all visible tasks
- 4.2: Deselect all tasks
- 4.3: Select all filtered tasks
- 4.4: Indeterminate state
Steps:
- Ensure no filters are applied
- Click the checkbox in the table header
- Verify all visible tasks are selected
- Click the header checkbox again
- Verify all tasks are deselected
- Apply a filter (e.g., status = "In Progress")
- Click the header checkbox
- Verify only filtered tasks are selected
- Select some (but not all) tasks manually
- Verify header checkbox shows indeterminate state
5. Double-Click Opens Detail Panel (Requirement 3.5)
Requirement: WHEN a user double-clicks a row THEN the system SHALL open the task detail panel without modifying selection state
Test Cases:
- 5.1: Detail panel opens
- 5.2: Selection preserved on selected task
- 5.3: Selection preserved on unselected task
- 5.4: Detail panel content
- 5.5: Mobile detail panel
Steps:
- Select Task A and Task B (using Ctrl+click)
- Double-click Task A
- Verify detail panel opens for Task A
- Verify both Task A and Task B remain selected
- Close the detail panel
- Double-click Task C (unselected)
- Verify detail panel opens for Task C
- Verify Task A and Task B remain selected
- Test on mobile/tablet to verify sheet/modal behavior
Additional Integration Tests
Visual Feedback Tests
- 6.1: Selected rows have distinct background color
- 6.2: Hover state is distinct from selection
- 6.3: Cursor changes to pointer on hover
- 6.4: Text selection is prevented during shift-click
- 6.5: Empty table shows "No tasks found" message
Test Environment Setup
Prerequisites
- Backend server running on http://localhost:8000
- Frontend dev server running on http://localhost:5173
- Test project with at least 10 tasks
- Multiple task types and statuses for filter testing
Test Data Requirements
- At least 10 tasks in a project
- Tasks with different statuses (Not Started, In Progress, Complete)
- Tasks with different types
- Tasks assigned to different users
- Tasks in different episodes (if applicable)
Expected Behavior Summary
| Action | Expected Result |
|---|---|
| Click task | Select only that task, clear others |
| Ctrl+Click task | Toggle task selection, preserve others |
| Shift+Click task | Select range from last clicked to current |
| Click header checkbox | Toggle all visible tasks |
| Double-click task | Open detail panel, preserve selection |
| Right-click selected | Preserve selection, show context menu |
| Right-click unselected | Add to selection, show context menu |
Common Issues to Watch For
- Selection not clearing on single click - Verify no modifiers are pressed
- Shift-click not working - Check lastClickedIndex is being tracked
- Select-all not respecting filters - Verify only filtered tasks are selected
- Double-click changing selection - Check event.detail === 2 logic
- Visual feedback missing - Verify CSS classes are applied correctly
Test Result Recording
Use the interactive test HTML file to:
- Check off completed test cases
- Record pass/fail status
- Add notes about any issues
- Save results to localStorage
- Generate a test report
Completion Criteria
Task 15 is complete when:
- ✅ All 25+ test cases pass
- ✅ All requirements (3.1-3.5) are validated
- ✅ No regressions in existing functionality
- ✅ Visual feedback is correct
- ✅ Test results are documented