1
0
mirror of https://github.com/moodle/moodle.git synced 2025-03-22 16:40:07 +01:00

MDL-77670 course: Preserve course summary format

This commit is contained in:
Juan Segarra Montesinos 2023-03-17 06:49:50 +01:00
parent 6c260e6ae7
commit b296667ebf
2 changed files with 34 additions and 1 deletions

@ -2214,7 +2214,7 @@ function create_course($data, $editoroptions = NULL) {
if ($editoroptions) {
// summary text is updated later, we need context to store the files first
$data->summary = '';
$data->summary_format = FORMAT_HTML;
$data->summary_format = $data->summary_editor['format'];
}
// Get default completion settings as a fallback in case the enablecompletion field is not set.

@ -0,0 +1,33 @@
@core @core_course
Feature: Summary text format should be preserved on edit and set by preferred editor format on creation
In order to edit the course summary
As a course creator
The format specified for the summary must be honored
@javascript
Scenario: Preferred editor format should be used for summary field on course creation
Given the following "user preferences" exist:
| user | preference | value |
| admin | htmleditor | textarea |
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"
@javascript
Scenario: Summary format must be preserved on course edit
Given the following "user preferences" exist:
| user | preference | value |
| admin | htmleditor | textarea |
And I log in as "admin"
And I go to the courses management page
And I click on "Create new course" "link"
And I set the following fields to these values:
| Course full name | C1 |
| Course short name | C1 |
| Course summary | Course description |
# 4 is assumed to be Markdown format.
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"