Merge branch 'MDL-85510-master' of https://github.com/NashTechOpenUniversity/moodle
This commit is contained in:
Regular → Executable
+20
-4
@@ -459,14 +459,30 @@ abstract class question_definition {
|
||||
|
||||
/** @return the result of applying {@link format_text()} to the question text. */
|
||||
public function format_questiontext($qa) {
|
||||
return html_writer::tag('div', $this->format_text($this->questiontext, $this->questiontextformat,
|
||||
$qa, 'question', 'questiontext', $this->id), ['class' => 'clearfix']);
|
||||
$formattext = $this->format_text(
|
||||
$this->questiontext,
|
||||
$this->questiontextformat,
|
||||
$qa,
|
||||
'question',
|
||||
'questiontext',
|
||||
$this->id
|
||||
);
|
||||
|
||||
return html_writer::nonempty_tag('div', $formattext, ['class' => 'clearfix']);
|
||||
}
|
||||
|
||||
/** @return the result of applying {@link format_text()} to the general feedback. */
|
||||
public function format_generalfeedback($qa) {
|
||||
return html_writer::tag('div', $this->format_text($this->generalfeedback, $this->generalfeedbackformat,
|
||||
$qa, 'question', 'generalfeedback', $this->id), ['class' => 'clearfix']);
|
||||
$formattext = $this->format_text(
|
||||
$this->generalfeedback,
|
||||
$this->generalfeedbackformat,
|
||||
$qa,
|
||||
'question',
|
||||
'generalfeedback',
|
||||
$this->id
|
||||
);
|
||||
|
||||
return html_writer::nonempty_tag('div', $formattext, ['class' => 'clearfix']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Regular → Executable
+25
@@ -17,6 +17,7 @@
|
||||
namespace qtype_truefalse;
|
||||
|
||||
use question_state;
|
||||
use question_display_options;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@@ -160,4 +161,28 @@ final class walkthrough_test extends \qbehaviour_walkthrough_test_base {
|
||||
]);
|
||||
$this->assertStringContainsString($standardinstruction, $this->currentoutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the general feedback box is not displayed when it is empty for a false answer.
|
||||
*
|
||||
* @covers ::format_generalfeedback
|
||||
*/
|
||||
public function test_false_right_does_not_show_empty_general_feedback_when_answer(): void {
|
||||
$tf = \test_question_maker::make_question('truefalse', 'false');
|
||||
$this->start_attempt_at_question($tf, 'deferredfeedback', 1);
|
||||
$this->process_submission(data: ['answer' => 0]);
|
||||
$this->quba->finish_all_questions();
|
||||
$displayoptions = new question_display_options();
|
||||
$html = $this->quba->render_question(1, $displayoptions);
|
||||
$pattern = "/<div class=\"generalfeedback\">\s*<div class=\"clearfix\">\s*{$tf->generalfeedback}\s*<\/div>\s*<\/div>/";
|
||||
$this->assertMatchesRegularExpression($pattern, $html);
|
||||
|
||||
$tf->generalfeedback = "";
|
||||
$this->start_attempt_at_question($tf, 'deferredfeedback', 1);
|
||||
$this->process_submission(data: ['answer' => 0]);
|
||||
$this->quba->finish_all_questions();
|
||||
$html = $this->quba->render_question(1, $displayoptions);
|
||||
$pattern = "/<div class=\"generalfeedback\">\s*<div class=\"clearfix\"><\/div>\s*<\/div>/";
|
||||
$this->assertDoesNotMatchRegularExpression($pattern, $html);
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+16
-14
@@ -259,20 +259,28 @@ body.path-question-type {
|
||||
}
|
||||
|
||||
.que {
|
||||
clear: left;
|
||||
text-align: left;
|
||||
margin: 0 auto 1.8em auto;
|
||||
display: flex;
|
||||
align-items: start;
|
||||
gap: 1rem;
|
||||
@include media-breakpoint-down(md) {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.que .info {
|
||||
float: left;
|
||||
flex-shrink: 0;
|
||||
width: 7em;
|
||||
padding: 0.5em;
|
||||
margin-bottom: 1.8em;
|
||||
background-color: $gray-100;
|
||||
border: 1px solid darken($gray-300, 7%);
|
||||
|
||||
@include border-radius(2px);
|
||||
|
||||
@include media-breakpoint-down(md) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.que h3.no {
|
||||
@@ -303,7 +311,11 @@ body.path-question-type {
|
||||
}
|
||||
|
||||
.que .content {
|
||||
margin: 0 0 0 8.5em;
|
||||
flex-grow: 1;
|
||||
|
||||
@include media-breakpoint-down(md) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.que .formulation,
|
||||
@@ -673,16 +685,6 @@ body.path-question-type .mform fieldset.hidden {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@include media-breakpoint-down(md) {
|
||||
.que .info {
|
||||
float: none;
|
||||
width: auto;
|
||||
}
|
||||
.que .content {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.qbank_managecategories-item.qbank_managecategories-droptarget-before,
|
||||
.qbank_managecategories-item .qbank_managecategories-item.qbank_managecategories-droptarget-before,
|
||||
.qbank_managecategories-categorylist.qbank_managecategories-droptarget-before > .qbank_managecategories-item:first-child {
|
||||
|
||||
@@ -34029,20 +34029,31 @@ body.path-question-type .fitem .col-form-label.visually-hidden:not(legend):not([
|
||||
}
|
||||
|
||||
.que {
|
||||
clear: left;
|
||||
text-align: left;
|
||||
margin: 0 auto 1.8em auto;
|
||||
display: flex;
|
||||
align-items: start;
|
||||
gap: 1rem;
|
||||
}
|
||||
@media (max-width: 767.98px) {
|
||||
.que {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.que .info {
|
||||
float: left;
|
||||
flex-shrink: 0;
|
||||
width: 7em;
|
||||
padding: 0.5em;
|
||||
margin-bottom: 1.8em;
|
||||
background-color: #f8f9fa;
|
||||
border: 1px solid #cad0d7;
|
||||
border-radius: 2px;
|
||||
}
|
||||
@media (max-width: 767.98px) {
|
||||
.que .info {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.que h3.no, .que .no.h3 {
|
||||
margin: 0;
|
||||
@@ -34072,7 +34083,12 @@ body.path-question-type .fitem .col-form-label.visually-hidden:not(legend):not([
|
||||
}
|
||||
|
||||
.que .content {
|
||||
margin: 0 0 0 8.5em;
|
||||
flex-grow: 1;
|
||||
}
|
||||
@media (max-width: 767.98px) {
|
||||
.que .content {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.que .formulation,
|
||||
@@ -34420,15 +34436,6 @@ body.path-question-type .mform fieldset.hidden {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
.que .info {
|
||||
float: none;
|
||||
width: auto;
|
||||
}
|
||||
.que .content {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.qbank_managecategories-item.qbank_managecategories-droptarget-before,
|
||||
.qbank_managecategories-item .qbank_managecategories-item.qbank_managecategories-droptarget-before,
|
||||
.qbank_managecategories-categorylist.qbank_managecategories-droptarget-before > .qbank_managecategories-item:first-child {
|
||||
|
||||
@@ -34029,20 +34029,31 @@ body.path-question-type .fitem .col-form-label.visually-hidden:not(legend):not([
|
||||
}
|
||||
|
||||
.que {
|
||||
clear: left;
|
||||
text-align: left;
|
||||
margin: 0 auto 1.8em auto;
|
||||
display: flex;
|
||||
align-items: start;
|
||||
gap: 1rem;
|
||||
}
|
||||
@media (max-width: 767.98px) {
|
||||
.que {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.que .info {
|
||||
float: left;
|
||||
flex-shrink: 0;
|
||||
width: 7em;
|
||||
padding: 0.5em;
|
||||
margin-bottom: 1.8em;
|
||||
background-color: #f8f9fa;
|
||||
border: 1px solid #cad0d7;
|
||||
border-radius: 2px;
|
||||
}
|
||||
@media (max-width: 767.98px) {
|
||||
.que .info {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.que h3.no, .que .no.h3 {
|
||||
margin: 0;
|
||||
@@ -34072,7 +34083,12 @@ body.path-question-type .fitem .col-form-label.visually-hidden:not(legend):not([
|
||||
}
|
||||
|
||||
.que .content {
|
||||
margin: 0 0 0 8.5em;
|
||||
flex-grow: 1;
|
||||
}
|
||||
@media (max-width: 767.98px) {
|
||||
.que .content {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.que .formulation,
|
||||
@@ -34420,15 +34436,6 @@ body.path-question-type .mform fieldset.hidden {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
.que .info {
|
||||
float: none;
|
||||
width: auto;
|
||||
}
|
||||
.que .content {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.qbank_managecategories-item.qbank_managecategories-droptarget-before,
|
||||
.qbank_managecategories-item .qbank_managecategories-item.qbank_managecategories-droptarget-before,
|
||||
.qbank_managecategories-categorylist.qbank_managecategories-droptarget-before > .qbank_managecategories-item:first-child {
|
||||
|
||||
Reference in New Issue
Block a user