added button component
This commit is contained in:
43
tests/Feature/Component/ButtonTest.php
Normal file
43
tests/Feature/Component/ButtonTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Component;
|
||||
|
||||
use Tests\Feature\Component\DataProvider\ButtonTestDataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ButtonTest extends TestCase
|
||||
{
|
||||
public function testGeneratesButtonElement(): void
|
||||
{
|
||||
$view = $this->blade('<x-button>Click!</x-button>');
|
||||
|
||||
$view->assertSeeHtml('<button ');
|
||||
$view->assertDontSeeHtml('<a ');
|
||||
}
|
||||
|
||||
public function testButtonCanHaveAttributes(): void
|
||||
{
|
||||
$view = $this->blade('<x-button data-attr="123">Click!</x-button>');
|
||||
|
||||
$view->assertSeeHtml('data-attr="123"');
|
||||
}
|
||||
|
||||
public function testDefaultVariantIsPrimary(): void
|
||||
{
|
||||
$view = $this->blade('<x-button>Click!</x-button>');
|
||||
|
||||
$view->assertSeeHtml('bg-primary text-text-inverted');
|
||||
}
|
||||
|
||||
|
||||
#[\PHPUnit\Framework\Attributes\DataProviderExternal(ButtonTestDataProvider::class, 'getDataForButtonTestWithButtons')]
|
||||
public function testVariants(string $variant, string $expectedHtml): void
|
||||
{
|
||||
$button = sprintf('<x-button variant="%s">Click!</x-button>', $variant);
|
||||
$view = $this->blade($button);
|
||||
|
||||
$view->assertSeeHtml($expectedHtml);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user