-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCompilesIconsTest.php
63 lines (50 loc) · 2.44 KB
/
CompilesIconsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
declare(strict_types=1);
namespace Tests;
use BladeUI\Heroicons\BladeHeroiconsServiceProvider;
use BladeUI\Icons\BladeIconsServiceProvider;
use Orchestra\Testbench\TestCase;
class CompilesIconsTest extends TestCase
{
/** @test */
public function it_compiles_a_single_anonymous_component()
{
$result = svg('heroicon-o-bell')->toHtml();
// Note: the empty class here seems to be a Blade components bug.
$expected = <<<'SVG'
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/>
</svg>
SVG;
$this->assertSame($expected, $result);
}
/** @test */
public function it_can_add_classes_to_icons()
{
$result = svg('heroicon-o-bell', 'w-6 h-6 text-gray-500')->toHtml();
$expected = <<<'SVG'
<svg class="w-6 h-6 text-gray-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/>
</svg>
SVG;
$this->assertSame($expected, $result);
}
/** @test */
public function it_can_add_styles_to_icons()
{
$result = svg('heroicon-o-bell', ['style' => 'color: #555'])->toHtml();
$expected = <<<'SVG'
<svg style="color: #555" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/>
</svg>
SVG;
$this->assertSame($expected, $result);
}
protected function getPackageProviders($app)
{
return [
BladeIconsServiceProvider::class,
BladeHeroiconsServiceProvider::class,
];
}
}