Commit 76c493b3 authored by Damyon Wiese's avatar Damyon Wiese
Browse files

MDL-59368 groups: Add behat for new group edit

parent 090d064d
@core_enrol @core_group
@core_enrol @core_group @doit
Feature: Users can be added to multiple groups at once
In order to manage group membership effectively
As a user
......@@ -22,15 +22,20 @@ Feature: Users can be added to multiple groups at once
| teacher1 | C1 | editingteacher |
| student1 | C1 | editingteacher |
@javascript
Scenario: Adding a user to one group
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Enrolled users" node in "Course administration > Users"
And I click on "Add user into group" "link" in the "student1" "table_row"
When I set the field "Add user into group" to "Group 1"
And I press "Save changes"
Then I should see "Group 1"
And I follow "Participants"
And I click on "Edit groups for \"Student 1\"" "link" in the "student1" "table_row"
And I click on ".form-autocomplete-downarrow" "css_element"
And I click on ".form-autocomplete-suggestions [role=option]" "css_element"
And I click on ".form-autocomplete-downarrow" "css_element"
And I click on ".form-autocomplete-suggestions [role=option]" "css_element"
And I click on "Save changes" "link"
Then I should see "Group 1, Group 2"
@javascript
Scenario: Adding a user to multiple group
Given I log in as "teacher1"
And I am on "Course 1" course homepage
......
......@@ -72,6 +72,8 @@ class user_groups_editable extends \core\output\inplace_editable {
foreach ($coursegroups as $group) {
$options[$group->id] = $group->name;
}
$this->edithint = get_string('editusersgroupsa', 'group', fullname($user));
$this->editlabel = get_string('editusersgroupsa', 'group', fullname($user));
$attributes = ['multiple' => true];
$this->set_type_autocomplete($options, $attributes);
......@@ -84,9 +86,6 @@ class user_groups_editable extends \core\output\inplace_editable {
* @return \stdClass
*/
public function export_for_template(\renderer_base $output) {
// Set edithint and display value.
$this->edithint = get_string('editusersgroups', 'group');
$listofgroups = [];
$groupids = json_decode($this->value);
foreach ($groupids as $id) {
......
......@@ -56,7 +56,7 @@ $string['deletegroupsconfirm'] = 'Are you sure you want to delete the following
$string['deleteselectedgroup'] = 'Delete selected group';
$string['editgroupingsettings'] = 'Edit grouping settings';
$string['editgroupsettings'] = 'Edit group settings';
$string['editusersgroups'] = 'Edit users groups';
$string['editusersgroupsa'] = 'Edit groups for "{$a}"';
$string['enrolmentkey'] = 'Enrolment key';
$string['enrolmentkey_help'] = 'An enrolment key enables access to the course to be restricted to only those who know the key. If a group enrolment key is specified, then not only will entering that key let the user into the course, but it will also automatically make them a member of this group.
......
......@@ -264,7 +264,7 @@ function groups_get_all_groups($courseid, $userid=0, $groupingid=0, $fields='g.*
}
if ($withmembers) {
$memberselect = 'ugm.id AS ugmid, ugm.userid, ';
$memberselect = $DB->sql_concat("COALESCE(ugm.userid, ugm.userid, 'NULL')", "':'", 'g.id') . ' AS ugmid, ugm.userid, ';
$memberjoin = ' LEFT JOIN {groups_members} ugm ON ugm.groupid = g.id ';
}
......
......@@ -28,6 +28,11 @@
}
}
// This rule overrides the automatic no-overflow on the participants table. It kills the auto-complete.
#participantsform .no-overflow {
overflow: visible;
}
.userprofile dl.list {
// Copied from dl.row.
> dd + dt {
......
......@@ -52,6 +52,10 @@
text-align: right;
}
}
// This rule overrides the automatic no-overflow on the participants table. It kills the auto-complete.
#participantsform .no-overflow {
overflow: visible;
}
/**
* This rule has been added to duplicate the style of icons with the
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment