diff --git a/common/test/acceptance/tests/lms/test_teams.py b/common/test/acceptance/tests/lms/test_teams.py index a0430b157e..881b0d4161 100644 --- a/common/test/acceptance/tests/lms/test_teams.py +++ b/common/test/acceptance/tests/lms/test_teams.py @@ -30,7 +30,7 @@ class TeamsTabBase(UniqueCourseTest): def create_topics(self, num_topics): """Create `num_topics` test topics.""" - return [{u"description": str(i), u"name": str(i), u"id": i} for i in xrange(num_topics)] + return [{u"description": i, u"name": i, u"id": i} for i in map(str, xrange(num_topics))] def create_teams(self, topic, num_teams): """Create `num_teams` teams belonging to `topic`.""" @@ -89,6 +89,7 @@ class TeamsTabBase(UniqueCourseTest): self.assertNotIn("Teams", self.tab_nav.tab_names) +@ddt.ddt @attr('shard_5') class TeamsTabTest(TeamsTabBase): """ @@ -156,6 +157,39 @@ class TeamsTabTest(TeamsTabBase): ) self.verify_teams_present(True) + @ddt.data( + ('browse', 'div.topics-list'), + ('teams', 'p.temp-tab-view'), + ('teams/{topic_id}/{team_id}', 'div.discussion-module'), + ('topics/{topic_id}/create-team', 'div.create-team-instructions'), + ('topics/{topic_id}', 'div.teams-list'), + ('not-a-real-route', 'div.warning') + ) + @ddt.unpack + def test_url_routing(self, route, selector): + """Ensure that navigating to a URL route correctly updates the page + content. + """ + topics = self.create_topics(1) + topic = topics[0] + self.set_team_configuration({ + u'max_team_size': 10, + u'topics': topics + }) + team = self.create_teams(topic, 1)[0] + self.teams_page.visit() + self.browser.get( + '{url}#{route}'.format( + url=self.browser.current_url, + route=route.format( + topic_id=topic['id'], + team_id=team['id'] + )) + ) + self.teams_page.wait_for_ajax() + self.assertTrue(self.teams_page.q(css=selector).present) + self.assertTrue(self.teams_page.q(css=selector).visible) + @attr('shard_5') class BrowseTopicsTest(TeamsTabBase): diff --git a/lms/djangoapps/teams/static/teams/js/views/teams_tab.js b/lms/djangoapps/teams/static/teams/js/views/teams_tab.js index 131e8ad50e..23942297a2 100644 --- a/lms/djangoapps/teams/static/teams/js/views/teams_tab.js +++ b/lms/djangoapps/teams/static/teams/js/views/teams_tab.js @@ -66,7 +66,7 @@ this.text = options.text; }, render: function () { - this.$el.text(this.text); + this.$el.html(this.text); } }); this.topicsCollection = new TopicCollection( @@ -88,7 +88,7 @@ tabs: [{ title: gettext('My Teams'), url: 'teams', - view: new TempTabView({text: 'This is the new Teams tab.'}) + view: new TempTabView({text: '

This is the new Teams tab.

'}) }, { title: gettext('Browse'), url: 'browse',