Commit afe22ca4 by Piotr Mitros

Review from Cale

parent e644f641
...@@ -69,6 +69,20 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -69,6 +69,20 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.staff_user = GlobalStaffFactory() self.staff_user = GlobalStaffFactory()
def assertTabActive(self, tabname, response):
''' Check if the progress tab is active in the tab set '''
for line in response.content.split('\n'):
if tabname in line and 'active' in line:
return
raise AssertionError("assertTabActive failed: "+tabname+" not active")
def assertTabInactive(self, tabname, response):
''' Check if the progress tab is active in the tab set '''
for line in response.content.split('\n'):
if tabname in line and 'active' in line:
raise AssertionError("assertTabInactive failed: "+tabname+" active")
return
def test_chrome_settings(self): def test_chrome_settings(self):
''' '''
Test settings for disabling and modifying navigation chrome in the courseware: Test settings for disabling and modifying navigation chrome in the courseware:
...@@ -84,34 +98,28 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -84,34 +98,28 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
('none', False, False), ('none', False, False),
('fullchrome', True, True), ('fullchrome', True, True),
('accordion', True, False), ('accordion', True, False),
('fullchrome', True, True)) ('fullchrome', True, True)
)
for (displayname, accordion, tabs) in test_data: for (displayname, accordion, tabs) in test_data:
response = self.client.get(reverse('courseware_section', kwargs={ response = self.client.get(reverse('courseware_section', kwargs={
'course_id': self.course.id.to_deprecated_string(), 'course_id': self.course.id.to_deprecated_string(),
'chapter': 'Chrome', 'chapter': 'Chrome',
'section': displayname, 'section': displayname,
})) }))
self.assertEquals('open_close_accordion' in response.content, accordion) self.assertEquals('open_close_accordion' in response.content, accordion)
self.assertEquals('course-tabs' in response.content, tabs) self.assertEquals('course-tabs' in response.content, tabs)
def tab_active(tabname, response): self.assertTabInactive('progress', response)
''' Check if the progress tab is active in the tab set ''' self.assertTabActive('courseware', response)
for line in response.content.split('\n'):
if tabname in line and 'active' in line:
return True
return False
self.assertFalse(tab_active('progress', response))
self.assertTrue(tab_active('courseware', response))
response = self.client.get(reverse('courseware_section', kwargs={ response = self.client.get(reverse('courseware_section', kwargs={
'course_id': self.course.id.to_deprecated_string(), 'course_id': self.course.id.to_deprecated_string(),
'chapter': 'Chrome', 'chapter': 'Chrome',
'section': 'progress_tab', 'section': 'progress_tab',
})) }))
self.assertTrue(tab_active('progress', response)) self.assertTabActive('progress', response)
self.assertFalse(tab_active('courseware', response)) self.assertTabInactive('courseware', response)
@override_settings(SESSION_INACTIVITY_TIMEOUT_IN_SECONDS=1) @override_settings(SESSION_INACTIVITY_TIMEOUT_IN_SECONDS=1)
def test_inactive_session_timeout(self): def test_inactive_session_timeout(self):
......
...@@ -19,19 +19,19 @@ class LmsBlockMixin(XBlockMixin): ...@@ -19,19 +19,19 @@ class LmsBlockMixin(XBlockMixin):
scope=Scope.settings, scope=Scope.settings,
) )
chrome = String( chrome = String(
help="Which chrome to show. Options: " help="Which chrome to show. Options: \n"
"chromeless -- No chrome" "chromeless -- No chrome\n"
"tabs -- just tabs" "tabs -- just tabs\n"
"accordion -- just accordion" "accordion -- just accordion\n"
"tabs,accordion -- Full Chrome", "tabs,accordion -- Full Chrome",
scope=Scope.settings, scope=Scope.settings,
default = None, default=None,
) )
default_tab = String( default_tab = String(
help="Override which tab is selected." help="Override which tab is selected. "
"If not set, courseware tab is shown.", "If not set, courseware tab is shown.",
scope=Scope.settings, scope=Scope.settings,
default = None, default=None,
) )
source_file = String(help="source file name (eg for latex)", scope=Scope.settings) source_file = String(help="source file name (eg for latex)", scope=Scope.settings)
ispublic = Boolean(help="Whether this course is open to the public, or only to admins", scope=Scope.settings) ispublic = Boolean(help="Whether this course is open to the public, or only to admins", scope=Scope.settings)
...@@ -189,7 +189,7 @@ ${fragment.foot_html()} ...@@ -189,7 +189,7 @@ ${fragment.foot_html()}
<div class="container"> <div class="container">
<div class="course-wrapper"> <div class="course-wrapper">
% if not disable_accordion: % if disable_accordion is UNDEFINED:
<div class="course-index" role="navigation"> <div class="course-index" role="navigation">
<header id="open_close_accordion"> <header id="open_close_accordion">
<a href="#">${_("close")}</a> <a href="#">${_("close")}</a>
......
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