Add checklists to tasks on the job page
Tasks get an ordered checklist (spec 8.2, phase 3): items are checked done with who and when recorded, also by subcontractors attached to the job; others add, rename, reorder and remove items. Items go with their task. The spec gets a phase 3 chapter (18.1), and open questions move to chapter 19. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -4,6 +4,7 @@ use App\Models\User;
|
||||
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\ServiceUnitModel;
|
||||
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\WorkTypeModel;
|
||||
use App\Modules\Customers\Infrastructure\Persistence\Eloquent\CustomerModel;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\ChecklistItemModel;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\CustomerJobModel;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\TaskModel;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -155,6 +156,8 @@ it('has no accessibility issues on a job with tasks and on the task form', funct
|
||||
$task = TaskModel::factory()
|
||||
->assignedTo([$this->user->id])
|
||||
->create(['customer_job_id' => $this->job->id, 'work_type_id' => $workType->id, 'title' => 'Kuvauspäivä', 'due_on' => now()->subDay()->toDateString(), 'estimated_hours' => 6]);
|
||||
ChecklistItemModel::query()->create(['task_id' => $task->id, 'text' => 'Valot', 'sort_order' => 1, 'done_at' => now(), 'done_by' => $this->user->id]);
|
||||
ChecklistItemModel::query()->create(['task_id' => $task->id, 'text' => 'Mikit', 'sort_order' => 2]);
|
||||
|
||||
$url = match ($page) {
|
||||
'job page' => route('jobs.show', $this->job->id),
|
||||
@@ -192,3 +195,37 @@ it('changes a task status and removes a task with the keyboard', function () {
|
||||
->assertSee('Tehtävä Kuvauspäivä poistettu.')
|
||||
->assertScript('document.activeElement.id', 'tasks-heading');
|
||||
});
|
||||
|
||||
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();
|
||||
$task = TaskModel::factory()
|
||||
->create(['customer_job_id' => $this->job->id, 'work_type_id' => $workType->id, 'title' => 'Kuvauspäivä']);
|
||||
|
||||
$page = visit(route('jobs.show', $this->job->id))
|
||||
->type('#checklist-new-'.$task->id, 'Valot')
|
||||
->keys('#checklist-new-'.$task->id, 'Enter')
|
||||
->assertSee('Kohta Valot lisätty.')
|
||||
->type('#checklist-new-'.$task->id, 'Mikit')
|
||||
->keys('#checklist-new-'.$task->id, 'Enter')
|
||||
->assertSee('Kohta Mikit lisätty.');
|
||||
|
||||
[$lights, $mics] = ChecklistItemModel::query()->orderBy('id')->pluck('id')->all();
|
||||
|
||||
$page->keys('#checklist-item-'.$lights, 'Space')
|
||||
->assertSee('Kohta Valot merkitty tehdyksi.')
|
||||
->assertSee('(1/2 tehty)')
|
||||
->keys('#checklist-rename-'.$lights, 'Enter')
|
||||
->assertScript('document.activeElement.id', 'checklist-edit-'.$lights)
|
||||
->type('#checklist-edit-'.$lights, 'Valot ja jalustat')
|
||||
->keys('#checklist-edit-'.$lights, 'Enter')
|
||||
->assertSee('Kohta Valot ja jalustat tallennettu.')
|
||||
->assertScript('document.activeElement.id', 'checklist-rename-'.$lights)
|
||||
->keys('#checklist-move-up-'.$mics, 'Enter')
|
||||
->assertSee('Kohta Mikit siirretty ylöspäin.')
|
||||
->assertScript('document.activeElement.id', 'checklist-move-up-'.$mics)
|
||||
->keys('[aria-label="Poista kohta Mikit"]', 'Enter')
|
||||
->assertSee('Kohta Mikit poistettu.')
|
||||
->assertScript('document.activeElement.id', 'checklist-new-'.$task->id)
|
||||
->assertNoAccessibilityIssues(level: 2);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user