Skip to content

Commit 0cde3bc

Browse files
committed
Adjustments to Placeholder Attributes
1 parent 0118e06 commit 0cde3bc

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

src/Traits/Styling/Configuration/LoadingPlaceholderStylingConfiguration.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ trait LoadingPlaceholderStylingConfiguration
66
{
77
public function setLoadingPlaceHolderAttributes(array $attributes): self
88
{
9-
$this->setCustomAttributes('loadingPlaceHolderAttributes', $attributes);
10-
9+
$this->setCustomAttributes('loadingPlaceHolderAttributes', [...$this->getCustomAttributes(propertyName: 'loadingPlaceHolderAttributes', default: false, classicMode: true), ...$attributes]);
10+
1111
return $this;
1212
}
1313

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

1818
return $this;
1919
}
2020

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

2525
return $this;
2626
}

tests/Traits/Configuration/LoadingPlaceholderConfigurationTest.php

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,62 @@ public function test_can_set_loading_placeholder_attributes(): void
4848
{
4949
$this->basicTable->setLoadingPlaceholderEnabled();
5050

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

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

55-
$this->assertSame(['class' => 'test12345'], $this->basicTable->getLoadingPlaceHolderAttributes());
55+
$this->assertSame(['class' => 'test12345', 'default' => false, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getLoadingPlaceHolderAttributes());
56+
57+
$this->basicTable->setLoadingPlaceHolderAttributes(['class' => 'test12345', 'default' => true, 'default-colors' => true, 'default-styling' => true]);
58+
59+
$this->assertSame(['class' => 'test12345', 'default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderAttributes());
60+
61+
$this->basicTable->setLoadingPlaceHolderAttributes(['class' => 'test12345', 'default' => false, 'default-colors' => false, 'default-styling' => true]);
62+
63+
$this->assertSame(['class' => 'test12345', 'default' => false, 'default-colors' => false, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderAttributes());
64+
5665

5766
}
5867

5968
public function test_can_set_loading_placeholder_icon_attributes(): void
6069
{
6170
$this->basicTable->setLoadingPlaceholderEnabled();
6271

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

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

67-
$this->assertSame(['class' => 'test123'], $this->basicTable->getLoadingPlaceHolderIconAttributes());
76+
$this->assertSame(['class' => 'test123', 'default' => false, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getLoadingPlaceHolderIconAttributes());
77+
78+
$this->basicTable->setLoadingPlaceHolderIconAttributes(['class' => 'test123', 'default' => true, 'default-colors' => true, 'default-styling' => true]);
79+
80+
$this->assertSame(['class' => 'test123', 'default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderIconAttributes());
81+
82+
$this->basicTable->setLoadingPlaceHolderIconAttributes(['class' => 'test123', 'default' => false, 'default-colors' => false, 'default-styling' => true]);
83+
84+
$this->assertSame(['class' => 'test123', 'default' => false, 'default-colors' => false, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderIconAttributes());
85+
6886

6987
}
7088

7189
public function test_can_set_loading_placeholder_wrapper_attributes(): void
7290
{
7391
$this->basicTable->setLoadingPlaceholderEnabled();
7492

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

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

79-
$this->assertSame(['class' => 'test1234567-wrapper'], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());
97+
$this->assertSame(['class' => 'test1234567-wrapper', 'default' => false, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());
98+
99+
$this->basicTable->setLoadingPlaceHolderWrapperAttributes(['class' => 'test1234567-wrapper', 'default' => true, 'default-colors' => true, 'default-styling' => true]);
100+
101+
$this->assertSame(['class' => 'test1234567-wrapper', 'default' => true, 'default-colors' => true, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());
102+
103+
$this->basicTable->setLoadingPlaceHolderWrapperAttributes(['class' => 'test1234567-wrapper', 'default' => false, 'default-colors' => false, 'default-styling' => true]);
104+
105+
$this->assertSame(['class' => 'test1234567-wrapper', 'default' => false, 'default-colors' => false, 'default-styling' => true], $this->basicTable->getLoadingPlaceHolderWrapperAttributes());
106+
80107
}
81108

82109
public function test_can_set_loading_placeholder_custom_blade(): void

0 commit comments

Comments
 (0)