]> BookStack Code Mirror - bookstack/blob - tests/Settings/CustomHeadContentTest.php
Fixed issue with HTML tags in custom head scripts
[bookstack] / tests / Settings / CustomHeadContentTest.php
1 <?php
2
3 namespace Tests\Settings;
4
5 use Tests\TestCase;
6
7 class CustomHeadContentTest extends TestCase
8 {
9
10     public function test_configured_content_shows_on_pages()
11     {
12         $this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
13         $resp = $this->get('/login');
14         $resp->assertSee('console.log("cat")');
15     }
16
17     public function test_configured_content_does_not_show_on_settings_page()
18     {
19         $this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
20         $resp = $this->asAdmin()->get('/settings');
21         $resp->assertDontSee('console.log("cat")');
22     }
23
24     public function test_divs_in_js_preserved_in_configured_content()
25     {
26         $this->setSettings(['app-custom-head' => '<script><div id="hello">cat</div></script>']);
27         $resp = $this->get('/login');
28         $resp->assertSee('<div id="hello">cat</div>');
29     }
30 }