Skip to content

Commit

Permalink
Merge pull request #6 from wireui/hotfix/mini-variant
Browse files Browse the repository at this point in the history
Hotfix/mini-variant
  • Loading branch information
ph7jack authored Nov 16, 2022
2 parents bbd1387 + b9f29b3 commit 5f2fe24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<include>
<directory suffix=".php">src/</directory>
</include>

<exclude>
<directory suffix=".blade.php">src/views</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Unit">
Expand Down
5 changes: 3 additions & 2 deletions src/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function __construct(
) {
$this->variant = $this->getVariant();

if ($mini) {
$this->variant = "mini.{$this->variant}";
if ($mini || $this->variant === 'mini') {
$this->variant = 'mini.solid';
}
}

Expand All @@ -32,6 +32,7 @@ private function getVariant(): ?string
(bool) $this->variant => $this->variant,
$this->solid => 'solid',
$this->outline => 'outline',
$this->mini => 'mini.solid',
default => $this->defaultVariant()
};
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/IconComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ function getIcons(string $variant): Collection
['outline', new Icon(name: 'home', variant: 'outline')],
['outline', new Icon(name: 'home', outline: true)],
['solid', new Icon(name: 'home', solid: true)],
['mini.solid', new Icon(name: 'home', solid: true, mini: true)],
['mini.solid', new Icon(name: 'home', variant: 'mini', mini: true)],
['mini.solid', new Icon(name: 'home', mini: true)],
]);

it('should render all components with attributes', function (string $icon, string $variant) {
Expand Down

0 comments on commit 5f2fe24

Please sign in to comment.