MDL-77761 core_form: Add label for editor format selector

This commit is contained in:
Jun Pataleta 2023-03-27 22:20:17 +08:00
parent 449a8b0b31
commit 436ed2c4cb
7 changed files with 12 additions and 11 deletions

View File

@ -56,7 +56,7 @@ Feature: Add activities to courses
And I am logged in as admin
And I am on "Course 1" course homepage with editing mode on
When I add a "Database" to section "3"
Then I should see "Moodle auto-format" in the "#menuintroeditorformat > option[selected]" "css_element"
Then the field "Description format" matches value "0"
@javascript
Scenario: The activity description should preserve the format used once edited (markdown version)
@ -70,8 +70,7 @@ Feature: Add activities to courses
And I am on "Course 1" course homepage with editing mode on
And I open "A4" actions menu
When I click on "Edit settings" "link" in the "A4" activity
Then I should see "Markdown format" in the "#menuintroeditorformat > option[selected]" "css_element"
And I should not see "Plain text format" in the "#menuintroeditorformat > option[selected]" "css_element"
Then the field "Description format" matches value "4"
@javascript
Scenario: The activity description should preserve the format used once edited (plain text version)
@ -85,5 +84,4 @@ Feature: Add activities to courses
And I am on "Course 1" course homepage with editing mode on
And I open "A2" actions menu
When I click on "Edit settings" "link" in the "A2" activity
Then I should see "Plain text format" in the "#menuintroeditorformat > option[selected]" "css_element"
And I should not see "Markdown format" in the "#menuintroeditorformat > option[selected]" "css_element"
Then the field "Description format" matches value "2"

View File

@ -11,7 +11,7 @@ Feature: Summary text format should be preserved on edit and set by preferred ed
And I log in as "admin"
And I go to the courses management page
When I click on "Create new course" "link"
Then I should see "Moodle auto-format" in the "#menusummary_editorformat > option[selected]" "css_element"
Then the field "Course summary format" matches value "0"
Scenario: Summary format must be preserved on course edit
Given the following "user preferences" exist:
@ -28,4 +28,4 @@ Feature: Summary text format should be preserved on edit and set by preferred ed
And I set the field with xpath "//select[@name='summary_editor[format]']" to "4"
And I press "Save and display"
When I click on "Settings" "link"
Then I should see "Markdown format" in the "#menusummary_editorformat > option[selected]" "css_element"
Then the field "Course summary format" matches value "4"

View File

@ -53,6 +53,7 @@ $string['cutpastemozilla'] = 'Unfortunately, you cannot currently use normal key
$string['delete'] = 'Delete';
$string['editors'] = 'Text editors';
$string['editorsettings'] = 'Manage editors';
$string['editorxformat'] = '{$a} format';
$string['enterurlfirst'] = 'You have to enter an URL first';
$string['filebrowser'] = 'File Browser';
$string['findwhat'] = 'Find';

View File

@ -24,7 +24,7 @@ Feature: Atto Autosave
And I click on "Save changes" "button"
And I am on "Course 1" course homepage
And I navigate to "Settings" in current page administration
And I set the field with xpath "//select[@name='summary_editor[format]']" to "1"
And I set the field "Course summary format" to "1"
And I click on "Save and display" "button"
And I log out

View File

@ -453,6 +453,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab
$context['id'] = $id;
$context['value'] = $text;
$context['format'] = $format;
$context['formatlabel'] = get_string('editorxformat', 'editor', $this->_label);
if (!is_null($this->getAttribute('onblur')) && !is_null($this->getAttribute('onchange'))) {
$context['changelistener'] = true;

View File

@ -35,6 +35,7 @@
</div>
<div>
{{#hasformats}}
<label for="menu{{name}}format" class="sr-only">{{formatlabel}}</label>
<select name="{{name}}[format]" id="menu{{name}}format" class="custom-select">
{{#formats}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{text}}</option>

View File

@ -24,9 +24,9 @@ Feature: Teachers can embed images into instructions and conclusion fields
| workshop | C1 | Workshop with embedded images |
And I am on the "Workshop with embedded images" "workshop activity editing" page logged in as admin
And I set the following fields to these values:
| instructauthorseditor[format] | 1 |
| instructreviewerseditor[format] | 1 |
| conclusioneditor[format] | 1 |
| Instructions for submission format | 1 |
| Instructions for assessment format | 1 |
| Conclusion format | 1 |
And I press "Save and display"
And I log out
And I log in as "teacher1"