-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathLocalModalTest.php
52 lines (44 loc) · 1.61 KB
/
LocalModalTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Tests\Browser;
use PHPUnit\Framework\Attributes\Test;
use Tests\DuskTestCase;
class LocalModalTest extends DuskTestCase
{
#[Test]
public function it_can_open_a_local_modal_and_a_nested_one()
{
$this->browse(function (Browser $browser) {
$browser->visit('/local')
->clickLink('Open Local Modal')
->waitForTextIn('.im-modal-content', 'This is a local modal')
->clickLink('Create Role')
->waitForTextIn('.im-dialog[data-inertiaui-modal-index="1"]', 'Create Role')
->clickModalCloseButton(1)
->waitUntilMissingModal(1);
});
}
#[Test]
public function it_can_access_a_prop_through_a_template_ref()
{
$this->browse(function (Browser $browser) {
$browser->visit('/local')
->clickLink('Open Local Modal')
->waitForTextIn('.im-modal-content', 'This is a local modal')
->press('Alert Modal ID');
$message = $browser->driver->switchTo()->alert()->getText();
$this->assertStringStartsWith('inertiaui_modal_', $message);
$browser->dismissDialog();
});
}
#[Test]
public function it_can_close_a_local_modal_through_a_template_ref()
{
$this->browse(function (Browser $browser) {
$browser->visit('/local')
->clickLink('Open Local Modal')
->waitForTextIn('.im-modal-content', 'This is a local modal')
->press('Close Modal through Ref')
->waitUntilMissingModal(1);
});
}
}