Skip to content

Commit

Permalink
Adjust Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe committed Dec 24, 2024
1 parent aaf7615 commit 0fb5a1c
Showing 1 changed file with 71 additions and 8 deletions.
79 changes: 71 additions & 8 deletions tests/Unit/Traits/Styling/FilterInputDefaultStylingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PHPUnit\Framework\Attributes\Group;
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable;

#[Group('Filters')]
#[Group('Styling')]
Expand All @@ -18,16 +19,47 @@ public function test_can_get_filter_default_input_styling(): void
{
$this->assertFalse($this->basicTable->hasDefaultFilterInputStyling());

$this->assertSame('block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50', $this->getDefaultFilterInputStyling());
$this->assertSame('block w-full rounded-md shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50', $this->basicTable->getDefaultFilterInputStyling());
}

public function test_can_set_filter_default_input_styling(): void
{
$this->assertFalse($this->basicTable->hasDefaultFilterInputStyling());
$testTableDefault = new class extends PetsTable
{
public function configure(): void
{
parent::configure();

}

public function setDefaultFilterInputStyling(string $defaultFilterInputStyling): self
{
parent::setDefaultFilterInputStyling($defaultFilterInputStyling);

return $this;
}



};

$testTableDefault->configure();
$testTableDefault->boot();
$testTableDefault->bootedComponentUtilities();
$testTableDefault->bootedWithData();
$testTableDefault->bootedWithColumns();
$testTableDefault->bootedWithColumnSelect();
$testTableDefault->bootedWithSecondaryHeader();
$testTableDefault->booted();

$this->assertFalse($testTableDefault->hasDefaultFilterInputStyling());

$testTableDefault->setDefaultFilterInputStyling('p-4');

$this->assertTrue($testTableDefault->hasDefaultFilterInputStyling());

$this->basicTable->setDefaultFilterInputStyling('p-4');
$this->assertSame('p-4', $testTableDefault->getDefaultFilterInputStyling());

$this->assertTrue($this->basicTable->hasDefaultFilterInputStyling());
}

public function test_has_filter_default_input_colors(): void
Expand All @@ -37,17 +69,48 @@ public function test_has_filter_default_input_colors(): void

public function test_can_set_filter_default_input_colors(): void
{
$this->assertFalse($this->basicTable->hasDefaultFilterInputColors());

$this->basicTable->setDefaultFilterInputColors('bg-blue-500');
$testTableDefault = new class extends PetsTable
{
public function configure(): void
{
parent::configure();

}


public function setDefaultFilterInputColors(string $defaultFilterInputColors): self
{
parent::setDefaultFilterInputColors($defaultFilterInputColors);

return $this;
}


};

$testTableDefault->configure();
$testTableDefault->boot();
$testTableDefault->bootedComponentUtilities();
$testTableDefault->bootedWithData();
$testTableDefault->bootedWithColumns();
$testTableDefault->bootedWithColumnSelect();
$testTableDefault->bootedWithSecondaryHeader();
$testTableDefault->booted();
$this->assertFalse($testTableDefault->hasDefaultFilterInputColors());

$testTableDefault->setDefaultFilterInputColors('bg-blue-500');

$this->assertTrue($testTableDefault->hasDefaultFilterInputColors());

$this->assertSame('bg-blue-500', $testTableDefault->getDefaultFilterInputColors());

$this->assertTrue($this->basicTable->hasDefaultFilterInputColors());
}

public function test_can_get_filter_default_input_colors(): void
{
$this->assertFalse($this->basicTable->hasDefaultFilterInputColors());

$this->assertSame('border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600', $this->getDefaultFilterInputColors());
$this->assertSame('border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-800 dark:text-white dark:border-gray-600', $this->basicTable->getDefaultFilterInputColors());
}
}

0 comments on commit 0fb5a1c

Please sign in to comment.