Skip to content

Commit

Permalink
Test the HTML hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Feb 9, 2024
1 parent 503e586 commit 587ce5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/framework/tests/Unit/Views/HeadComponentViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ public function testComponentIncludesStylesView()
$this->assertStringContainsString("@include('hyde::layouts.styles')", $this->renderTestView());
}

public function testCanAddHeadHtmlFromConfigHook()
{
config(['hyde.hooks.head' => '<meta name="custom-hook" content="foo">']);

$this->assertStringContainsString('<meta name="custom-hook" content="foo">', $this->renderTestView());
}

protected function escapeIncludes(string $contents): string
{
return str_replace('@include', '@@include', $contents);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public function test_component_uses_relative_path_to_app_js_file_for_nested_page
Filesystem::unlink('_media/app.js');
}

public function testCanAddHeadHtmlFromConfigHook()
{
config(['hyde.hooks.body' => '<script src="custom-hook.js"></script>']);

$this->assertStringContainsString('<script src="custom-hook.js"></script>', $this->renderTestView());
}

public function test_scripts_can_be_pushed_to_the_component_scripts_stack()
{
view()->share('routeKey', '');
Expand Down

0 comments on commit 587ce5d

Please sign in to comment.