mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-53304 question behaviour: don't show useless Check buttons
Previously, the Check button was often shown disabled when it could not be used (e.g. when the question was finished, or when an interactive question was in the try-again state). Eventually we realised it was better usability to hide it in these cases. Note that when a teacher reviews an in-progress quiz attempt, they will see a disabled Check button if the student doing the quiz can see the button.
This commit is contained in:
parent
7adc7ef14f
commit
81e47a35e8
@ -232,7 +232,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_current_mark(2);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation());
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_current_mark(0.8);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(0.8),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation());
|
||||
}
|
||||
@ -393,7 +393,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_current_mark(4.00);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(4.00),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_incorrect_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation());
|
||||
}
|
||||
@ -475,7 +475,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_current_mark(0.66666667);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(0.67),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_incorrect_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation());
|
||||
}
|
||||
@ -532,7 +532,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_current_mark(1.0);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(1.0),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation());
|
||||
}
|
||||
@ -646,7 +646,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_current_mark(1);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(1),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_incorrect_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation());
|
||||
}
|
||||
@ -749,7 +749,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_current_mark(0.9);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(0.9),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_incorrect_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_does_not_contain_disregarded_info_expectation());
|
||||
@ -848,7 +848,7 @@ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->check_output_contains_text_input_with_class('sub1_answer', 'correct');
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(8.00),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation());
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou
|
||||
$this->check_current_mark(2);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation());
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrou
|
||||
$this->check_current_mark(1.0);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(1.0),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_incorrect_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation());
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class qbehaviour_interactive_renderer extends qbehaviour_renderer {
|
||||
public function controls(question_attempt $qa, question_display_options $options) {
|
||||
if ($options->readonly === qbehaviour_interactive::READONLY_EXCEPT_TRY_AGAIN) {
|
||||
return '';
|
||||
}
|
||||
return $this->submit_button($qa, $options);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_mc_radio_expectation($wrongindex, false, true),
|
||||
$this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false),
|
||||
$this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
@ -135,7 +135,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_mc_radio_expectation($rightindex, false, true),
|
||||
$this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false),
|
||||
$this->get_contains_mc_radio_expectation(($rightindex + 1) % 3, false, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -219,7 +219,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_mc_radio_expectation($wrongindex, false, true),
|
||||
$this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false),
|
||||
$this->get_contains_mc_radio_expectation(($wrongindex + 1) % 3, false, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/Tries remaining: 1/'),
|
||||
@ -283,7 +283,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->check_current_mark(null);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_marked_out_of_summary(),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
@ -327,7 +327,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->check_current_mark(0.6666667);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(0.6666667),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
@ -380,7 +380,7 @@ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->get_contains_mc_checkbox_expectation($right[1], false, false),
|
||||
$this->get_contains_mc_checkbox_expectation($wrong[0], false, true),
|
||||
$this->get_contains_mc_checkbox_expectation($wrong[1], false, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
|
@ -87,7 +87,7 @@ class qbehaviour_interactivecountback_walkthrough_test extends qbehaviour_walkth
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[1], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[1], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
@ -139,7 +139,7 @@ class qbehaviour_interactivecountback_walkthrough_test extends qbehaviour_walkth
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[2], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_does_not_contain_try_again_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_contains_standard_correct_combined_feedback_expectation(),
|
||||
|
@ -208,6 +208,9 @@ abstract class qbehaviour_renderer extends plugin_renderer_base {
|
||||
* @return string HTML fragment.
|
||||
*/
|
||||
protected function submit_button(question_attempt $qa, question_display_options $options) {
|
||||
if (!$qa->get_state()->is_active()) {
|
||||
return '';
|
||||
}
|
||||
$attributes = array(
|
||||
'type' => 'submit',
|
||||
'id' => $qa->get_behaviour_field_name('submit'),
|
||||
|
@ -1,5 +1,15 @@
|
||||
This files describes API changes for question behaviour plugins.
|
||||
|
||||
=== 3.1 ===
|
||||
|
||||
1) The standard behaviours that use a 'Check' button have all been changed so
|
||||
that they only show the button when the question is active. Your behaviour
|
||||
may interit this behaviour, because the change was made in the base class,
|
||||
and this is probably good for consistency. However, if your question behaviour
|
||||
uses the Check button, your probably want to test it carefully, and you will
|
||||
probably have to update your unit tests. See MDL-53304 for more details.
|
||||
|
||||
|
||||
=== 2.9 ===
|
||||
|
||||
1) There are new methods question_behaviour::can_finish_during_attempt and
|
||||
|
@ -1103,11 +1103,27 @@ abstract class qbehaviour_walkthrough_test_base extends question_testcase {
|
||||
return new question_contains_tag_with_attributes('input', $expectedattributes, $forbiddenattributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an epectation that a string contains the HTML of a button with
|
||||
* name {question-attempt prefix}-submit, and eiter enabled or not.
|
||||
* @param bool $enabled if not null, check the enabled/disabled state of the button. True = enabled.
|
||||
* @return question_contains_tag_with_attributes an expectation for use with check_current_output.
|
||||
*/
|
||||
protected function get_contains_submit_button_expectation($enabled = null) {
|
||||
return $this->get_contains_button_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . '-submit', null, $enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an epectation that a string does not contain the HTML of a button with
|
||||
* name {question-attempt prefix}-submit.
|
||||
* @return question_contains_tag_with_attributes an expectation for use with check_current_output.
|
||||
*/
|
||||
protected function get_does_not_contain_submit_button_expectation() {
|
||||
return new question_no_pattern_expectation('/name="' .
|
||||
$this->quba->get_field_prefix($this->slot) . '-submit"/');
|
||||
}
|
||||
|
||||
protected function get_tries_remaining_expectation($n) {
|
||||
return new question_pattern_expectation('/' .
|
||||
preg_quote(get_string('triesremaining', 'qbehaviour_interactive', $n), '/') . '/');
|
||||
|
@ -98,7 +98,7 @@ class qtype_calculated_walkthrough_test extends qbehaviour_walkthrough_test_base
|
||||
$this->check_current_mark(3);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(3),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
@ -98,7 +98,7 @@ class qtype_calculatedmulti_walkthrough_test extends qbehaviour_walkthrough_test
|
||||
$this->check_current_mark(3);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(3),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
@ -97,7 +97,7 @@ class qtype_calculatedsimple_walkthrough_test extends qbehaviour_walkthrough_tes
|
||||
$this->check_current_mark(3);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(3),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
@ -180,7 +180,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->quba->get_field_prefix($this->slot) . 'p3', '1'),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'p4', '2'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -469,7 +469,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_drag_image_home_expectation(2, 2, 1),
|
||||
$this->get_contains_drag_image_home_expectation(3, 1, 2),
|
||||
$this->get_contains_drag_image_home_expectation(4, 2, 2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'),
|
||||
@ -530,7 +530,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_drag_image_home_expectation(2, 2, 1),
|
||||
$this->get_contains_drag_image_home_expectation(3, 1, 2),
|
||||
$this->get_contains_drag_image_home_expectation(4, 2, 2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the second hint'),
|
||||
@ -592,7 +592,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->quba->get_field_prefix($this->slot) . 'p3', 1),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'p4', 2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_does_not_contain_try_again_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation(),
|
||||
@ -648,7 +648,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_drag_image_home_expectation(2, 2, 1),
|
||||
$this->get_contains_drag_image_home_expectation(3, 1, 2),
|
||||
$this->get_contains_drag_image_home_expectation(4, 2, 2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -710,7 +710,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_drag_image_home_expectation(2, 2, 1),
|
||||
$this->get_contains_drag_image_home_expectation(3, 1, 2),
|
||||
$this->get_contains_drag_image_home_expectation(4, 2, 2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_partcorrect_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -769,7 +769,7 @@ class qtype_ddimageortext_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_drag_image_home_expectation(2, 2, 1),
|
||||
$this->get_contains_drag_image_home_expectation(3, 1, 2),
|
||||
$this->get_contains_drag_image_home_expectation(4, 2, 2),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
|
||||
// Do try again.
|
||||
|
@ -168,7 +168,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_hidden_expectation(1, '50,50'),
|
||||
$this->get_contains_hidden_expectation(2, '150,50'),
|
||||
$this->get_contains_hidden_expectation(3, '100,150'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -399,7 +399,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_draggable_marker_home_expectation(1, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(2, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(3, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'),
|
||||
@ -448,7 +448,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_draggable_marker_home_expectation(1, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(2, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(3, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the second hint'),
|
||||
@ -493,7 +493,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_hidden_expectation(1, '50,50'),
|
||||
$this->get_contains_hidden_expectation(2, '150,50'),
|
||||
$this->get_contains_hidden_expectation(3, '100,150'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_does_not_contain_try_again_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation(),
|
||||
@ -542,7 +542,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_draggable_marker_home_expectation(1, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(2, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(3, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -597,7 +597,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_draggable_marker_home_expectation(1, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(2, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(3, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_partcorrect_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -651,7 +651,7 @@ class qtype_ddmarker_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_draggable_marker_home_expectation(1, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(2, false),
|
||||
$this->get_contains_draggable_marker_home_expectation(3, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
|
||||
// Do try again.
|
||||
|
@ -114,7 +114,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
@ -151,7 +151,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true, 'correct'),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true, 'correct'),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true, 'correct'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -401,7 +401,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'),
|
||||
@ -453,7 +453,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the second hint'),
|
||||
@ -499,7 +499,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true, 'correct'),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true, 'correct'),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true, 'correct'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_does_not_contain_try_again_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation(),
|
||||
@ -557,7 +557,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true, 'correct'),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true, 'correct'),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true, 'correct'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -613,7 +613,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true, 'correct'),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true, 'incorrect'),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true, 'incorrect'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_partcorrect_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
@ -666,7 +666,7 @@ class qtype_ddwtos_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_drop_box_expectation('1', 1, true),
|
||||
$this->get_contains_drop_box_expectation('2', 2, true),
|
||||
$this->get_contains_drop_box_expectation('3', 3, true),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
|
||||
// Do try again.
|
||||
|
@ -95,7 +95,7 @@ class qtype_gapselect_walkthrough_test extends qbehaviour_walkthrough_test_base
|
||||
array('' => get_string('choosedots'), '1' => 'fox', '2' => 'dog'), 2, false),
|
||||
$this->get_contains_select_expectation('p3',
|
||||
array('' => get_string('choosedots'), '1' => 'lazy', '2' => 'assiduous'), 2, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint'));
|
||||
@ -132,7 +132,7 @@ class qtype_gapselect_walkthrough_test extends qbehaviour_walkthrough_test_base
|
||||
array('' => get_string('choosedots'), '1' => 'fox', '2' => 'dog'), 1, false),
|
||||
$this->get_contains_select_expectation('p3',
|
||||
array('' => get_string('choosedots'), '1' => 'lazy', '2' => 'assiduous'), 1, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
||||
|
@ -194,7 +194,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[2], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
}
|
||||
@ -246,7 +246,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[1], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, null, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_partcorrect_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
}
|
||||
@ -313,7 +313,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[2], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[2], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, $orderforchoice[1], false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
}
|
||||
@ -422,7 +422,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub2', '0'),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub3', '0'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint.'));
|
||||
|
||||
// Try again.
|
||||
@ -464,7 +464,7 @@ class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub2', $orderforchoice[2]),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub3', $orderforchoice[1]),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the second hint.'));
|
||||
|
||||
// Try again.
|
||||
|
@ -250,7 +250,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub3_answer', ''),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub4_answer', ''),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint.'));
|
||||
@ -300,7 +300,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub3_answer', ''),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub4_answer', '1'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the second hint.'));
|
||||
|
||||
// Try again.
|
||||
@ -419,7 +419,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas
|
||||
$this->get_contains_select_expectation('sub2_answer', $choices, 1, false),
|
||||
$this->get_contains_select_expectation('sub3_answer', $choices, 1, false),
|
||||
$this->get_contains_select_expectation('sub4_answer', $choices, 1, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_try_again_button_expectation(true),
|
||||
$this->get_does_not_contain_correctness_expectation(),
|
||||
new question_pattern_expectation('/Tries remaining: 2/'),
|
||||
@ -460,7 +460,7 @@ class qtype_multianswer_walkthrough_test extends qbehaviour_walkthrough_test_bas
|
||||
$this->get_contains_select_expectation('sub2_answer', $choices, '1', false),
|
||||
$this->get_contains_select_expectation('sub3_answer', $choices, '0', false),
|
||||
$this->get_contains_select_expectation('sub4_answer', $choices, '1', false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_does_not_contain_try_again_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
new question_no_pattern_expectation('/class="control\b[^"]*\bpartiallycorrect"/'));
|
||||
|
@ -97,7 +97,7 @@ class qtype_numerical_walkthrough_test extends qbehaviour_walkthrough_test_base
|
||||
$this->check_current_mark(3);
|
||||
$this->check_current_output(
|
||||
$this->get_contains_mark_summary(3),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_does_not_contain_validation_error_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
|
@ -193,7 +193,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[16], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[16], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, $orderforchoice[13], false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
}
|
||||
@ -245,7 +245,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[16], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[13], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, null, false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_partcorrect_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
}
|
||||
@ -312,7 +312,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->get_contains_select_expectation('sub1', $choices, $orderforchoice[16], false),
|
||||
$this->get_contains_select_expectation('sub2', $choices, $orderforchoice[16], false),
|
||||
$this->get_contains_select_expectation('sub3', $choices, $orderforchoice[13], false),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_correct_expectation(),
|
||||
$this->get_no_hint_visible_expectation());
|
||||
}
|
||||
@ -369,7 +369,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub2', '0'),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub3', '0'),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the first hint.'));
|
||||
|
||||
// Try again.
|
||||
@ -411,7 +411,7 @@ class qtype_randomsamatch_walkthrough_test extends qbehaviour_walkthrough_test_b
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub2', $orderforchoice[16]),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . 'sub3', $orderforchoice[13]),
|
||||
$this->get_contains_submit_button_expectation(false),
|
||||
$this->get_does_not_contain_submit_button_expectation(),
|
||||
$this->get_contains_hint_expectation('This is the second hint.'));
|
||||
|
||||
// Try again.
|
||||
|
Loading…
x
Reference in New Issue
Block a user