Skip to content

Commit

Permalink
Test Additions (#1339)
Browse files Browse the repository at this point in the history
* Add NonArray setAdditionalSelects Test

* Update for FrontendAssets Test

* Fix styling

---------

Co-authored-by: lrljoe <[email protected]>
  • Loading branch information
lrljoe and lrljoe authored Sep 3, 2023
1 parent 4ee351e commit 32556cd
Show file tree
Hide file tree
Showing 2 changed files with 34 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;
}
}
33 changes: 33 additions & 0 deletions tests/Mechanisms/RappasoftFrontendAssetsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Rappasoft\LaravelLivewireTables\Tests\Mechanisms;

use Rappasoft\LaravelLivewireTables\Mechanisms\RappasoftFrontendAssets;
use Rappasoft\LaravelLivewireTables\Tests\TestCase;

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 32556cd

Please sign in to comment.