diff --git a/core/modules/search/src/Tests/SearchCommentTest.php b/core/modules/search/src/Tests/SearchCommentTest.php
index b9916e2..8b95c1f 100644
--- a/core/modules/search/src/Tests/SearchCommentTest.php
+++ b/core/modules/search/src/Tests/SearchCommentTest.php
@@ -126,6 +126,14 @@ function testSearchResultsComment() {
     $edit_comment['comment_body[0][format]'] = $full_html_format_id;
     $this->drupalPostForm('comment/reply/node/' . $node->id() .'/comment', $edit_comment, t('Save'));
 
+    // Post a comment with a keyword inside an evil script tag using
+    // 'FULL HTML' text format.
+    $edit_comment2 = array();
+    $edit_comment2['subject[0][value]'] = "<script>alert('stars');</script>";
+    $edit_comment2['comment_body[0][value]'] = "<script>alert('rainbow');</script>";
+    $edit_comment2['comment_body[0][format]'] = $full_html_format_id;
+    $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $edit_comment2, t('Save'));
+
     // Invoke search index update.
     $this->drupalLogout();
     $this->cronRun();
@@ -152,6 +160,14 @@ function testSearchResultsComment() {
     $this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
     $this->assertNoEscaped($edit_comment['comment_body[0][value]'], 'HTML in comment body is not escaped.');
 
+    // Search for the evil script comment body.
+    $edit = [
+      'keys' => 'rainbow',
+    ];
+    // Search for content inside script tag should return no result.
+    $this->drupalPostForm('search/node', $edit, t('Search'));
+    $this->assertText('Your search yielded no results.');
+
     // Hide comments.
     $this->drupalLogin($this->adminUser);
     $node->set('comment', CommentItemInterface::HIDDEN);
