Fix acceptance criteria toggle ajax responses
linter / quality (pull_request) Successful in 1m26s
tests / ci (8.4) (pull_request) Successful in 1m35s

This commit is contained in:
2026-05-20 09:53:21 +00:00
parent eac1ae5c45
commit b5ba09d350
3 changed files with 56 additions and 2 deletions
@@ -661,6 +661,52 @@ class ProjectTicketControllerTest extends TestCase
]);
}
public function test_ticket_update_returns_json_for_ajax_requests(): 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 toggle test',
]);
$this->syncProjectPermissions($project, $editor, ['write', 'view']);
$this->actingAs($editor)
->withHeaders([
'Accept' => 'application/json',
'X-Requested-With' => 'XMLHttpRequest',
])
->patch(route('projects.tickets.update', [$project, $ticket]), [
'acceptance_criteria' => [],
'blocked_comment' => $ticket->blocked_comment,
'description' => $ticket->description,
'field_values' => [],
'is_blocked' => $ticket->is_blocked,
'parent_ticket_id' => $ticket->parent_ticket_id,
'story_points' => $ticket->story_points,
'ticket_priority_id' => $priority->id,
'ticket_type_id' => $ticketType->id,
'title' => $ticket->title,
])
->assertOk()
->assertJson([
'message' => 'No ticket changes were detected.',
'updated' => false,
]);
}
/**
* Ensure non-parent tickets cannot be assigned as a parent target.
*/