]> BookStack Code Mirror - bookstack/blobdiff - tests/Settings/CustomHeadContentTest.php
respective book and chapter structure added.
[bookstack] / tests / Settings / CustomHeadContentTest.php
index 94ef4711d5d640054ee0470516d3fccb3ad5eeaa..b2e21b91caeb13e0b5ee649cb501ea2f160568ad 100644 (file)
@@ -11,21 +11,30 @@ class CustomHeadContentTest extends TestCase
     {
         $this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
         $resp = $this->get('/login');
-        $resp->assertSee('console.log("cat")');
+        $resp->assertSee('console.log("cat")', false);
+    }
+
+    public function test_content_wrapped_in_specific_html_comments()
+    {
+        // These comments are used to identify head content for editor injection
+        $this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
+        $resp = $this->get('/login');
+        $resp->assertSee('<!-- Start: custom user content -->', false);
+        $resp->assertSee('<!-- End: custom user content -->', false);
     }
 
     public function test_configured_content_does_not_show_on_settings_page()
     {
         $this->setSettings(['app-custom-head' => '<script>console.log("cat");</script>']);
-        $resp = $this->asAdmin()->get('/settings');
-        $resp->assertDontSee('console.log("cat")');
+        $resp = $this->asAdmin()->get('/settings/features');
+        $resp->assertDontSee('console.log("cat")', false);
     }
 
     public function test_divs_in_js_preserved_in_configured_content()
     {
         $this->setSettings(['app-custom-head' => '<script><div id="hello">cat</div></script>']);
         $resp = $this->get('/login');
-        $resp->assertSee('<div id="hello">cat</div>');
+        $resp->assertSee('<div id="hello">cat</div>', false);
     }
 
     public function test_nonce_application_handles_edge_cases()
@@ -61,6 +70,6 @@ const b = `<script`;
 
         $this->setSettings(['app-custom-head' => $content]);
         $resp = $this->get('/login');
-        $resp->assertSee($expectedOutput);
+        $resp->assertSee($expectedOutput, false);
     }
 }