MM-62891 Fixed incorrectly applied label in Team Settings modal (#30116)

This commit is contained in:
Harrison Healey 2025-02-11 10:50:42 -05:00 committed by GitHub
parent 9aaa52136c
commit 55bb6c51eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 3 deletions

View File

@ -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}
/>

View File

@ -57,10 +57,10 @@ const OpenInvite = ({isGroupConstrained, allowOpenInvite, setAllowOpenInvite}: P
inputFieldTitle={
<FormattedMessage
id='general_tab.openInviteTitle'
defaultMessage='Allow only users with a specific email domain to join this team'
defaultMessage='Allow any user with an account on this server to join this team'
/>
}
inputFieldData={{name: 'name'}}
inputFieldData={{name: 'allowOpenInvite'}}
inputFieldValue={allowOpenInvite}
handleChange={setAllowOpenInvite}
title={formatMessage({

View File

@ -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(<AccessTab {...defaultProps}/>);
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();
});
});