Skip to content

Commit

Permalink
Update icon tag to 'i' instead of 'svg'. (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Jan 2, 2024
1 parent 88ebdc0 commit c6a34e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Attribute/Component/HasIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait HasIcon
protected string $iconContainerTag = 'div';
protected string $iconContent = '';
protected string $iconFilePath = '';
protected string $iconTag = 'svg';
protected string $iconTag = 'i';

/**
* @return array The `HTML` attributes of the icon of the menu item.
Expand Down
12 changes: 4 additions & 8 deletions tests/Attribute/Component/HasIconTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ public function render(): string

Assert::equalsWithoutLE(
<<<HTML
<svg class="class">
content
</svg>
<i class="class">content</i>
HTML,
$instance->render()
);
Expand Down Expand Up @@ -200,9 +198,7 @@ public function render(): string
Assert::equalsWithoutLE(
<<<HTML
<div>
<svg class="class">
content
</svg>
<i class="class">content</i>
</div>
HTML,
$instance->render()
Expand Down Expand Up @@ -255,7 +251,7 @@ public function render(): string

$this->assertEmpty($instance->render());

$instance = $instance->iconFilePath(dirname(__DIR__, 3) . '/src/Base/Svg/toggle.svg');
$instance = $instance->iconFilePath(dirname(__DIR__, 3) . '/src/Base/Svg/toggle.svg')->iconTag('svg');

Assert::assertStringContainsString(
<<<HTML
Expand All @@ -276,7 +272,7 @@ public function getIconTag(): string
}
};

$this->assertSame('svg', $instance->getIconTag());
$this->assertSame('i', $instance->getIconTag());

$instance = $instance->iconTag('span');

Expand Down
3 changes: 3 additions & 0 deletions tests/ButtonToggle/FlowbiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function testAlert(): void
->dataDismissTarget(true)
->id('button-toggle-658716145f1d9')
->iconFilePath(dirname(__DIR__, 2) . '/src/Base/Svg/toggle.svg')
->iconTag('svg')
->toggleClass('sr-only')
->toggleContent('Close')
->toggleId('id')
Expand All @@ -48,6 +49,7 @@ public function testDropdown(): void
->dataDropdownToggle(true)
->icon(true)
->iconFilePath(dirname(__DIR__, 2) . '/src/Base/Svg/toggle.svg')
->iconTag('svg')
->id('button-toggle-658716145f1d9')
->link()
->role(true)
Expand All @@ -73,6 +75,7 @@ public function testSidebar(): void
->dataToggle(true)
->icon(true)
->iconFilePath(dirname(__DIR__, 2) . '/src/Base/Svg/toggle.svg')
->iconTag('svg')
->id('button-toggle-658716145f1d9')
->toggleClass('sr-only')
->toggleContent('Open sidebar')
Expand Down

0 comments on commit c6a34e9

Please sign in to comment.