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

Этот коммит содержится в:
Harrison Healey
2025-02-11 10:50:42 -05:00
коммит произвёл GitHub
родитель 9aaa52136c
Коммит 55bb6c51eb
3 изменённых файлов: 30 добавлений и 3 удалений

Просмотреть файл

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

Просмотреть файл

@@ -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({

Просмотреть файл

@@ -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();
});
});