don't show the submission score in the coming up tooltip when muted
test plan: * Create a quiz due tomorrow. In the gradebook set it to muted. * As a student, take the quiz. * As the teacher, grade the quiz. * As the student, go to your dashboard and find the quiz in "Coming Up" on the right. Hover over the quiz name and verify that the tooltip does not contain your score. * As teacher, unmute the assignment in the gradebook. * As the student, verify that the toolip will now contain your score. Change-Id: Ia8f68299c776388a0e483d61e282b6dfa5788616 Reviewed-on: https://gerrit.instructure.com/7423 Reviewed-by: Brian Palmer <brianp@instructure.com> Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
parent
03bf11f15d
commit
398ade7518
|
@ -19,7 +19,7 @@
|
|||
<% end %>
|
||||
<% if recent_event.points_possible %>
|
||||
<span style="display: block;"><%= t 'submission_score', %{%{score} *out of %{points_possible}*},
|
||||
:score => "<strong>#{submission.score if submission}</strong>".html_safe,
|
||||
:score => "<strong>#{submission.score if submission && !recent_event.muted?}</strong>".html_safe,
|
||||
:points_possible => recent_event.points_possible,
|
||||
:wrapper => '<span style="font-size: 0.8em;">\1</span>' %></span>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#
|
||||
# Copyright (C) 2011 Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../views_helper')
|
||||
|
||||
describe "/courses/_recent_event" do
|
||||
it "should render" do
|
||||
course_with_student
|
||||
assignment = @course.assignments.create!(:title => 'my assignment')
|
||||
view_context
|
||||
render :partial => "courses/recent_event", :object => assignment, :locals => { :is_hidden => false }
|
||||
response.should_not be_nil
|
||||
response.body.should =~ %r{<b>my assignment</b>}
|
||||
end
|
||||
|
||||
context "assignment muting and tooltips" do
|
||||
before(:each) do
|
||||
course_with_student
|
||||
view_context
|
||||
@quiz = @course.quizzes.create!
|
||||
@quiz.generate_quiz_data
|
||||
@quiz.workflow_state = 'available'
|
||||
@quiz.published_at = Time.now
|
||||
@quiz.save
|
||||
@quiz.assignment.should_not be_nil
|
||||
|
||||
@quiz_submission = @quiz.generate_submission(@user)
|
||||
@quiz_submission.grade_submission
|
||||
|
||||
@submission = @quiz_submission.submission
|
||||
@submission.score = 1234567890987654400 # long magic number that should be distinct in the partial for the test
|
||||
@submission.save
|
||||
end
|
||||
|
||||
it "should show the score for a non-muted assignment" do
|
||||
render :partial => "courses/recent_event", :object => @quiz.assignment, :locals => { :is_hidden => false, :submissions => [ @submission ] }
|
||||
response.body.should =~ /#{@submission.score}/
|
||||
end
|
||||
|
||||
it "should not show the score for a muted assignment" do
|
||||
@quiz.assignment.mute!
|
||||
render :partial => "courses/recent_event", :object => @quiz.assignment, :locals => { :is_hidden => false, :submissions => [ @submission ] }
|
||||
response.body.should_not =~ /#{@submission.score}/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Sidebar content
|
Loading…
Reference in New Issue