-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdc37ac
commit 1677895
Showing
10 changed files
with
79 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Enflow\Svg\Test; | ||
|
||
use Enflow\Svg\Exceptions\SvgMustBeRendered; | ||
use Enflow\Svg\Exceptions\SvgNotFoundException; | ||
use Enflow\Svg\Spritesheet; | ||
use Enflow\Svg\Svg; | ||
|
||
class SpritesheetTest extends TestCase | ||
{ | ||
use Snapshots; | ||
|
||
public function test_spritesheet() | ||
{ | ||
$this->assertCount(0, app(Spritesheet::class)); | ||
$this->assertMatchesTextSnapshot(app(Spritesheet::class)); | ||
|
||
$this->assertMatchesXmlSnapshot(svg('clock')->render()); | ||
|
||
$this->assertCount(1, app(Spritesheet::class)); | ||
|
||
// We don't use 'assertMatchesHtmlSnapshot' as this adds a <body> etc. around the test-subject. | ||
// This is fine locally, but fails in the GitHub actions matrix. | ||
$this->assertMatchesTextSnapshot(app(Spritesheet::class)); | ||
|
||
svg('clock')->render(); | ||
$this->assertCount(1, app(Spritesheet::class)); | ||
} | ||
|
||
public function test_that_svg_is_only_once_in_spritesheet() | ||
{ | ||
svg('clock')->render(); | ||
svg('clock')->render(); | ||
svg('house')->render(); | ||
|
||
$spritesheet = app(Spritesheet::class); | ||
$this->assertCount(2, $spritesheet); | ||
$this->assertEquals(2, substr_count($spritesheet->toHtml(), '<symbol')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/__snapshots__/SpritesheetTest--test_spritesheet--68--1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
4 changes: 4 additions & 0 deletions
4
tests/__snapshots__/SpritesheetTest--test_spritesheet--68--2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<svg aria-hidden="true" focusable="false" role="img"> | ||
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#custom-clock"/> | ||
</svg> |
1 change: 1 addition & 0 deletions
1
tests/__snapshots__/SpritesheetTest--test_spritesheet--68--3.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"custom-clock":{"name":"clock","pack":{"name":"custom","paths":["\/home\/michel\/code\/enflow\/laravel-svg\/tests\/fixtures\/custom"],"autoSizeOnViewBox":false,"autoDiscovery":true},"contents":"<svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"fas\" data-icon=\"clock\" class=\"svg-inline--fa fa-clock fa-w-16\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path fill=\"currentColor\" d=\"M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z\"><\/path><\/svg>\n"}} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.