equal(notificationsDropdown().find("li").length,3,"when user opens notifications dropdown for the second time, notifications are reloaded afresh");
equal(Discourse.User.current().get("unread_notifications"),0,"when user opens notifications dropdown for the second time, current user's notification count is zeroed again");
});
});
test("notifications: when there are no notifications",function(){
expect(3);
Discourse.URL_FIXTURES["/notifications"]=[];
visit("/")
.click("#user-notifications")
.then(function(){
equal(notificationsDropdown().find("ul").length,0,"a list of notifications is not displayed");
equal(notificationsDropdown().find("div.none").length,1,"special 'no notifications' message is displayed");
equal(notificationsDropdown().find("li").length,4,"dropdown contains list items for all notifications plus for additional 'more' link");
equal(notificationsDropdown().find("li").eq(0).attr("class"),"","list item for unread notification has no class");
equal(notificationsDropdown().find("li").eq(0).html(),'notifications.mentioned velesin <a href="/t/some-topic-title/1234">Some topic title</a>',"notification with a slug and for the first post in a topic is rendered correctly");
equal(notificationsDropdown().find("li").eq(1).attr("class"),"read","list item for read notification has correct class");
equal(notificationsDropdown().find("li").eq(1).html(),'notifications.replied velesin <a href="/t/topic/1234/2">Some topic title</a>',"notification without a slug and for a non-first post in a topic is rendered correctly");
equal(notificationsDropdown().find("li").eq(2).html(),'notifications.liked velesin <a href=""></a>',"notification without topic title is rendered correctly");
equal(notificationsDropdown().find("li").eq(3).attr("class"),"read last","list item for 'more' link has correct class");
equal(notificationsDropdown().find("li").eq(3).find("a").attr("href"),Discourse.User.current().get("path"),"'more' link points to a correct URL");
equal(notificationsDropdown().find("li").eq(3).find("a").text(),"notifications.more"+" …","'more' link has correct text");