Make job page task cards and change history collapsible

Task cards on the job page start collapsed and show the title, assignee,
due date and status; each opens on its own, so several can be open at
once, and "Expand all" / "Collapse all" open or close them together with
a status message. A card opens when focus moves into it. The change
history is a disclosure panel with the number of changes, closed by
default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-25 06:12:15 +02:00
co-authored by Claude Opus 5.5
parent 6936d0950b
commit 9a9935098c
3 changed files with 239 additions and 106 deletions
+46
View File
@@ -172,6 +172,12 @@ it('has no accessibility issues on a job with tasks and on the task form', funct
$visit = $device === 'mobile' ? $visit->on()->mobile() : $visit->on()->desktop();
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
if ($page === 'job page') {
$visit->click('[data-tasks-expand-all]')
->click('#history-toggle')
->assertVisible('#task-status-'.$task->id);
}
$visit->assertNoJavaScriptErrors()
->assertNoAccessibilityIssues(level: 2);
})->with(['job page', 'new task', 'edit task'])->with([
@@ -188,9 +194,11 @@ it('changes a task status and removes a task with the keyboard', function () {
->create(['customer_job_id' => $this->job->id, 'work_type_id' => $workType->id, 'title' => 'Kuvauspäivä']);
visit(route('jobs.show', $this->job->id))
->keys('#task-toggle-'.$task->id, 'Enter')
->select('#task-status-'.$task->id, 'in_progress')
->assertSee('Tehtävän Kuvauspäivä tila on nyt Työn alla.')
->assertScript('document.activeElement.id', 'task-status-'.$task->id)
->assertAttribute('#task-toggle-'.$task->id, 'aria-expanded', 'true')
->keys('[aria-label="Poista tehtävä Kuvauspäivä"]', 'Enter')
->assertScript('document.getElementById("remove-task-dialog").open', true)
->assertScript('document.getElementById("remove-task-dialog").contains(document.activeElement)', true)
@@ -199,6 +207,43 @@ it('changes a task status and removes a task with the keyboard', function () {
->assertScript('document.activeElement.id', 'tasks-heading');
});
it('shows task cards collapsed, opens several at once and expands or collapses them all', function () {
$this->job->update(['status' => 'order']);
$workType = WorkTypeModel::query()->where('name', 'videokuvaus')->sole();
$shoot = TaskModel::factory()
->assignedTo([$this->user->id])
->create(['customer_job_id' => $this->job->id, 'work_type_id' => $workType->id, 'title' => 'Kuvauspäivä', 'due_on' => '2026-12-04']);
$edit = TaskModel::factory()
->create(['customer_job_id' => $this->job->id, 'work_type_id' => $workType->id, 'title' => 'Editointi']);
$page = visit(route('jobs.show', $this->job->id))
->assertSee('Johanna Johto')
->assertSee('4.12.2026')
->assertAttribute('#task-toggle-'.$shoot->id, 'aria-expanded', 'false')
->assertMissing('#task-status-'.$shoot->id)
->keys('#task-toggle-'.$shoot->id, 'Enter')
->assertAttribute('#task-toggle-'.$shoot->id, 'aria-expanded', 'true')
->assertVisible('#task-status-'.$shoot->id)
->keys('#task-toggle-'.$edit->id, 'Enter')
->assertVisible('#task-status-'.$shoot->id)
->assertVisible('#task-status-'.$edit->id)
->click('[data-tasks-collapse-all]')
->assertSee('Kaikki tehtävät supistettu.')
->assertMissing('#task-status-'.$shoot->id)
->assertMissing('#task-status-'.$edit->id)
->click('[data-tasks-expand-all]')
->assertSee('Kaikki tehtävät laajennettu.')
->assertAttribute('#task-toggle-'.$shoot->id, 'aria-expanded', 'true')
->assertAttribute('#task-toggle-'.$edit->id, 'aria-expanded', 'true');
$page->assertAttribute('#history-toggle', 'aria-expanded', 'false')
->assertMissing('#history-panel')
->keys('#history-toggle', 'Enter')
->assertAttribute('#history-toggle', 'aria-expanded', 'true')
->assertVisible('#history-panel')
->assertNoAccessibilityIssues(level: 2);
});
it('adds, checks, renames, moves and removes checklist items with the keyboard', function () {
$this->job->update(['status' => 'order']);
$workType = WorkTypeModel::query()->where('name', 'videokuvaus')->sole();
@@ -206,6 +251,7 @@ it('adds, checks, renames, moves and removes checklist items with the keyboard',
->create(['customer_job_id' => $this->job->id, 'work_type_id' => $workType->id, 'title' => 'Kuvauspäivä']);
$page = visit(route('jobs.show', $this->job->id))
->click('#task-toggle-'.$task->id)
->type('#checklist-new-'.$task->id, 'Valot')
->keys('#checklist-new-'.$task->id, 'Enter')
->assertSee('Kohta Valot lisätty.')