Merge pull request #8668 from edx/peter-fogg/update-team-tab-urls
Update URL when switching between Team tabs.
This commit is contained in:
@@ -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});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user