diff --git a/core/modules/comment/src/Tests/CommentInterfaceTest.php b/core/modules/comment/src/Tests/CommentInterfaceTest.php
index 0dc5ea294c8ba7a4909fc270751e4cfefc059d99..4b326a6d83e7d68ac02078b646f7b79aed30f0b8 100644
--- a/core/modules/comment/src/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/src/Tests/CommentInterfaceTest.php
@@ -26,6 +26,12 @@ class CommentInterfaceTest extends CommentTestBase {
public function setUp() {
parent::setUp();
$this->drupalLogin($this->adminUser);
+ // Make sure that comment field title is not displayed when there's no
+ // comments posted.
+ $this->drupalGet($this->node->urlInfo());
+ $this->assertNoPattern('@
]*>Comments
@', 'Comments title is not displayed.');
+
+ // Set comments to have subject and preview disabled.
$this->setCommentPreview(DRUPAL_DISABLED);
$this->setCommentForm(TRUE);
$this->setCommentSubject(FALSE);
@@ -44,6 +50,10 @@ public function testCommentInterface() {
$comment = $this->postComment($this->node, $comment_text);
$this->assertTrue($this->commentExists($comment), 'Comment found.');
+ // Test the comment field title is displayed when there's comments.
+ $this->drupalGet($this->node->urlInfo());
+ $this->assertPattern('@]*>Comments
@', 'Comments title is displayed.');
+
// Set comments to have subject and preview to required.
$this->drupalLogout();
$this->drupalLogin($this->adminUser);