Show error if the user tries to set the limit group members to 1

closes VICE-3380
flag=none

test plan:
  - Specs pass.
  - Go to the People's Page.
  - Create a group set.
  - Enable “Allow Self Sign-up”.
  - Enter a name and set the “Limit Group Members” to 1.
  - Click Save and it should show an error message.

qa risk: low

Change-Id: Ie667f5828ff0aa10b4e56849289c669ca606791b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/313620
QA-Review: Jason Gillett <jason.gillett@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
Omar Gerardo Soto-Fortuño 2023-03-17 15:49:52 -04:00 committed by Omar Soto-Fortuño
parent e422745e42
commit 2c5396f0ec
2 changed files with 22 additions and 2 deletions

View File

@ -261,6 +261,22 @@ describe "people" do
expect(f(".groups-with-count")).to include_text("Groups (#{group_count})")
end
it "errors if the user tries to set the limit group members to 1" do
get "/courses/#{@course.id}/users"
expect_new_page_load do
f("#people-options .Button").click
fln("View User Groups").click
end
open_student_group_dialog
replace_and_proceed f("#new-group-set-name"), "new group"
fxpath("//input[@data-testid='checkbox-allow-self-signup']/..").click
force_click('[data-testid="initial-group-count"]')
f('[data-testid="group-member-limit"]').send_keys("1")
f(%(button[data-testid="group-set-save"])).click
wait_for_ajaximations
expect(fj("span:contains('If you are going to define a limit group members, it must be greater than 1.')")).to be_truthy
end
it "tests group structure functionality" do
get "/courses/#{@course.id}/users"
enroll_more_students

View File

@ -190,9 +190,13 @@ export const CreateOrEditSetModal = ({
}
if (st.selfSignup) {
const groupLimitIsInvalid = st.groupLimit.length > 0 && isInvalidNumber(st.groupLimit)
if (isInvalidNumber(st.createGroupCount)) structureError(I18n.t('Group count is invalid'))
else if (st.groupLimit.length > 0 && isInvalidNumber(st.groupLimit))
structureError(I18n.t('Group limit size is invalid'))
else if (groupLimitIsInvalid) structureError(I18n.t('Group limit size is invalid'))
else if (!groupLimitIsInvalid && parseInt(st.groupLimit, 10) < 2)
structureError(
I18n.t('If you are going to define a limit group members, it must be greater than 1.')
)
} else {
switch (st.splitGroups) {
case SPLIT.byGroupCount: