Skip to content

Commit

Permalink
update comment identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Aug 18, 2024
1 parent 52371bf commit a6ef9d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/InjectAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __invoke(RequestHandled $handled)
}

// Skip if core was included before
if (str_contains($html, '<!--[{$this->injector->identifier()} ASSETS]-->')) {
if (str_contains($html, '<!--[{$this->injector->identifier()}]-->')) {
return;
}

Expand All @@ -39,7 +39,7 @@ public function __invoke(RequestHandled $handled)

$handled->response->setContent(
$this->inject($html, <<< HTML
<!--[{$this->injector->identifier()} ASSETS]-->
<!--[{$this->injector->identifier()}]-->
{$this->injector->inject()}
<!--[END{$this->injector->identifier()}]-->
HTML)
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/InjectsAssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@

$this->get('test-inject-in-response')
->assertOk()
->assertSee('<!--[TEST_PACKAGE ASSETS]-->', false);
->assertSee('<!--[TEST_PACKAGE]-->', false);
});

it('injects assets into html body when no head tag is present', function () {
Route::get('test-inject-in-response', fn () => '<html></html>');

$this->get('test-inject-in-response')
->assertOk()
->assertSee('<!--[TEST_PACKAGE ASSETS]-->', false);
->assertSee('<!--[TEST_PACKAGE]-->', false);
});

it('doesnt inject assets into responses without a closing html tag', function () {
Route::get('test-inject-in-response', fn () => 'OK');

$this->get('test-inject-in-response')
->assertOk()
->assertDontSee('<!--[TEST_PACKAGE ASSETS]-->', false);
->assertDontSee('<!--[TEST_PACKAGE]-->', false);
});

it('doesnt inject assets when implementation returns false from enabled method', function () {
Expand All @@ -35,5 +35,5 @@

$this->get('test-inject-in-response')
->assertOk()
->assertDontSee('<!--[TEST_PACKAGE ASSETS]-->', false);
->assertDontSee('<!--[TEST_PACKAGE]-->', false);
});

0 comments on commit a6ef9d1

Please sign in to comment.