diff --git a/webapp/channels/src/components/team_settings/team_access_tab/allowed_domains_select.tsx b/webapp/channels/src/components/team_settings/team_access_tab/allowed_domains_select.tsx index 260f385d3c..93f7e4b672 100644 --- a/webapp/channels/src/components/team_settings/team_access_tab/allowed_domains_select.tsx +++ b/webapp/channels/src/components/team_settings/team_access_tab/allowed_domains_select.tsx @@ -58,7 +58,7 @@ const AllowedDomainsSelect = ({allowedDomains, setAllowedDomains, setHasChanges, defaultMessage: 'When enabled, users can only join the team if their email matches a specific domain (e.g. "mattermost.org")', })} descriptionAboveContent={true} - inputFieldData={{name: 'name'}} + inputFieldData={{name: 'showAllowedDomains'}} inputFieldValue={showAllowedDomains} handleChange={handleEnableAllowedDomains} /> diff --git a/webapp/channels/src/components/team_settings/team_access_tab/open_invite.tsx b/webapp/channels/src/components/team_settings/team_access_tab/open_invite.tsx index 2915dd6ea7..27cb7eab86 100644 --- a/webapp/channels/src/components/team_settings/team_access_tab/open_invite.tsx +++ b/webapp/channels/src/components/team_settings/team_access_tab/open_invite.tsx @@ -57,10 +57,10 @@ const OpenInvite = ({isGroupConstrained, allowOpenInvite, setAllowOpenInvite}: P inputFieldTitle={ } - inputFieldData={{name: 'name'}} + inputFieldData={{name: 'allowOpenInvite'}} inputFieldValue={allowOpenInvite} handleChange={setAllowOpenInvite} title={formatMessage({ diff --git a/webapp/channels/src/components/team_settings/team_access_tab/team_access_tab.test.tsx b/webapp/channels/src/components/team_settings/team_access_tab/team_access_tab.test.tsx index 9a2d4ade7d..7228acbf71 100644 --- a/webapp/channels/src/components/team_settings/team_access_tab/team_access_tab.test.tsx +++ b/webapp/channels/src/components/team_settings/team_access_tab/team_access_tab.test.tsx @@ -120,4 +120,31 @@ describe('components/TeamSettings', () => { id: defaultProps.team?.id, }); }); + + test('MM-62891 should toggle the right checkboxes when their labels are clicked on', () => { + renderWithContext(); + + expect(screen.getByRole('checkbox', {name: 'Allow only users with a specific email domain to join this team'})).not.toBeChecked(); + expect(screen.getByRole('checkbox', {name: 'Allow any user with an account on this server to join this team'})).not.toBeChecked(); + + userEvent.click(screen.getByText('Allow only users with a specific email domain to join this team')); + + expect(screen.getByRole('checkbox', {name: 'Allow only users with a specific email domain to join this team'})).toBeChecked(); + expect(screen.getByRole('checkbox', {name: 'Allow any user with an account on this server to join this team'})).not.toBeChecked(); + + userEvent.click(screen.getByText('Allow only users with a specific email domain to join this team')); + + expect(screen.getByRole('checkbox', {name: 'Allow only users with a specific email domain to join this team'})).not.toBeChecked(); + expect(screen.getByRole('checkbox', {name: 'Allow any user with an account on this server to join this team'})).not.toBeChecked(); + + userEvent.click(screen.getByText('Allow any user with an account on this server to join this team')); + + expect(screen.getByRole('checkbox', {name: 'Allow only users with a specific email domain to join this team'})).not.toBeChecked(); + expect(screen.getByRole('checkbox', {name: 'Allow any user with an account on this server to join this team'})).toBeChecked(); + + userEvent.click(screen.getByText('Allow any user with an account on this server to join this team')); + + expect(screen.getByRole('checkbox', {name: 'Allow only users with a specific email domain to join this team'})).not.toBeChecked(); + expect(screen.getByRole('checkbox', {name: 'Allow any user with an account on this server to join this team'})).not.toBeChecked(); + }); });