Skip to content

Commit

Permalink
Adjustments to Placeholder Attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe committed Oct 20, 2024
1 parent 0118e06 commit 0cde3bc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ trait LoadingPlaceholderStylingConfiguration
{
public function setLoadingPlaceHolderAttributes(array $attributes): self
{
$this->setCustomAttributes('loadingPlaceHolderAttributes', $attributes);

$this->setCustomAttributes('loadingPlaceHolderAttributes', [...$this->getCustomAttributes(propertyName: 'loadingPlaceHolderAttributes', default: false, classicMode: true), ...$attributes]);
return $this;
}

public function setLoadingPlaceHolderIconAttributes(array $attributes): self
{
$this->setCustomAttributes('loadingPlaceHolderIconAttributes', $attributes);
$this->setCustomAttributes('loadingPlaceHolderIconAttributes', [...$this->getCustomAttributes(propertyName: 'loadingPlaceHolderIconAttributes', default: false, classicMode: true), ...$attributes]);

return $this;
}

public function setLoadingPlaceHolderWrapperAttributes(array $attributes): self
{
$this->setCustomAttributes('loadingPlaceHolderWrapperAttributes', $attributes);
$this->setCustomAttributes('loadingPlaceHolderWrapperAttributes', [...$this->getCustomAttributes(propertyName: 'loadingPlaceHolderWrapperAttributes', default: false, classicMode: true), ...$attributes]);

return $this;
}
Expand Down
39 changes: 33 additions & 6 deletions tests/Traits/Configuration/LoadingPlaceholderConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,62 @@ public function test_can_set_loading_placeholder_attributes(): void
{
$this->basicTable->setLoadingPlaceholderEnabled();

$this->assertSame(['default' => true], $this->basicTable->getLoadingPlaceHolderAttributes());
$this->assertSame(['default' => true, 'default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderAttributes());

$this->basicTable->setLoadingPlaceHolderAttributes(['class' => 'test12345']);

$this->assertSame(['class' => 'test12345'], $this->basicTable->getLoadingPlaceHolderAttributes());
$this->assertSame(['class' => 'test12345', 'default' => false, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getLoadingPlaceHolderAttributes());

$this->basicTable->setLoadingPlaceHolderAttributes(['class' => 'test12345', 'default' => true, 'default-colors' => true, 'default-styling' => true]);

$this->assertSame(['class' => 'test12345', 'default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderAttributes());

$this->basicTable->setLoadingPlaceHolderAttributes(['class' => 'test12345', 'default' => false, 'default-colors' => false, 'default-styling' => true]);

$this->assertSame(['class' => 'test12345', 'default' => false, 'default-colors' => false, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderAttributes());


}

public function test_can_set_loading_placeholder_icon_attributes(): void
{
$this->basicTable->setLoadingPlaceholderEnabled();

$this->assertSame(['default' => true], $this->basicTable->getLoadingPlaceHolderIconAttributes());
$this->assertSame(['default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderIconAttributes());

$this->basicTable->setLoadingPlaceHolderIconAttributes(['class' => 'test123']);

$this->assertSame(['class' => 'test123'], $this->basicTable->getLoadingPlaceHolderIconAttributes());
$this->assertSame(['class' => 'test123', 'default' => false, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getLoadingPlaceHolderIconAttributes());

$this->basicTable->setLoadingPlaceHolderIconAttributes(['class' => 'test123', 'default' => true, 'default-colors' => true, 'default-styling' => true]);

$this->assertSame(['class' => 'test123', 'default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderIconAttributes());

$this->basicTable->setLoadingPlaceHolderIconAttributes(['class' => 'test123', 'default' => false, 'default-colors' => false, 'default-styling' => true]);

$this->assertSame(['class' => 'test123', 'default' => false, 'default-colors' => false, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderIconAttributes());


}

public function test_can_set_loading_placeholder_wrapper_attributes(): void
{
$this->basicTable->setLoadingPlaceholderEnabled();

$this->assertSame(['default' => true], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());
$this->assertSame(['default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());

$this->basicTable->setLoadingPlaceHolderWrapperAttributes(['class' => 'test1234567-wrapper']);

$this->assertSame(['class' => 'test1234567-wrapper'], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());
$this->assertSame(['class' => 'test1234567-wrapper', 'default' => false, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());

$this->basicTable->setLoadingPlaceHolderWrapperAttributes(['class' => 'test1234567-wrapper', 'default' => true, 'default-colors' => true, 'default-styling' => true]);

$this->assertSame(['class' => 'test1234567-wrapper', 'default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());

$this->basicTable->setLoadingPlaceHolderWrapperAttributes(['class' => 'test1234567-wrapper', 'default' => false, 'default-colors' => false, 'default-styling' => true]);

$this->assertSame(['class' => 'test1234567-wrapper', 'default' => false, 'default-colors' => false, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());

}

public function test_can_set_loading_placeholder_custom_blade(): void
Expand Down

0 comments on commit 0cde3bc

Please sign in to comment.