-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,34 @@ | ||
<?php | ||
|
||
namespace Ysfkaya\FilamentPhoneInput\Tests\Browser; | ||
|
||
use Laravel\Dusk\Browser; | ||
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput; | ||
use Ysfkaya\FilamentPhoneInput\Tests\BrowserTestCase; | ||
use Ysfkaya\FilamentPhoneInput\Tests\Fixtures\FilamentPhoneInputUserResource; | ||
|
||
class PhoneInputCountryStateTest extends BrowserTestCase | ||
{ | ||
protected ?string $resource = PhoneInputCountryStateResource::class; | ||
|
||
/** @test */ | ||
public function it_can_state_phone_country() | ||
{ | ||
$this->phoneTest( | ||
fn (Browser $browser) => $browser | ||
->waitFor('@phone-input.data.phone') | ||
->pause(300) | ||
->typeSlowly('@phone-input.data.phone input.fi-input', '5301111111') | ||
->pause(300) | ||
->assertScript('window.duskCountryValue', 'TR') | ||
); | ||
} | ||
} | ||
|
||
class PhoneInputCountryStateResource extends FilamentPhoneInputUserResource | ||
{ | ||
public static function getPhoneInput(): ?PhoneInput | ||
{ | ||
return parent::getPhoneInput()->countryStatePath('phone_country'); | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
namespace Ysfkaya\FilamentPhoneInput\Tests\Browser; | ||
|
||
use Laravel\Dusk\Browser; | ||
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput; | ||
use Ysfkaya\FilamentPhoneInput\Tests\BrowserTestCase; | ||
use Ysfkaya\FilamentPhoneInput\Tests\Fixtures\FilamentPhoneInputUserResource; | ||
|
||
class PhoneInputStrictModeTest extends BrowserTestCase | ||
{ | ||
protected ?string $resource = PhoneInputStrictModeResource::class; | ||
|
||
/** @test */ | ||
public function it_should_be_not_allow_string() | ||
{ | ||
$this->phoneTest( | ||
fn (Browser $browser) => $browser | ||
->waitFor('@phone-input.data.phone') | ||
->typeSlowly('@phone-input.data.phone input.fi-input', 'not allow string 5301111111') | ||
->pause(300) | ||
->assertValue('@phone-input.data.phone input.fi-input', '0530 111 11 11') | ||
); | ||
} | ||
} | ||
|
||
class PhoneInputStrictModeResource extends FilamentPhoneInputUserResource | ||
{ | ||
public static function getPhoneInput(): ?PhoneInput | ||
{ | ||
return parent::getPhoneInput()->strictMode(); | ||
} | ||
} |