@@ -202,6 +202,43 @@ test('users can move a todo up in the priority order', function () {
|
||||
expect($third->fresh()->position)->toBe(1);
|
||||
});
|
||||
|
||||
test('the reorder arrows reflect the new order after a move', function () {
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
$folder = Folder::factory()->for($user)->create(['name' => 'Work']);
|
||||
|
||||
Todo::factory()->recycle($user)->for($folder)->create(['description' => 'First todo', 'position' => 0]);
|
||||
Todo::factory()->recycle($user)->for($folder)->create(['description' => 'Second todo', 'position' => 1]);
|
||||
$third = Todo::factory()->recycle($user)->for($folder)->create(['description' => 'Third todo', 'position' => 2]);
|
||||
|
||||
// The last todo cannot move down until it has been moved up.
|
||||
Livewire::test('pages::todos')
|
||||
->assertDontSee('move-todo-down-'.$third->id)
|
||||
->call('moveTodo', $third->id, 'up')
|
||||
->assertSee('move-todo-down-'.$third->id);
|
||||
});
|
||||
|
||||
test('reordering while filtered keeps the order of the todos the filter hides', function () {
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
$work = Folder::factory()->for($user)->create(['name' => 'Work']);
|
||||
$home = Folder::factory()->for($user)->create(['name' => 'Home']);
|
||||
|
||||
Todo::factory()->recycle($user)->for($home)->create(['description' => 'Home one', 'position' => 0]);
|
||||
Todo::factory()->recycle($user)->for($home)->create(['description' => 'Home two', 'position' => 1]);
|
||||
$workOne = Todo::factory()->recycle($user)->for($work)->create(['description' => 'Work one', 'position' => 2]);
|
||||
Todo::factory()->recycle($user)->for($work)->create(['description' => 'Work two', 'position' => 3]);
|
||||
|
||||
Livewire::test('pages::todos')
|
||||
->set('folderId', $work->id)
|
||||
->call('handleSort', $workOne->id, 1);
|
||||
|
||||
Livewire::test('pages::todos')
|
||||
->assertSeeInOrder(['Home one', 'Home two', 'Work two', 'Work one']);
|
||||
});
|
||||
|
||||
test('users can delete a todo', function () {
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
|
||||
Reference in New Issue
Block a user