This commit is contained in:
Eloy Lafuente (stronk7)
2019-02-20 17:01:56 +01:00
2 changed files with 4 additions and 12 deletions
+2 -10
View File
@@ -71,17 +71,9 @@ class qtype_gapselect_renderer extends qtype_elements_embedded_in_question_text_
}
}
// If the text is short use non-breaking space.
$choose = ' ';
foreach ($selectoptions as $key => $text) {
if (strlen(get_string('choosedots')) / 2 <= strlen($text)) {
$choose = get_string('choosedots');
break;
}
}
// Use non-breaking space instead of 'Choose...'.
$selecthtml = html_writer::select($selectoptions, $qa->get_qt_field_name($fieldname),
$value, $choose, $attributes) . ' ' . $feedbackimage;
$value, '&nbsp;', $attributes) . ' ' . $feedbackimage;
return html_writer::tag('span', $selecthtml, array('class' => 'control '.$groupclass));
}
@@ -60,9 +60,9 @@ class qtype_gapselect_walkthrough_test extends qbehaviour_walkthrough_test_base
// Also note the ' ' in the p2 example below is a nbsp (used when names are short).
$this->check_output_contains_selectoptions(
$this->get_contains_select_expectation('p1',
['' => get_string('choosedots'), '1' => 'quick', '2' => 'slow'], null, true),
['0' => '&nbsp;', '1' => 'quick', '2' => 'slow'], null, true),
$this->get_contains_select_expectation('p2',
['' => ' ', '1' => 'fox', '2' => 'dog'], null, true),
['0' => '&nbsp;', '1' => 'fox', '2' => 'dog'], null, true),
$this->get_contains_select_expectation('p3',
['1' => 'lazy', '2' => 'assiduous'], null, true));