]> BookStack Code Mirror - bookstack/blob - tests/Settings/CustomHeadContentTest.php
59d5fc06ccbe8b1ddac6cff8b98aace243de641b
[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     public function test_configured_content_shows_on_pages()
10     {
11         $this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
12         $resp = $this->get('/login');
13         $resp->assertSee('console.log("cat")');
14     }
15
16     public function test_configured_content_does_not_show_on_settings_page()
17     {
18         $this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
19         $resp = $this->asAdmin()->get('/settings');
20         $resp->assertDontSee('console.log("cat")');
21     }
22
23     public function test_divs_in_js_preserved_in_configured_content()
24     {
25         $this->setSettings(['app-custom-head' => '<script><div id="hello">cat</div></script>']);
26         $resp = $this->get('/login');
27         $resp->assertSee('<div id="hello">cat</div>');
28     }
29 }