-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update props when redirecting back to same modal
- Loading branch information
1 parent
afcb753
commit d2798a9
Showing
7 changed files
with
98 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Tests\Browser; | ||
|
||
use App\Models\User; | ||
use Illuminate\Support\Str; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use Tests\DuskTestCase; | ||
|
||
class RedirectToModalTest extends DuskTestCase | ||
{ | ||
#[Test] | ||
public function it_can_submit_a_form_and_redirect_back_to_the_same_modal() | ||
{ | ||
$this->browse(function (Browser $browser) { | ||
$firstUser = User::orderBy('name')->first(); | ||
|
||
$browser->visit('/users?navigate=1') | ||
->waitForFirstUser() | ||
->click("@edit-user-{$firstUser->id}") | ||
->waitForTextIn('.im-modal-content', 'Edit User') | ||
->type('name', $newName = Str::random(10)) | ||
->press('Update and refresh') | ||
->waitForText('User updated successfully!') | ||
->within('.im-dialog[data-inertiaui-modal-index="0"]', function (Browser $browser) use ($newName) { | ||
$browser->assertSee('Edit User '.$newName); | ||
}) | ||
->assertPathIs('/users/'.$firstUser->id.'/edit'); | ||
|
||
$this->assertDatabaseHas('users', [ | ||
'id' => $firstUser->id, | ||
'name' => $newName, | ||
]); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters