don't show missing word question type

The option will still appear for existing quiz questions
that are set to that type, but no other questions will
be able to be created or changed to be "Missing Word"
questions anymore.

fixes #4091

Change-Id: Idc327fcce798f5d7f74583d7703954556edcf87d
Reviewed-on: https://gerrit.instructure.com/3819
Tested-by: Hudson <hudson@instructure.com>
Tested-by: Selenium <selenium@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
This commit is contained in:
Brian Whitmer 2011-05-24 00:09:10 -06:00
parent 38ed1ce6b6
commit de4007dddb
3 changed files with 26 additions and 3 deletions

View File

@ -20,7 +20,7 @@
<option value="matching_question" style="padding: 2px;">Matching</option>
<option value="numerical_question" style="padding: 2px;">Numerical Answer</option>
<option value="calculated_question" style="padding: 2px;">Formula Question</option>
<option value="missing_word_question" style="padding: 2px;">Missing Word</option>
<option value="missing_word_question" style="padding: 2px;" class="missing_word">Missing Word</option>
<option value="essay_question" style="padding: 2px;">Essay Question</option>
<option value="text_only_question" style="padding: 2px;">Text (no question)</option>
</select>

View File

@ -1142,6 +1142,7 @@ var quiz = {};
$formQuestion.addClass('selectable');
$form.find(".answer_selection_type").change().show();
if(question.question_type != 'missing_word_question') { $form.find("option.missing_word").remove(); }
if($question.hasClass('missing_word_question') || question.question_type == 'missing_word_question') {
question = $question.getTemplateData({textValues: ['text_before_answers', 'text_after_answers']});
answer_data = $question.find(".original_question_text").getFormData();
@ -1325,6 +1326,7 @@ var quiz = {};
$form.attr('action', $("#quiz_urls .add_question_url,#bank_urls .add_question_url").attr('href'))
.attr('method', 'POST')
.find(".submit_button").html("Create Question");
$form.find("option.missing_word").remove();
$question.find(".question_type").change();
$("html,body").scrollTo({top: $question.offset().top - 10, left: 0});
$question.find(":input:first").focus().select();
@ -2152,7 +2154,7 @@ var quiz = {};
});
}
});
}).delegate(".cancel_button", 'click', function(event) {
}).delegate(".group_edit.cancel_button", 'click', function(event) {
if($(this).closest('.group_top').length == 0) { return; }
var $top = $(this).parents(".group_top");
$top.removeClass('editing');

View File

@ -3,6 +3,28 @@ require File.expand_path(File.dirname(__FILE__) + '/common')
shared_examples_for "quiz selenium tests" do
it_should_behave_like "in-process server selenium tests"
it "should not show 'Missing Word' option in question types dropdown" do
username = "nobody@example.com"
password = "asdfasdf"
u = user_with_pseudonym :active_user => true,
:username => username,
:password => password
u.save!
e = course_with_teacher :active_course => true,
:user => u,
:active_enrollment => true
e.save!
login_as(username, password)
get "/courses/#{e.course_id}/quizzes/new"
driver.find_elements(:css, "#question_form_template option.missing_word").length.should == 1
driver.find_element(:css, ".add_question .add_question_link").click
keep_trying{ driver.find_elements(:css, "#questions .question_holder").length > 0 }
driver.find_elements(:css, "#questions .question_holder option.missing_word").length.should == 0
end
it "should create a quiz with every question type" do
username = "nobody@example.com"
password = "asdfasdf"
@ -37,7 +59,6 @@ shared_examples_for "quiz selenium tests" do
el.send_keys(value)
end
#### Multiple Choice Question
new_question_link.click