mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 13:31:18 +08:00
FIX: navigation item counters weren't updating properly
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import createStore from 'helpers/create-store';
|
||||
|
||||
QUnit.module("Discourse.NavItem", {
|
||||
beforeEach() {
|
||||
Ember.run(function() {
|
||||
@ -19,3 +21,15 @@ QUnit.test('href', assert =>{
|
||||
href('category/bug', '/c/bug', 'English category name');
|
||||
href('category/确实是这样', '/c/343434-category', 'Chinese category name');
|
||||
});
|
||||
|
||||
QUnit.test("count", assert => {
|
||||
const navItem = createStore().createRecord("nav-item", { name: "new" });
|
||||
|
||||
assert.equal(navItem.get("count"), 0, "it has no count by default");
|
||||
|
||||
const tracker = navItem.get("topicTrackingState");
|
||||
tracker.states["t1"] = { topic_id: 1, last_read_post_number: null };
|
||||
tracker.incrementMessageCount();
|
||||
|
||||
assert.equal(navItem.get("count"), 1, "it updates when a new message arrives");
|
||||
});
|
||||
|
Reference in New Issue
Block a user