Commit 0450f35a authored by Eric Eastwood's avatar Eric Eastwood Committed by Andrew Newdigate

Fix category store active item

parent b108a548
......@@ -12,7 +12,7 @@ export const ForumCategoryStore = Collection.extend({
model: CategoryModel,
initialize: function() {
this.listenTo(router, 'change:category', this.onCategoryUpdate, this);
this.listenTo(router, 'change:categoryName', this.onCategoryUpdate, this);
},
getCategories: function() {
......
......@@ -22,14 +22,14 @@ describe('ForumCategoryStore', function(){
});
it('should update the active element when the route changes', function(){
mockRouter.set('category', 'test-1');
mockRouter.set('categoryName', 'test-1');
assert.equal(categoryStore.at(0).get('active'), false);
assert(categoryStore.at(1).get('active'));
});
it('should dispatch un active:update event when the active category changes', function(){
categoryStore.on(UPDATE_ACTIVE_CATEGORY, handle);
mockRouter.set('category', 'test-2');
mockRouter.set('categoryName', 'test-2');
assert.equal(handle.callCount, 1);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment