diff --git a/group/tests/behat/group_description_picture.feature b/group/tests/behat/group_description_picture.feature index 64b2d9e5cc4..d9d09201ce3 100644 --- a/group/tests/behat/group_description_picture.feature +++ b/group/tests/behat/group_description_picture.feature @@ -21,15 +21,17 @@ Feature: The description and picture of a group can be viewed by students and te @javascript @_file_upload Scenario: A student can see the group description and picture when visible groups are set. Teachers can see group details. - Given I am on the "Course 1" "course editing" page logged in as "teacher1" + Given the "multilang" filter is "on" + And the "multilang" filter applies to "content and headings" + And I am on the "Course 1" "course editing" page logged in as "teacher1" And I set the following fields to these values: | Group mode | Visible groups | And I press "Save and display" And I am on the "Course 1" "groups" page And I press "Create group" And I set the following fields to these values: - | Group name | Group A | - | Group description | Description for Group A | + | Group name | Group A & < > " 'Gruppe A | + | Group description | Description for Group A | # Upload group picture And I upload "lib/tests/fixtures/gd-logo.png" file to "New picture" filemanager And I press "Save changes" @@ -58,7 +60,7 @@ Feature: The description and picture of a group can be viewed by students and te And I click on "Student 1" "link" in the "participants" "table" And I click on "Group A" "link" # As student, confirm that group description and picture is displayed - Then I should see "Description for Group A" + And I should see "Description for Group A" And "//img[@class='grouppicture']" "xpath_element" should exist And I am on the "Course 1" course page logged in as student2 And I navigate to course participants @@ -66,6 +68,14 @@ Feature: The description and picture of a group can be viewed by students and te And I click on "Group B" "link" And I should see "Student 2" in the "participants" "table" And ".groupinfobox" "css_element" should not exist + # As teacher, confirm that the group picture in the edit form has the correct alt text + And I am on the "Course 1" "groups" page logged in as teacher1 + And I set the field "groups" to "Group A" + And I press "Edit group settings" + Then the "alt" attribute of "//*[contains(@data-name, 'currentpicture')]//img" "xpath_element" should contain "Group A & <" + But the "alt" attribute of "//*[contains(@data-name, 'currentpicture')]//img" "xpath_element" should not contain "span" + And the "title" attribute of "//*[contains(@data-name, 'currentpicture')]//img" "xpath_element" should contain "Group A & <" + But the "title" attribute of "//*[contains(@data-name, 'currentpicture')]//img" "xpath_element" should not contain "span" @javascript @_file_upload Scenario: A student can not see the group description and picture when separate groups are set. Teachers can see group details. diff --git a/lib/weblib.php b/lib/weblib.php index ae0124b4418..2c9fe40fd93 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1824,7 +1824,7 @@ function print_group_picture($group, $courseid, $large = false, $return = false, $context = context_course::instance($courseid); - $groupname = s($group->name); + $groupname = format_string($group->name, true, ['context' => $context, 'escape' => false]); $pictureimage = html_writer::img($pictureurl, $groupname, ['title' => $groupname]); $output = '';