fix full long description showing while assessing

fixes OUT-1874

test plan:
- as a teacher, create an assignment and outcome. ensure
  to include a description for the outcome
- create a rubric for the assignment, adding a regular
  criterion and the outcome criterion
- add a long description for the regular criterion
- when viewing the rubric on the assignment show page,
  the regular criterion should show the full text of
  the long description, the outcome should show a link
  to view longer description
- as a student, submit to the assignment
- as the teacher, go into speedgrader
- click on 'View Rubric'
- both the regular criterion and the outcome should show
  the 'view longer description' link, rather than the full
  long description text

Change-Id: Ia8580db202934f65706a90a4ab1ed8cf9c4546e2
Reviewed-on: https://gerrit.instructure.com/138680
Tested-by: Jenkins
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Leo Abner <rabner@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
This commit is contained in:
Matthew Berns 2018-01-22 15:35:14 -06:00 committed by Matt Berns
parent f80516b4b9
commit a8a6b33bc1
3 changed files with 40 additions and 30 deletions

View File

@ -47,10 +47,10 @@
<span class="description criterion_description_value"><%= description %></span>
<span class="learning_outcome_id" style="display: none;"><%= criterion.try(:learning_outcome_id) %></span>
<span class="criterion_id" style="display: none;"><%= criterion.try(:id) %></span>
<% if !learning_outcome_criterion %>
<% if !learning_outcome_criterion && !assessing %>
<div class="long_description small_description"><%= h((criterion.try(:long_description) || '')) %></div>
<% end %>
<div style="<%= "display: none;" if !learning_outcome_criterion %>" class="long_description_holder editing <%= 'empty' if !criterion || criterion.long_description.blank? %>">
<div style="<%= "display: none;" if !learning_outcome_criterion && !assessing %>" class="long_description_holder editing <%= 'empty' if !criterion || criterion.long_description.blank? %>">
<a href="#" class="long_description_link <%= "hidden" if !criterion || criterion.long_description.blank? %>"><%= t "view longer description" %></a>
<textarea class="long_description" aria-label="<%= t "Long Description" %>" style="display: none;"><%= h((criterion.try(:long_description) || '')) %></textarea>
</div>

View File

@ -284,8 +284,8 @@ describe "assignment rubrics" do
f(".toggle_full_rubric").click
wait_for_ajaximations
expect(f('#criterion_1 .long_description')).
to include_text "<b>This text should not be bold</b>"
f(".criterion_description .long_description_link").click
expect(f(".ui-dialog div.long_description").text).to eq "<b>This text should not be bold</b>"
end
it "should follow learning outcome ignore_for_scoring", priority: "2", test_id: 220328 do

View File

@ -38,6 +38,7 @@ describe 'Speedgrader' do
[
{
description: 'Awesomeness',
long_description: 'For real the most awesome thing',
points: 10,
id: 'crit1',
ratings: [
@ -173,7 +174,7 @@ describe 'Speedgrader' do
end
end
context 'Using a rubric saves grades' do
context 'Using a rubric' do
before :once do
init_course_with_students
@teacher = @user
@ -192,42 +193,51 @@ describe 'Speedgrader' do
rubric.reload
end
before :each do
it "properly shows the view longer description link" do
user_session(@teacher)
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}#"
f('button.toggle_full_rubric').click
[f('#rating_rat1'), f('#rating_rat5')].each(&:click)
f('button.save_rubric_button').click
wait_for_ajax_requests
expect(fj('#criterion_crit1 .long_description_link:visible')).to be_present
end
it 'in speedgrader', priority: "1", test_id: 164016 do
expect(Speedgrader.grade_input).to have_value '15'
expect(f('#grading span.rubric_total')).to include_text '15'
end
describe 'saves grades in' do
before :each do
user_session(@teacher)
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}#"
f('button.toggle_full_rubric').click
[f('#rating_rat1'), f('#rating_rat5')].each(&:click)
f('button.save_rubric_button').click
wait_for_ajax_requests
end
it 'in assignment page ', priority: "1", test_id: 217611 do
get "/courses/#{@course.id}/grades/#{@students[0].id}"
f("#submission_#{@assignment.id} i.icon-rubric").click
it 'speedgrader', priority: "1", test_id: 164016 do
expect(Speedgrader.grade_input).to have_value '15'
expect(f('#grading span.rubric_total')).to include_text '15'
end
expect(f('#criterion_crit1 span.criterion_rating_points')).to include_text '10'
expect(f('#criterion_crit2 span.criterion_rating_points')).to include_text '5'
end
it 'assignment page ', priority: "1", test_id: 217611 do
get "/courses/#{@course.id}/grades/#{@students[0].id}"
f("#submission_#{@assignment.id} i.icon-rubric").click
it 'in submissions page', priority: "1", test_id: 217612 do
get "/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@students[0].id}"
f('a.assess_submission_link').click
wait_for_animations
expect(f('#criterion_crit1 span.criterion_rating_points')).to include_text '10'
expect(f('#criterion_crit2 span.criterion_rating_points')).to include_text '5'
end
expect(f('#criterion_crit1 input.criterion_points')).to have_value '10'
expect(f('#criterion_crit2 input.criterion_points')).to have_value '5'
it 'submissions page', priority: "1", test_id: 217612 do
get "/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@students[0].id}"
f('a.assess_submission_link').click
wait_for_animations
replace_content f('#criterion_crit1 input.criterion_points'), '5'
scroll_into_view('button.save_rubric_button')
f('button.save_rubric_button').click
expect(f('#criterion_crit1 input.criterion_points')).to have_value '10'
expect(f('#criterion_crit2 input.criterion_points')).to have_value '5'
el = f("#student_grading_#{@assignment.id}")
expect(el).to have_value '10'
replace_content f('#criterion_crit1 input.criterion_points'), '5'
scroll_into_view('button.save_rubric_button')
f('button.save_rubric_button').click
el = f("#student_grading_#{@assignment.id}")
expect(el).to have_value '10'
end
end
end