This commit is contained in:
@@ -670,3 +670,37 @@ test('completed todos sort last regardless of their position', function () {
|
||||
Livewire::test('pages::dashboard')
|
||||
->assertSeeInOrder(['Pending task', 'Finished task']);
|
||||
});
|
||||
|
||||
test('dashboard todos can be sorted by a column', function () {
|
||||
$this->travelTo('2026-09-18 09:00:00');
|
||||
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
$folder = Folder::factory()->for($user)->create(['name' => 'Work']);
|
||||
|
||||
Todo::factory()->recycle($user)->for($folder)->create([
|
||||
'description' => 'Later task',
|
||||
'due_date' => today()->addDays(2),
|
||||
'position' => 0,
|
||||
]);
|
||||
Todo::factory()->recycle($user)->for($folder)->create([
|
||||
'description' => 'Sooner task',
|
||||
'due_date' => today()->addDay(),
|
||||
'position' => 1,
|
||||
]);
|
||||
Todo::factory()->recycle($user)->for($folder)->noDueDate()->create([
|
||||
'description' => 'No due task',
|
||||
'position' => 2,
|
||||
]);
|
||||
|
||||
Livewire::test('pages::dashboard')
|
||||
->assertSeeInOrder(['Later task', 'Sooner task', 'No due task'])
|
||||
->call('sort', 'due_date')
|
||||
->assertSet('sortBy', 'due_date')
|
||||
->assertSet('sortDirection', 'asc')
|
||||
->assertSeeInOrder(['Sooner task', 'Later task', 'No due task'])
|
||||
->call('sort', 'due_date')
|
||||
->assertSet('sortDirection', 'desc')
|
||||
->assertSeeInOrder(['Later task', 'Sooner task', 'No due task']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user