Skip to content

Commit 0969bdb

Browse files
lrljoegithub-actions[bot]
authored andcommitted
Fix styling
1 parent ec093cd commit 0969bdb

File tree

3 files changed

+24
-34
lines changed

3 files changed

+24
-34
lines changed

src/Traits/Core/HasCustomAttributes.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,35 +81,30 @@ public function getCustomAttributesNew(string $propertyName, bool $default = fal
8181
{
8282

8383
if ($classicMode) {
84-
$defaultItems = ['default','default-colors','default-styling'];
84+
$defaultItems = ['default', 'default-colors', 'default-styling'];
8585

8686
if ($this->hasCustomAttributes($propertyName)) {
8787
$vals = $this->{$propertyName};
8888

89-
foreach($defaultItems as $defaultItem)
90-
{
91-
if(!array_key_exists($defaultItem, $vals) || is_null($vals[$defaultItem]))
92-
{
89+
foreach ($defaultItems as $defaultItem) {
90+
if (! array_key_exists($defaultItem, $vals) || is_null($vals[$defaultItem])) {
9391
$vals[$defaultItem] = $default;
9492
}
9593
}
9694

97-
9895
ksort($vals);
9996

10097
return $vals;
10198
}
10299

103100
return ['default' => $default, 'default-colors' => $default, 'default-styling' => $default];
104101
} else {
105-
$defaultItems = ['default-colors','default-styling'];
102+
$defaultItems = ['default-colors', 'default-styling'];
106103

107104
if ($this->hasCustomAttributes($propertyName)) {
108105
$vals = $this->{$propertyName};
109-
foreach($defaultItems as $defaultItem)
110-
{
111-
if(!array_key_exists($defaultItem, $vals) || is_null($vals[$defaultItem]))
112-
{
106+
foreach ($defaultItems as $defaultItem) {
107+
if (! array_key_exists($defaultItem, $vals) || is_null($vals[$defaultItem])) {
113108
$vals[$defaultItem] = $default;
114109
}
115110
}
@@ -123,13 +118,12 @@ public function getCustomAttributesNew(string $propertyName, bool $default = fal
123118

124119
}
125120
}
126-
121+
127122
public function setCustomAttributesDefaults(string $propertyName, array $customAttributes, bool $default = false, bool $classicMode = true): self
128123
{
129-
130-
$this->{$propertyName} = array_merge($this->getCustomAttributesNew(propertyName: $propertyName, default: $default, classicMode: $classicMode),$customAttributes);
124+
125+
$this->{$propertyName} = array_merge($this->getCustomAttributesNew(propertyName: $propertyName, default: $default, classicMode: $classicMode), $customAttributes);
131126

132127
return $this;
133128
}
134-
135129
}

src/Traits/Styling/HasBulkActionsStyling.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait HasBulkActionsStyling
1414
protected array $bulkActionsThCheckboxAttributes = ['default' => null, 'default-colors' => null, 'default-styling' => null];
1515

1616
protected array $bulkActionsTdAttributes = ['default' => null, 'default-colors' => null, 'default-styling' => null];
17-
17+
1818
protected array $bulkActionsTdCheckboxAttributes = ['default' => null, 'default-colors' => null, 'default-styling' => null];
1919

2020
protected array $bulkActionsButtonAttributes = ['default-colors' => true, 'default-styling' => true];
@@ -140,7 +140,7 @@ public function getBulkActionsRowButtonAttributesBag(): ComponentAttributeBag
140140
{
141141
return $this->getCustomAttributesBagFromArray($this->getBulkActionsRowButtonAttributes());
142142
}
143-
143+
144144
/**
145145
* Used to set attributes for the Bulk Actions Menu Button
146146
*/

tests/Unit/Traits/Configuration/BulkActionsStylingConfigurationTest.php

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function test_can_set_bulk_actions_attributes_via_provider(string $setMet
7373
'default-styling' => $defaultStyling,
7474
]);
7575

76-
$returnedData = collect($this->basicTable->{$getMethod}())->only(['class','default','default-colors','default-styling'])->sortKeys()->toArray();
76+
$returnedData = collect($this->basicTable->{$getMethod}())->only(['class', 'default', 'default-colors', 'default-styling'])->sortKeys()->toArray();
7777

7878
$this->assertSame([
7979
'class' => $class1,
@@ -82,15 +82,14 @@ public function test_can_set_bulk_actions_attributes_via_provider(string $setMet
8282
'default-styling' => $defaultStyling,
8383
], $returnedData);
8484

85-
8685
$this->basicTable->{$setMethod}([
8786
'default' => $default,
8887
'class' => $class2,
8988
'default-colors' => ! $defaultColors,
9089
'default-styling' => $defaultStyling,
9190
]);
9291

93-
$returnedData = collect($this->basicTable->{$getMethod}())->only(['class','default','default-colors','default-styling'])->sortKeys()->toArray();
92+
$returnedData = collect($this->basicTable->{$getMethod}())->only(['class', 'default', 'default-colors', 'default-styling'])->sortKeys()->toArray();
9493

9594
$this->assertSame([
9695
'class' => $class2,
@@ -112,8 +111,8 @@ public function test_can_get_bulk_actions_attributes_bag_via_provider(string $se
112111

113112
$this->basicTable->{$setMethod}($data);
114113

115-
$returnedData = collect($this->basicTable->{$getMethod}())->only(['class','default','default-colors','default-styling'])->sortKeys()->toArray();
116-
114+
$returnedData = collect($this->basicTable->{$getMethod}())->only(['class', 'default', 'default-colors', 'default-styling'])->sortKeys()->toArray();
115+
117116
$this->assertSame($data, $returnedData);
118117

119118
$attributeBag = new ComponentAttributeBag($data);
@@ -128,8 +127,8 @@ public function test_bulk_actions_td_attributes_returns_default_true_if_not_set(
128127

129128
public function test_bulk_actions_td_checkbox_attributes_returns_default_true_if_not_set(): void
130129
{
131-
132-
$this->assertSame(['default' => true, 'default-colors' => true, 'default-styling' => true], collect($this->basicTable->getBulkActionsTdCheckboxAttributes())->only(['class','default','default-colors','default-styling'])->sortKeys()->toArray());
130+
131+
$this->assertSame(['default' => true, 'default-colors' => true, 'default-styling' => true], collect($this->basicTable->getBulkActionsTdCheckboxAttributes())->only(['class', 'default', 'default-colors', 'default-styling'])->sortKeys()->toArray());
133132
}
134133

135134
public function test_bulk_actions_th_attributes_returns_default_true_if_not_set(): void
@@ -149,8 +148,8 @@ public function test_bulk_actions_td_checkbox_attributes_returns_additional_data
149148
'x-model' => 'selectedItems',
150149
'wire:loading.attr.delay' => 'disabled',
151150
'type' => 'checkbox',
152-
'default' => true,
153-
'default-colors' => true,
151+
'default' => true,
152+
'default-colors' => true,
154153
'default-styling' => true,
155154
];
156155
ksort($defaultData);
@@ -168,14 +167,13 @@ public function test_bulk_actions_td_checkbox_attributes_returns_additional_data
168167
'x-model' => 'selectedItems',
169168
'wire:loading.attr.delay' => 'disabled',
170169
'type' => 'checkbox',
171-
'default' => true,
172-
'default-colors' => true,
170+
'default' => true,
171+
'default-colors' => true,
173172
'default-styling' => true,
174173
]);
175174
$returnedAttributeBag = new ComponentAttributeBag($this->basicTable->getBulkActionsTdCheckboxAttributes());
176-
177-
$this->assertSame($defaultAttributeBag->getAttributes(), $returnedAttributeBag->getAttributes());
178175

176+
$this->assertSame($defaultAttributeBag->getAttributes(), $returnedAttributeBag->getAttributes());
179177

180178
$this->basicTable->setBulkActionsTdCheckboxAttributes([
181179
'default-colors' => true,
@@ -188,15 +186,13 @@ public function test_bulk_actions_td_checkbox_attributes_returns_additional_data
188186
'wire:loading.attr.delay' => 'disabled',
189187
'type' => 'checkbox',
190188
'class' => 'w-12',
191-
'default' => false,
192-
'default-colors' => true,
189+
'default' => false,
190+
'default-colors' => true,
193191
'default-styling' => false,
194192
]);
195193

196194
$updatedAttributeBag = new ComponentAttributeBag($this->basicTable->getBulkActionsTdCheckboxAttributes());
197195
$this->assertSame($customAttributeBag->getAttributes(), $updatedAttributeBag->getAttributes());
198196

199197
}
200-
201-
202198
}

0 commit comments

Comments
 (0)