Redesign ticket details with inline editing
linter / quality (pull_request) Successful in 1m23s
tests / ci (8.4) (pull_request) Successful in 1m49s

This commit is contained in:
2026-07-18 19:50:50 +02:00
parent 5f917e93eb
commit 8c70d094b8
11 changed files with 2712 additions and 1244 deletions
@@ -868,11 +868,84 @@ class ProjectTicketControllerTest extends TestCase
])
->assertOk()
->assertJson([
'acceptance_criteria' => [],
'message' => 'No ticket changes were detected.',
'updated' => false,
]);
}
public function test_ticket_update_json_returns_stable_acceptance_criteria_ids(): void
{
$editor = User::factory()->create();
$project = Project::factory()->create([
'key' => 'CORE',
]);
app(InitializeProjectTicketMetadata::class)->handle($project);
$priority = $project->ticketPriorities()->firstOrFail();
$ticketType = $this->nonParentType($project);
$ticket = Ticket::factory()->create([
'project_id' => $project->id,
'sequence_number' => 1,
'ticket_key' => 'CORE-1',
'ticket_priority_id' => $priority->id,
'ticket_type_id' => $ticketType->id,
'title' => 'Acceptance criteria inline editor test',
]);
$existingCriterion = AcceptanceCriterion::query()->create([
'ticket_id' => $ticket->id,
'parent_acceptance_criterion_id' => null,
'position' => 0,
'text' => 'Existing criterion',
'is_checked' => false,
]);
$this->syncProjectPermissions($project, $editor, ['write', 'view']);
$response = $this->actingAs($editor)
->withHeaders([
'Accept' => 'application/json',
'X-Requested-With' => 'XMLHttpRequest',
])
->patch(
route('projects.tickets.update', [$project, $ticket]),
$this->updatePayload($ticket, [
'acceptance_criteria' => [
[
'id' => $existingCriterion->id,
'text' => 'Existing criterion',
'checked' => true,
'indent' => 0,
],
[
'text' => 'New nested criterion',
'checked' => false,
'indent' => 1,
],
],
]),
)
->assertOk()
->assertJsonPath('acceptance_criteria.0.id', $existingCriterion->id)
->assertJsonPath('acceptance_criteria.0.checked', true)
->assertJsonPath('acceptance_criteria.0.indent', 0)
->assertJsonPath('acceptance_criteria.0.text', 'Existing criterion')
->assertJsonPath('acceptance_criteria.1.checked', false)
->assertJsonPath('acceptance_criteria.1.indent', 1)
->assertJsonPath('acceptance_criteria.1.text', 'New nested criterion')
->assertJsonPath('message', 'CORE-1 was updated.')
->assertJsonPath('updated', true);
$newCriterionId = AcceptanceCriterion::query()
->where('ticket_id', $ticket->id)
->where('text', 'New nested criterion')
->value('id');
$this->assertNotNull($newCriterionId);
$response->assertJsonPath('acceptance_criteria.1.id', $newCriterionId);
}
public function test_ticket_update_persists_explicit_child_acceptance_criteria_toggle_states(): void
{
$editor = User::factory()->create();