Skip to content

Commit

Permalink
fix: add closing tag to "script" tag (#73)
Browse files Browse the repository at this point in the history
* fix: add closing tag to "script" tag

* tests: update to apply changes
  • Loading branch information
owenvoke authored Apr 19, 2021
1 parent 0b39ddf commit 9f872fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Components/Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function path(): string
public function render(): string
{
return <<<'blade'
<script src="{{ $path() }}" integrity="{{ $integrity() }}" crossorigin="{{ $crossorigin }}" {{ $attributes }} />
<script src="{{ $path() }}" integrity="{{ $integrity() }}" crossorigin="{{ $crossorigin }}" {{ $attributes }}></script>
blade;
}
}
6 changes: 3 additions & 3 deletions tests/Components/ScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function it_renders_the_component()

$view = View::file(dirname(__DIR__).'/files/script.blade.php', ['mix' => false, 'crossOrigin' => 'anonymous'])->render();
$expected = <<<'HTML'
<script src="http://localhost/js/app.js" integrity="this-hash-is-valid" crossorigin="anonymous" />
<script src="http://localhost/js/app.js" integrity="this-hash-is-valid" crossorigin="anonymous" ></script>
HTML;

$this->assertStringContainsString(
Expand All @@ -44,7 +44,7 @@ public function it_uses_mix_when_the_mix_attribute_is_passed()

$view = View::file(dirname(__DIR__).'/files/script.blade.php', ['mix' => true, 'crossOrigin' => 'anonymous'])->render();
$expected = <<<'HTML'
<script src="/js/app.js?id=some-random-string" integrity="this-hash-is-valid" crossorigin="anonymous" />
<script src="/js/app.js?id=some-random-string" integrity="this-hash-is-valid" crossorigin="anonymous" ></script>
HTML;

$this->assertStringContainsString(
Expand All @@ -64,7 +64,7 @@ public function it_uses_the_crossorigin_attribute_if_passed()

$view = View::file(dirname(__DIR__).'/files/script.blade.php', ['mix' => false, 'crossOrigin' => 'test'])->render();
$expected = <<<'HTML'
<script src="http://localhost/js/app.js" integrity="this-hash-is-valid" crossorigin="test" />
<script src="http://localhost/js/app.js" integrity="this-hash-is-valid" crossorigin="test" ></script>
HTML;

$this->assertStringContainsString(
Expand Down

0 comments on commit 9f872fb

Please sign in to comment.