Scope RCE toggle while taking quizzes to current RCE
This makes it so not all RCE instances get toggled when clicking on the HTML mode link. closes CNVS-28676 Test Plan: - Set up a quiz with multiple essay type questions - Preview the quiz - Toggling the HTML/RCE mode on them should only affect the RCE it is next to, not all of them. Change-Id: Ia93d7f4842315112528114f3742cfb2a99903ea2 Reviewed-on: https://gerrit.instructure.com/76899 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com> Product-Review: Clay Diffrient <cdiffrient@instructure.com>
This commit is contained in:
parent
3f8793247c
commit
59e8291196
|
@ -554,7 +554,7 @@ define([
|
|||
if (tagName == "TEXTAREA") {
|
||||
val = RichContentEditor.callOnRCE($this, 'get_code');
|
||||
var $tagInstance = $this;
|
||||
$(".toggle_question_content_views_link").click(function(event) {
|
||||
$this.siblings('.rce_links').find('.toggle_question_content_views_link').click(function(event) {
|
||||
event.preventDefault();
|
||||
RichContentEditor.callOnRCE($tagInstance, 'toggle');
|
||||
// todo: replace .andSelf with .addBack when JQuery is upgraded.
|
||||
|
|
|
@ -163,6 +163,54 @@ module QuizzesCommon
|
|||
@quiz
|
||||
end
|
||||
|
||||
def quiz_with_essay_questions(goto_edit=true)
|
||||
# TODO: DRY this up
|
||||
@context = @course
|
||||
bank = @context.assessment_question_banks.create!(:title => 'Test Bank')
|
||||
@quiz = quiz_model
|
||||
a = bank.assessment_questions.create!
|
||||
b = bank.assessment_questions.create!
|
||||
c = bank.assessment_questions.create!
|
||||
answers = [ {'id' => 1}, {'id' => 2}, {'id' => 3} ]
|
||||
|
||||
@quest1 = @quiz.quiz_questions.create!(
|
||||
question_data: {
|
||||
name: 'first question',
|
||||
question_type: 'essay_question',
|
||||
answers: [],
|
||||
points_possible: 1
|
||||
},
|
||||
assessment_question: a
|
||||
)
|
||||
|
||||
@quest2 = @quiz.quiz_questions.create!(
|
||||
question_data: {
|
||||
name: 'second question',
|
||||
question_type: 'essay_question',
|
||||
answers: [],
|
||||
points_possible: 1
|
||||
},
|
||||
assessment_question: b
|
||||
)
|
||||
|
||||
@quest3 = @quiz.quiz_questions.create!(
|
||||
question_data: {
|
||||
name: 'third question',
|
||||
question_type: 'essay_question',
|
||||
answers: [],
|
||||
points_possible: 1
|
||||
},
|
||||
assessment_question: c
|
||||
)
|
||||
|
||||
yield bank, @quiz if block_given?
|
||||
|
||||
@quiz.generate_quiz_data
|
||||
@quiz.save!
|
||||
open_quiz_edit_form if goto_edit
|
||||
@quiz
|
||||
end
|
||||
|
||||
def quiz_with_new_questions(goto_edit=true)
|
||||
@context = @course
|
||||
bank = @context.assessment_question_banks.create!(title: 'Test Bank')
|
||||
|
|
|
@ -22,6 +22,27 @@ describe "quiz taking" do
|
|||
expect(links[1]).to be_displayed
|
||||
end
|
||||
|
||||
it 'should toggle only the essay question that was toggled leaving others on the page alone' do
|
||||
@quiz = quiz_with_essay_questions
|
||||
get "/courses/#{@course.id}/quizzes/#{@quiz.id}"
|
||||
expect_new_page_load{f('#take_quiz_link').click}
|
||||
links = ff('.toggle_question_content_views_link')
|
||||
# first link of the first RCE
|
||||
expect(links[0].text).to eq("HTML Editor")
|
||||
expect(links[0]).to be_displayed
|
||||
# first link of the second RCE
|
||||
expect(links[2].text).to eq("HTML Editor")
|
||||
expect(links[2]).to be_displayed
|
||||
links[0].click
|
||||
# first link hidden, second link now showing
|
||||
expect(links[1].text).to eq("Rich Content Editor")
|
||||
expect(links[0]).not_to be_displayed
|
||||
expect(links[1]).to be_displayed
|
||||
# first link of second RCE is unchanged
|
||||
expect(links[2].text).to eq("HTML Editor")
|
||||
expect(links[2]).to be_displayed
|
||||
end
|
||||
|
||||
it "should allow to take the quiz as long as there are attempts left", priority: "1", test_id: 140606 do
|
||||
@quiz.allowed_attempts = 2
|
||||
@quiz.save!
|
||||
|
|
Loading…
Reference in New Issue