Skip to content

Commit

Permalink
Update for FrontendAssets Test
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe committed Sep 3, 2023
1 parent fff5884 commit d8ed1b5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Traits/Mechanisms/WithRappasoftTableScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function tableJs(array $options = []): string
);

return <<<HTML
<script src="{$url}" {$nonce} {$extraAttributes}></script>
<script src="{$url}" {$nonce} {$extraAttributes}></script>
HTML;
}
}
36 changes: 36 additions & 0 deletions tests/Mechanisms/RappasoftFrontendAssetsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Rappasoft\LaravelLivewireTables\Tests\Mechanisms;

use Rappasoft\LaravelLivewireTables\Tests\TestCase;
use Rappasoft\LaravelLivewireTables\Mechanisms\RappasoftFrontendAssets;
use function Livewire\trigger;

class RappasoftFrontendAssetsTest extends TestCase
{

/** @test */
public function styles()
{
$assets = app(RappasoftFrontendAssets::class);

$this->assertFalse($assets->hasRenderedRappsoftTableStyles);

$this->assertStringStartsWith('<link href="/rappasoft/laravel-livewire-tables/core.min.css" rel="stylesheet" />', ltrim($assets->tableStyles()));

$this->assertTrue($assets->hasRenderedRappsoftTableStyles);
}

/** @test */
public function scripts()
{
$assets = app(RappasoftFrontendAssets::class);

$this->assertFalse($assets->hasRenderedRappsoftTableScripts);

$this->assertStringStartsWith('<script src="', $assets->tableScripts());

$this->assertTrue($assets->hasRenderedRappsoftTableScripts);
}

}

0 comments on commit d8ed1b5

Please sign in to comment.