make section-to-show menu in gradebook2 update
the functionality where, if you chose a different section to show, it would show only users from that section in the gradebook2 broke. this fixes it. refs: #6844, fixes: #6849 test plan: * go to /courses/x/gradebook2 for something with 2 sections * choose a different section to show in the top left * verify that it filtered the students it is showing to just those in that section Change-Id: I8051c6778e6959c9f2767edaa9e89ae453727bdb Reviewed-on: https://gerrit.instructure.com/7990 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com>
This commit is contained in:
parent
26df737606
commit
208a24afbd
|
@ -364,7 +364,6 @@ define 'compiled/Gradebook', [
|
|||
|
||||
initHeader: =>
|
||||
if @sections_enabled
|
||||
$section_being_shown = $('#section_being_shown')
|
||||
allSectionsText = I18n.t('all_sections', 'All Sections')
|
||||
sections = [{ name: allSectionsText, checked: !@sectionToShow}]
|
||||
for id, s of @sections
|
||||
|
@ -375,7 +374,7 @@ define 'compiled/Gradebook', [
|
|||
|
||||
$sectionToShowMenu = $(sectionToShowMenuTemplate(sections: sections, scrolling: sections.length > 15))
|
||||
(updateSectionBeingShownText = =>
|
||||
$section_being_shown.text(if @sectionToShow then @sections[@sectionToShow].name else allSectionsText)
|
||||
$('#section_being_shown').text(if @sectionToShow then @sections[@sectionToShow].name else allSectionsText)
|
||||
)()
|
||||
$('#section_to_show').after($sectionToShowMenu).show().kyleMenu
|
||||
buttonOpts: {icons: {primary: "ui-icon-sections", secondary: "ui-icon-droparrow"}}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<ul id="section-to-show-menu" {{#if scrolling}} class="scrolling" {{/if}} >
|
||||
<li>{{#t "choose_a_section_to_show"}}Choose a section to show{{/t}}</li>
|
||||
{{#each sections}}
|
||||
<li>
|
||||
<a href="#">
|
||||
<label for="section_option_{{id}}">{{name}}</label>
|
||||
<input id="section_option_{{id}}" type="radio" name="section_to_show_radio" {{#if checked}} checked {{/if}} />
|
||||
</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
{{#each sections}}
|
||||
<li>
|
||||
<a href="#">
|
||||
<label for="section_option_{{id}}">{{name}}</label>
|
||||
<input id="section_option_{{id}}" type="radio" value="{{id}}" name="section_to_show_radio" {{#if checked}} checked {{/if}} />
|
||||
</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
|
@ -75,11 +75,12 @@ describe "gradebook2 selenium tests" do
|
|||
e1.save!
|
||||
@course.reload
|
||||
#add second student
|
||||
@other_section = @course.course_sections.create(:name => "the other section")
|
||||
@student_2 = User.create!(:name => STUDENT_NAME_2)
|
||||
@student_2.register!
|
||||
@student_2.pseudonyms.create!(:unique_id => STUDENT_NAME_2, :password => DEFAULT_PASSWORD, :password_confirmation => DEFAULT_PASSWORD)
|
||||
e2 = @course.enroll_student(@student_2, :section => @other_section)
|
||||
|
||||
e2 = @course.enroll_student(@student_2)
|
||||
e2.workflow_state = 'active'
|
||||
e2.save!
|
||||
@course.reload
|
||||
|
@ -160,6 +161,29 @@ describe "gradebook2 selenium tests" do
|
|||
driver.find_elements(:css, '.student-name').count.should == @course.students.count
|
||||
end
|
||||
|
||||
it "should allow showing only a certain section" do
|
||||
button = driver.find_element(:id, 'section_to_show')
|
||||
button.should include_text "All Sections"
|
||||
button.click
|
||||
sleep 1 #TODO find a better way to wait for css3 anmation to end
|
||||
driver.find_element(:id, 'section-to-show-menu').should be_displayed
|
||||
driver.find_element(:css, "label[for='section_option_#{@other_section.id}']").click
|
||||
button.should include_text @other_section.name
|
||||
|
||||
# verify that it remembers the section to show across page loads
|
||||
get "/courses/#{@course.id}/gradebook2"
|
||||
wait_for_ajaximations
|
||||
button = driver.find_element(:id, 'section_to_show')
|
||||
button.should include_text @other_section.name
|
||||
|
||||
# now verify that you can set it back
|
||||
button.click
|
||||
sleep 1 #TODO find a better way to wait for css3 anmation to end
|
||||
driver.find_element(:id, 'section-to-show-menu').should be_displayed
|
||||
driver.find_element(:css, "label[for='section_option_']").click
|
||||
button.should include_text "All Sections"
|
||||
end
|
||||
|
||||
it "should validate initial grade totals are correct" do
|
||||
grade_grid = driver.find_element(:css, '#gradebook_grid')
|
||||
first_row_cells = find_slick_cells(0, grade_grid)
|
||||
|
@ -221,7 +245,7 @@ describe "gradebook2 selenium tests" do
|
|||
grade_cells = find_slick_cells(0, driver.find_element(:css, '#gradebook_grid'))
|
||||
|
||||
#filter validation
|
||||
validate_cell_text(meta_cells[0], STUDENT_NAME_2)
|
||||
validate_cell_text(meta_cells[0], STUDENT_NAME_2 + "\n" + @other_section.name)
|
||||
validate_cell_text(grade_cells[0], ASSIGNMENT_2_POINTS)
|
||||
validate_cell_text(grade_cells[4], EXPECTED_ASSIGN_2_TOTAL)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue