Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"php": "^7.4|^8.0|^8.1|^8.2",
"blade-ui-kit/blade-icons": "^1.1",
"ext-json": "*",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0"
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0"
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^9.0|^10.5|^11.5.3"
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"phpunit/phpunit": "^9.0|^10.5|^11.5.3|^12.5.12"
},
"autoload": {
"psr-4": {
Expand Down
31 changes: 10 additions & 21 deletions tests/CompilesIconsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@

class CompilesIconsTest extends TestCase
{
/** @test */
public function it_compiles_a_single_anonymous_component()
public function test_it_compiles_a_single_anonymous_component()
{
$result = svg('flag-country-us')->toHtml();

// Note: the empty class here seems to be a Blade components bug.
$expected = <<<'SVG'
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 5 36 26"><path fill="#B22334" d="M35.445 7C34.752 5.809 33.477 5 32 5H18v2h17.445zM0 25h36v2H0zm18-8h18v2H18zm0-4h18v2H18zM0 21h36v2H0zm4 10h28c1.477 0 2.752-.809 3.445-2H.555c.693 1.191 1.968 2 3.445 2zM18 9h18v2H18z"/><path fill="#EEE" d="M.068 27.679c.017.093.036.186.059.277.026.101.058.198.092.296.089.259.197.509.333.743L.555 29h34.89l.002-.004c.135-.233.243-.483.332-.741.034-.099.067-.198.093-.301.023-.09.042-.182.059-.275.041-.22.069-.446.069-.679H0c0 .233.028.458.068.679zM0 23h36v2H0zm0-4v2h36v-2H18zm18-4h18v2H18zm0-4h18v2H18zM0 9c0-.233.03-.457.068-.679C.028 8.542 0 8.767 0 9zm.555-2l-.003.005L.555 7zM.128 8.044c.025-.102.06-.199.092-.297-.034.098-.066.196-.092.297zM18 9h18c0-.233-.028-.459-.069-.68-.017-.092-.035-.184-.059-.274-.027-.103-.059-.203-.094-.302-.089-.258-.197-.507-.332-.74.001-.001 0-.003-.001-.004H18v2z"/><path fill="#3C3B6E" d="M18 5H4C1.791 5 0 6.791 0 9v10h18V5z"/><path fill="#FFF" d="M2.001 7.726l.618.449-.236.725L3 8.452l.618.448-.236-.725L4 7.726h-.764L3 7l-.235.726zm2 2l.618.449-.236.725.617-.448.618.448-.236-.725L6 9.726h-.764L5 9l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L9 9l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L13 9l-.235.726zm-8 4l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L5 13l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L9 13l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L13 13l-.235.726zm-6-6l.618.449-.236.725L7 8.452l.618.448-.236-.725L8 7.726h-.764L7 7l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L11 7l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L15 7l-.235.726zm-12 4l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L3 11l-.235.726zM6.383 12.9L7 12.452l.618.448-.236-.725.618-.449h-.764L7 11l-.235.726h-.764l.618.449zm3.618-1.174l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L11 11l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L15 11l-.235.726zm-12 4l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L3 15l-.235.726zM6.383 16.9L7 16.452l.618.448-.236-.725.618-.449h-.764L7 15l-.235.726h-.764l.618.449zm3.618-1.174l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L11 15l-.235.726zm4 0l.618.449-.236.725.617-.448.618.448-.236-.725.618-.449h-.764L15 15l-.235.726z"/></svg>
SVG;

$this->assertSame($expected, $result);
}

/** @test */
public function it_can_add_classes_to_icons()
public function test_it_can_add_classes_to_icons()
{
$result = svg('flag-country-us', 'w-6 h-6 text-gray-500')->toHtml();

Expand All @@ -35,8 +32,7 @@ public function it_can_add_classes_to_icons()
$this->assertSame($expected, $result);
}

/** @test */
public function it_can_add_styles_to_icons()
public function test_it_can_add_styles_to_icons()
{
$result = svg('flag-country-us', ['style' => 'color: #555'])->toHtml();

Expand All @@ -47,8 +43,7 @@ public function it_can_add_styles_to_icons()
$this->assertSame($expected, $result);
}

/** @test */
public function it_compiles_a_circle_variant_icon()
public function test_it_compiles_a_circle_variant_icon()
{
$result = svg('flag-circle-country-us')->toHtml();

Expand All @@ -57,51 +52,45 @@ public function it_compiles_a_circle_variant_icon()
$this->assertStringContainsString('circle', $result);
}

/** @test */
public function it_compiles_a_flat_variant_icon()
public function test_it_compiles_a_flat_variant_icon()
{
$result = svg('flag-flat-country-us')->toHtml();

$this->assertStringContainsString('<svg', $result);
$this->assertStringContainsString('flag-icons-us', $result);
}

/** @test */
public function it_can_add_classes_to_circle_variant_icons()
public function test_it_can_add_classes_to_circle_variant_icons()
{
$result = svg('flag-circle-country-us', 'w-6 h-6')->toHtml();

$this->assertStringContainsString('class="w-6 h-6"', $result);
$this->assertStringContainsString('<svg', $result);
}

/** @test */
public function it_can_add_classes_to_flat_variant_icons()
public function test_it_can_add_classes_to_flat_variant_icons()
{
$result = svg('flag-flat-country-us', 'w-6 h-6')->toHtml();

$this->assertStringContainsString('class="w-6 h-6"', $result);
$this->assertStringContainsString('<svg', $result);
}

/** @test */
public function it_compiles_a_language_flag()
public function test_it_compiles_a_language_flag()
{
$result = svg('flag-language-en')->toHtml();

$this->assertStringContainsString('<svg', $result);
}

/** @test */
public function it_compiles_a_circle_language_flag()
public function test_it_compiles_a_circle_language_flag()
{
$result = svg('flag-circle-language-en')->toHtml();

$this->assertStringContainsString('<svg', $result);
}

/** @test */
public function it_compiles_a_flat_language_flag()
public function test_it_compiles_a_flat_language_flag()
{
$result = svg('flag-flat-language-en')->toHtml();

Expand Down