Add inline ticket property dropdowns
This commit is contained in:
@@ -155,6 +155,75 @@ class ProjectBoardControllerTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure inline status moves return the destination and its allowed follow-up transitions.
|
||||
*/
|
||||
public function test_ticket_status_moves_return_json_with_follow_up_transitions(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$project = Project::factory()->create([
|
||||
'key' => 'CORE',
|
||||
]);
|
||||
|
||||
app(InitializeProjectTicketMetadata::class)->handle($project);
|
||||
|
||||
$todoColumn = BoardColumn::factory()->for($project)->create([
|
||||
'name' => 'Todo',
|
||||
'position' => 1,
|
||||
]);
|
||||
$reviewColumn = BoardColumn::factory()->for($project)->create([
|
||||
'name' => 'Review',
|
||||
'position' => 2,
|
||||
]);
|
||||
$todoStatus = $this->createColumnStatus($todoColumn);
|
||||
$reviewStatus = $this->createColumnStatus($reviewColumn);
|
||||
$backlogStatus = $this->backlogStatus($project);
|
||||
$this->allowMove($backlogStatus, $todoStatus);
|
||||
$this->allowMove($todoStatus, $reviewStatus);
|
||||
|
||||
$priority = TicketPriority::factory()->for($project)->create([
|
||||
'name' => 'High',
|
||||
'position' => 2,
|
||||
]);
|
||||
|
||||
$ticket = Ticket::factory()->create([
|
||||
'project_id' => $project->id,
|
||||
'sequence_number' => 1,
|
||||
'ticket_key' => 'CORE-1',
|
||||
'ticket_priority_id' => $priority->id,
|
||||
'ticket_status_id' => $backlogStatus->id,
|
||||
'ticket_type_id' => $project->ticketTypes()->firstOrFail()->id,
|
||||
'title' => 'Inline status ticket',
|
||||
]);
|
||||
|
||||
$this->syncProjectPermissions($project, $user, ['edit', 'view']);
|
||||
|
||||
$this->actingAs($user)
|
||||
->patchJson(route('projects.tickets.status.update', [$project, $ticket]), [
|
||||
'redirect_to' => 'backlog',
|
||||
'ticket_status_id' => $todoStatus->id,
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('message', 'CORE-1 moved to Todo.')
|
||||
->assertJsonPath('moved', true)
|
||||
->assertJsonPath('ticket_status.id', $todoStatus->id)
|
||||
->assertJsonPath('ticket_status.board_column.id', $todoColumn->id)
|
||||
->assertJsonPath('ticket_status.allowed_target_statuses.0.id', $reviewStatus->id)
|
||||
->assertJsonPath('ticket_status.allowed_target_statuses.0.board_column.id', $reviewColumn->id)
|
||||
->assertJsonPath('ticket_status_id', $todoStatus->id);
|
||||
|
||||
$this->assertDatabaseHas('tickets', [
|
||||
'id' => $ticket->id,
|
||||
'ticket_status_id' => $todoStatus->id,
|
||||
]);
|
||||
$this->assertDatabaseHas('ticket_worklog_entries', [
|
||||
'actor_id' => $user->id,
|
||||
'entry_type' => 'status_changed',
|
||||
'summary' => 'Moved from Backlog to Todo.',
|
||||
'ticket_id' => $ticket->id,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure board tickets can move between columns.
|
||||
*/
|
||||
|
||||
@@ -70,6 +70,21 @@ class ProjectTicketControllerTest extends TestCase
|
||||
'ticket_type_id' => $this->nonParentType($project)->id,
|
||||
'title' => 'Ticket detail test',
|
||||
]);
|
||||
$targetColumn = BoardColumn::factory()->for($project)->create([
|
||||
'name' => 'In Progress',
|
||||
'position' => 1,
|
||||
]);
|
||||
$targetStatus = TicketStatus::factory()
|
||||
->for($project)
|
||||
->for($targetColumn)
|
||||
->create([
|
||||
'name' => 'In Progress',
|
||||
'position' => 1,
|
||||
]);
|
||||
TicketStatus::query()
|
||||
->findOrFail($ticket->ticket_status_id)
|
||||
->allowedTargetStatuses()
|
||||
->syncWithoutDetaching([$targetStatus->id]);
|
||||
$rootCriterion = AcceptanceCriterion::query()->create([
|
||||
'ticket_id' => $ticket->id,
|
||||
'parent_acceptance_criterion_id' => null,
|
||||
@@ -131,6 +146,8 @@ class ProjectTicketControllerTest extends TestCase
|
||||
->where('ticket.acceptance_criteria.1.checked', true)
|
||||
->where('ticket.acceptance_criteria.1.indent', 1)
|
||||
->where('ticket.assignee.name', 'Assigned User')
|
||||
->where('ticket.ticket_status.allowed_target_statuses.0.id', $targetStatus->id)
|
||||
->where('ticket.ticket_status.allowed_target_statuses.0.board_column.id', $targetColumn->id)
|
||||
->where('ticket.author', null)
|
||||
->where('ticket.author_user_id', null)
|
||||
->where('ticket.field_values.0.ticket_field_definition.label', 'Complexity')
|
||||
|
||||
Reference in New Issue
Block a user