]> BookStack Code Mirror - bookstack/commitdiff
Comments: Added HTML filter test, fixed placeholder in dark mode 4815/head
authorDan Brown <redacted>
Wed, 31 Jan 2024 16:47:58 +0000 (16:47 +0000)
committerDan Brown <redacted>
Wed, 31 Jan 2024 16:47:58 +0000 (16:47 +0000)
resources/sass/_tinymce.scss
tests/Entity/CommentTest.php

index fb5ea7e6ffe7fcabab90b0bc1f4485119ee2bc60..b6a2156df199e8c0c3cb1880fba99be6f3fc8e7c 100644 (file)
@@ -34,7 +34,7 @@
   padding: 1rem;
   top: 4px;
   font-style: italic;
-  color: rgba(34,47,62,.5)
+  @include lightDark(color, rgba(34,47,62,.5), rgba(155,155,155,.5))
 }
 
 // Default styles for our custom root nodes
index eb4bccb7cae955b81fa9159b7456e4f2169be8cf..73136235ce07cb8645d0cfbfad44c15bd4def3cc 100644 (file)
@@ -117,6 +117,29 @@ class CommentTest extends TestCase
         $resp->assertDontSee('superbadonclick', false);
     }
 
+    public function test_comment_html_is_limited()
+    {
+        $page = $this->entities->page();
+        $input = '<h1>Test</h1><p id="abc" href="beans">Content<a href="#cat" data-a="b">a</a><section>Hello</section></p>';
+        $expected = '<p>Content<a href="#cat">a</a></p>';
+
+        $resp = $this->asAdmin()->post("/comment/{$page->id}", ['html' => $input]);
+        $resp->assertOk();
+        $this->assertDatabaseHas('comments', [
+           'entity_type' => 'page',
+           'entity_id' => $page->id,
+           'html' => $expected,
+        ]);
+
+        $comment = $page->comments()->first();
+        $resp = $this->put("/comment/{$comment->id}", ['html' => $input]);
+        $resp->assertOk();
+        $this->assertDatabaseHas('comments', [
+            'id'   => $comment->id,
+            'html' => $expected,
+        ]);
+    }
+
     public function test_reply_comments_are_nested()
     {
         $this->asAdmin();