Commit 5ca6bfeb by Peter Fogg

Merge pull request #8668 from edx/peter-fogg/update-team-tab-urls

Update URL when switching between Team tabs.
parents 4662246b e6c7a571
......@@ -41,12 +41,14 @@
},
setActiveTab: function (index) {
var tab = this.tabs[index],
view = tab.view;
this.$('a.is-active').removeClass('is-active').attr('aria-selected', 'false');
this.$('a[data-index='+index+']').addClass('is-active').attr('aria-selected', 'true');
var view = this.tabs[index].view;
view.render();
this.$('.page-content-main').html(view.$el.html());
this.$('.sr-is-focusable').focus();
this.router.navigate(tab.url, {replace: true});
},
switchTab: function (event) {
......
......@@ -72,6 +72,11 @@
expect(view.$('.nav-item[data-index=0]')).toHaveAttr('aria-selected', 'false');
expect(view.$('.nav-item[data-index=1]')).toHaveAttr('aria-selected', 'true');
});
it('updates the page URL on tab switches without adding to browser history', function () {
view.$('.nav-item[data-index=1]').click();
expect(Backbone.history.navigate).toHaveBeenCalledWith('test 2', {replace: true});
});
});
}
);
......
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