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:
Tim Hunt
2016-03-04 14:06:19 +00:00
parent 7adc7ef14f
commit 81e47a35e8
19 changed files with 92 additions and 60 deletions
+16
View File
@@ -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), '/') . '/');