Commit c20075e8 by Chris Rodriguez

Changing all #accordion for .accordion

parent 6e6c7568
...@@ -82,7 +82,7 @@ class CourseNavPage(PageObject): ...@@ -82,7 +82,7 @@ class CourseNavPage(PageObject):
# Click the section to ensure it's open (no harm in clicking twice if it's already open) # Click the section to ensure it's open (no harm in clicking twice if it's already open)
# Add one to convert from list index to CSS index # Add one to convert from list index to CSS index
section_css = 'nav .chapter:nth-of-type({0})'.format(sec_index + 1) section_css = '.course-navigation .chapter:nth-of-type({0})'.format(sec_index + 1)
self.q(css=section_css).first.click() self.q(css=section_css).first.click()
# Get the subsection by index # Get the subsection by index
...@@ -94,7 +94,7 @@ class CourseNavPage(PageObject): ...@@ -94,7 +94,7 @@ class CourseNavPage(PageObject):
return return
# Convert list indices (start at zero) to CSS indices (start at 1) # Convert list indices (start at zero) to CSS indices (start at 1)
subsection_css = "nav .chapter-content-container:nth-of-type({0}) .chapter-menu .menu-item:nth-of-type({1})".format( subsection_css = ".course-navigation .chapter-content-container:nth-of-type({0}) .chapter-menu .menu-item:nth-of-type({1})".format(
sec_index + 1, subsec_index + 1 sec_index + 1, subsec_index + 1
) )
...@@ -130,7 +130,7 @@ class CourseNavPage(PageObject): ...@@ -130,7 +130,7 @@ class CourseNavPage(PageObject):
""" """
Return a list of all section titles on the page. Return a list of all section titles on the page.
""" """
chapter_css = 'nav .chapter .group-heading' chapter_css = '.course-navigation .chapter .group-heading'
return self.q(css=chapter_css).map(lambda el: el.text.strip()).results return self.q(css=chapter_css).map(lambda el: el.text.strip()).results
def _subsection_titles(self, section_index): def _subsection_titles(self, section_index):
...@@ -140,7 +140,7 @@ class CourseNavPage(PageObject): ...@@ -140,7 +140,7 @@ class CourseNavPage(PageObject):
""" """
# Retrieve the subsection title for the section # Retrieve the subsection title for the section
# Add one to the list index to get the CSS index, which starts at one # Add one to the list index to get the CSS index, which starts at one
subsection_css = 'nav .chapter-content-container:nth-of-type({0}) .chapter-menu .menu-item a p:nth-of-type(1)'.format( subsection_css = '.course-navigation .chapter-content-container:nth-of-type({0}) .chapter-menu .menu-item a p:nth-of-type(1)'.format(
section_index section_index
) )
...@@ -173,8 +173,8 @@ class CourseNavPage(PageObject): ...@@ -173,8 +173,8 @@ class CourseNavPage(PageObject):
That's true right after we click the section/subsection, but not true in general That's true right after we click the section/subsection, but not true in general
(the user could go to a section, then expand another tab). (the user could go to a section, then expand another tab).
""" """
current_section_list = self.q(css='nav .chapter.is-open .group-heading').text current_section_list = self.q(css='.course-navigation .chapter.is-open .group-heading').text
current_subsection_list = self.q(css='nav .chapter-content-container .menu-item.active a p').text current_subsection_list = self.q(css='.course-navigation .chapter-content-container .menu-item.active a p').text
if len(current_section_list) == 0: if len(current_section_list) == 0:
self.warning("Could not find the current section") self.warning("Could not find the current section")
......
...@@ -1121,7 +1121,7 @@ class EntranceExamTest(UniqueCourseTest): ...@@ -1121,7 +1121,7 @@ class EntranceExamTest(UniqueCourseTest):
When I view the courseware that has an entrance exam When I view the courseware that has an entrance exam
Then there should be an "Entrance Exam" chapter.' Then there should be an "Entrance Exam" chapter.'
""" """
entrance_exam_link_selector = '#accordion nav .chapter .group-heading' entrance_exam_link_selector = '.accordion .course-navigation .chapter .group-heading'
# visit courseware page and make sure there is not entrance exam chapter. # visit courseware page and make sure there is not entrance exam chapter.
self.courseware_page.visit() self.courseware_page.visit()
self.courseware_page.wait_for_page() self.courseware_page.wait_for_page()
......
<div class="course-wrapper"> <div class="course-wrapper">
<div id="accordion"> <div class="accordion">
<button class="button-chapter chapter" aria-controls="accordion-menu-1" aria-pressed="true"> <button class="button-chapter chapter" aria-controls="accordion-menu-1" aria-pressed="true">
<h3 class="group-heading"> <h3 class="group-heading">
Introduction Chapter Introduction Chapter
......
...@@ -7,7 +7,7 @@ define(['jquery', 'js/utils/navigation'], function($) { ...@@ -7,7 +7,7 @@ define(['jquery', 'js/utils/navigation'], function($) {
beforeEach(function() { beforeEach(function() {
loadFixtures('js/fixtures/accordion.html'); loadFixtures('js/fixtures/accordion.html');
accordion = $('#accordion'); accordion = $('.accordion');
button = accordion.children('.button-chapter'); button = accordion.children('.button-chapter');
heading = button.children('.group-heading'); heading = button.children('.group-heading');
chapterContent = accordion.children('.chapter-content-container'); chapterContent = accordion.children('.chapter-content-container');
......
...@@ -6,7 +6,7 @@ var edx = edx || {}, ...@@ -6,7 +6,7 @@ var edx = edx || {},
init: function() { init: function() {
if ($('#accordion').length) { if ($('.accordion').length) {
navigation.openAccordion(); navigation.openAccordion();
} }
...@@ -18,15 +18,15 @@ var edx = edx || {}, ...@@ -18,15 +18,15 @@ var edx = edx || {},
}, },
checkForCurrent: function() { checkForCurrent: function() {
var active = $('#accordion .chapter-content-container .chapter-menu:has(.active)').index('#accordion .chapter-content-container .chapter-menu') ? $('#accordion .chapter-content-container .chapter-menu:has(.active)').index('#accordion .chapter-content-container .chapter-menu') : 0, var active = $('.accordion .chapter-content-container .chapter-menu:has(.active)').index('.accordion .chapter-content-container .chapter-menu') ? $('.accordion .chapter-content-container .chapter-menu:has(.active)').index('.accordion .chapter-content-container .chapter-menu') : 0,
activeSection = $('#accordion .button-chapter:eq(' + active + ')'); activeSection = $('.accordion .button-chapter:eq(' + active + ')');
navigation.closeAccordions(); navigation.closeAccordions();
navigation.openAccordionSection(activeSection); navigation.openAccordionSection(activeSection);
}, },
listenForClick: function() { listenForClick: function() {
$('#accordion').on('click', '.button-chapter', function(event) { $('.accordion').on('click', '.button-chapter', function(event) {
navigation.closeAccordions(); navigation.closeAccordions();
navigation.openAccordionSection(event.currentTarget); navigation.openAccordionSection(event.currentTarget);
}); });
...@@ -36,7 +36,7 @@ var edx = edx || {}, ...@@ -36,7 +36,7 @@ var edx = edx || {},
$('.chapter-content-container').hide(); $('.chapter-content-container').hide();
$('.chapter-content-container .chapter-menu').hide(); $('.chapter-content-container .chapter-menu').hide();
$('#accordion .button-chapter').each(function(event) { $('.accordion .button-chapter').each(function(event) {
var el = $(this); var el = $(this);
el.removeClass('is-open').attr('aria-pressed', 'false'); el.removeClass('is-open').attr('aria-pressed', 'false');
......
...@@ -516,7 +516,7 @@ div.course-wrapper { ...@@ -516,7 +516,7 @@ div.course-wrapper {
} }
} }
div#accordion { .accordion {
visibility: hidden; visibility: hidden;
width: 10px; width: 10px;
padding: 0; padding: 0;
...@@ -524,11 +524,6 @@ div.course-wrapper { ...@@ -524,11 +524,6 @@ div.course-wrapper {
nav { nav {
white-space: pre; white-space: pre;
overflow: hidden; overflow: hidden;
ul {
overflow: hidden;
white-space: nowrap;
}
} }
} }
} }
......
.course-index { .course-index {
@extend .sidebar; @include transition( all .2s $ease-in-out-quad 0s);
@extend .tran;
@include border-right(1px solid $border-color-2); @include border-right(1px solid $border-color-2);
@include border-radius(3px, 0, 0, 3px); @include border-radius(3px, 0, 0, 3px);
display: table-cell; // needed to extend the sidebar the full height of the area
// reseting bolded fonts for the course index // reseting bolded fonts for the course index
h3 { h3 {
font-weight: normal; font-weight: normal;
} }
#accordion { .accordion {
@extend %t-copy-sub1; @extend %t-copy-sub1;
width: auto;
nav { .course-navigation {
.button-chapter { .button-chapter {
@include box-sizing(border-box); @include box-sizing(border-box);
......
...@@ -183,8 +183,8 @@ ${fragment.foot_html()} ...@@ -183,8 +183,8 @@ ${fragment.foot_html()}
</div> </div>
% endif % endif
<div id="accordion"> <div class="accordion">
<nav aria-label="${_('Course Navigation')}"> <nav class="course-navigation" aria-label="${_('Course Navigation')}">
% if accordion.strip(): % if accordion.strip():
${accordion} ${accordion}
% else: % else:
......
...@@ -204,11 +204,11 @@ import pytz ...@@ -204,11 +204,11 @@ import pytz
activeHeader: "ui-icon-carat-1-s" activeHeader: "ui-icon-carat-1-s"
}; };
var act = 0; var act = 0;
$("#accordion").accordion( $(".accordion").accordion(
{ {
heightStyle: 'content', heightStyle: 'content',
activate: function(event, ui) { activate: function(event, ui) {
var active = jQuery("#accordion").accordion('option', 'active'); var active = jQuery(".accordion").accordion('option', 'active');
$.cookie('saved_index', null); $.cookie('saved_index', null);
$.cookie('saved_index', active); $.cookie('saved_index', active);
$('#error-msg').val(''); $('#error-msg').val('');
......
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