Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.90
diff -u -p -r1.90 comment.test
--- modules/comment/comment.test	5 Oct 2010 06:17:28 -0000	1.90
+++ modules/comment/comment.test	28 Oct 2010 22:18:01 -0000
@@ -390,6 +390,35 @@ class CommentInterfaceTest extends Comme
     $this->drupalLogin($this->admin_user);
     $this->setCommentForm(FALSE);
   }
+
+  /**
+   * Tests whether "@count new comments" indicators show and link correctly.
+   */
+  public function testCommentNewCommentsIndicator() {
+    $this->drupalLogin($this->admin_user);
+    // Test if the right links are displayed when no comment is present for the node.
+    $this->drupalGet('node');
+    $this->assertLink(t('Add new comment'));
+    $this->assertNoLink(t('@count comments', array('@count' => 0)));
+    $this->assertNoLink(t('@count new comments', array('@count' => 0)));
+    // Post comment with admin user, check links for web user.
+    $this->postComment($this->node, $this->randomString(), $this->randomString());
+    $this->drupalGet('node');
+    $this->drupalLogout();
+    // Login whith web user and check links.
+    $this->drupalLogin($this->web_user);
+    $this->drupalGet('node');
+    $this->assertNoLink(t('Add new comment'));
+    $this->assertLink(t('1 new comment'));
+    $this->clickLink(t('1 new comment'));
+    $this->assertRaw('<span class="new">' . t('new') . '</span>', t('Found "new" marker.'));
+    $this->assertTrue($this->xpath('//a[@id=:new]/following-sibling::a[1][@id=:comment_id]', array(':new' => 'new', ':comment_id' => 'comment-1')), t('The "new" anchor is positioned at the right comment.'));
+    // Test if "new comment" link is correctly removed.
+    $this->drupalGet('node');
+    $this->assertLink(t('1 comment'));
+    $this->assertNoLink(t('1 new comment'));
+    $this->assertNoLink(t('@count new comments', array('@count' => 0)));
+  }
 }
 
 /**
