Skip to content

Commit

Permalink
Add Third Party Tests (#1340)
Browse files Browse the repository at this point in the history
* Add NonArray setAdditionalSelects Test

* Update for FrontendAssets Test

* Add ThirdPartyScripts/Styles to Test

* Fix styling

---------

Co-authored-by: lrljoe <lrljoe@users.noreply.github.com>
  • Loading branch information
lrljoe and lrljoe authored Sep 3, 2023
1 parent 32556cd commit 9ec84f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function tableThirdpartyJs(array $options = []): string
);

return <<<HTML
<script src="{$url}" type="module" {$nonce} {$extraAttributes}></script>
<script src="{$url}" type="module" {$nonce} {$extraAttributes}></script>
HTML;
}
}
24 changes: 24 additions & 0 deletions tests/Mechanisms/RappasoftFrontendAssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,28 @@ public function scripts()

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

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

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

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

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

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

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

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

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

0 comments on commit 9ec84f1

Please sign in to comment.