|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Rappasoft\LaravelLivewireTables\Tests\Traits\Helpers; |
| 4 | + |
| 5 | +use Rappasoft\LaravelLivewireTables\Tests\TestCase; |
| 6 | + |
| 7 | +final class ToolsStylingHelpersTest extends TestCase |
| 8 | +{ |
| 9 | + public function test_can_get_tools_attributes_initial_status(): void |
| 10 | + { |
| 11 | + $this->assertTrue($this->basicTable->hasCustomAttributes('toolsAttributes')); |
| 12 | + } |
| 13 | + |
| 14 | + public function test_can_get_tools_attributes_initial_values(): void |
| 15 | + { |
| 16 | + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolsAttributesBag()->getAttributes()); |
| 17 | + } |
| 18 | + |
| 19 | + public function test_can_change_tools_attributes_initial_values(): void |
| 20 | + { |
| 21 | + $this->basicTable->setToolsAttributes(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true]); |
| 22 | + $this->assertSame(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolsAttributesBag()->getAttributes()); |
| 23 | + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolBarAttributesBag()->getAttributes()); |
| 24 | + } |
| 25 | + |
| 26 | + public function test_can_change_tools_attributes_initial_values_no_defaults(): void |
| 27 | + { |
| 28 | + $this->basicTable->setToolsAttributes(['class' => 'bg-amber-500']); |
| 29 | + $this->assertSame(['class' => 'bg-amber-500', 'default-colors' => false, 'default-styling' => false], $this->basicTable->getToolsAttributesBag()->getAttributes()); |
| 30 | + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolBarAttributesBag()->getAttributes()); |
| 31 | + |
| 32 | + } |
| 33 | + |
| 34 | + public function test_can_get_toolbar_attributes_initial_status(): void |
| 35 | + { |
| 36 | + $this->assertTrue($this->basicTable->hasCustomAttributes('toolBarAttributes')); |
| 37 | + } |
| 38 | + |
| 39 | + public function test_can_get_toolbar_attributes_initial_values(): void |
| 40 | + { |
| 41 | + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolBarAttributesBag()->getAttributes()); |
| 42 | + } |
| 43 | + |
| 44 | + public function test_can_change_toolbar_attributes_initial_values(): void |
| 45 | + { |
| 46 | + $this->basicTable->setToolBarAttributes(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true]); |
| 47 | + $this->assertSame(['class' => 'bg-blue-500', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolBarAttributesBag()->getAttributes()); |
| 48 | + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolsAttributesBag()->getAttributes()); |
| 49 | + |
| 50 | + } |
| 51 | + |
| 52 | + public function test_can_change_toolbar_attributes_initial_values_no_defaults(): void |
| 53 | + { |
| 54 | + $this->basicTable->setToolBarAttributes(['class' => 'bg-green-500']); |
| 55 | + $this->assertSame(['class' => 'bg-green-500', 'default-colors' => false, 'default-styling' => false], $this->basicTable->getToolBarAttributesBag()->getAttributes()); |
| 56 | + $this->assertSame(['class' => '', 'default-colors' => true, 'default-styling' => true], $this->basicTable->getToolsAttributesBag()->getAttributes()); |
| 57 | + } |
| 58 | + |
| 59 | + public function test_can_change_tools_and_toolbar_attributes_initial_values_no_defaults(): void |
| 60 | + { |
| 61 | + $this->basicTable->setToolsAttributes(['class' => 'bg-amber-500'])->setToolBarAttributes(['class' => 'bg-green-500']); |
| 62 | + |
| 63 | + $this->assertSame(['class' => 'bg-amber-500', 'default-colors' => false, 'default-styling' => false], $this->basicTable->getToolsAttributesBag()->getAttributes()); |
| 64 | + |
| 65 | + $this->assertSame(['class' => 'bg-green-500', 'default-colors' => false, 'default-styling' => false], $this->basicTable->getToolBarAttributesBag()->getAttributes()); |
| 66 | + } |
| 67 | +} |
0 commit comments