fix: remove --or-- divider if social login is not enabled (#418)
Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
parent
5bf7d5652c
commit
9358539e0c
@ -7,7 +7,7 @@ import userEvent from '@testing-library/user-event';
|
|||||||
const mockMgmtResponse = {
|
const mockMgmtResponse = {
|
||||||
distSpecVersion: '1.1.0-dev',
|
distSpecVersion: '1.1.0-dev',
|
||||||
binaryType: '-apikey-lint-metrics-mgmt-scrub-search-sync-ui-userprefs',
|
binaryType: '-apikey-lint-metrics-mgmt-scrub-search-sync-ui-userprefs',
|
||||||
http: { auth: { htpasswd: {} } }
|
http: { auth: { htpasswd: {}, openid: { providers: { github: {} } } } }
|
||||||
};
|
};
|
||||||
|
|
||||||
// useNavigate mock
|
// useNavigate mock
|
||||||
@ -55,6 +55,7 @@ describe('Sign in form', () => {
|
|||||||
fireEvent.change(passwordInput, { target: { value: 'test' } });
|
fireEvent.change(passwordInput, { target: { value: 'test' } });
|
||||||
expect(usernameInput).toHaveValue('test');
|
expect(usernameInput).toHaveValue('test');
|
||||||
expect(passwordInput).toHaveValue('test');
|
expect(passwordInput).toHaveValue('test');
|
||||||
|
expect(screen.getByTestId('openid-divider')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display error if username and password values are empty after change', async () => {
|
it('should display error if username and password values are empty after change', async () => {
|
||||||
|
@ -312,7 +312,13 @@ export default function SignIn({ isLoggedIn, setIsLoggedIn, wrapperSetLoading =
|
|||||||
Welcome back! Please login.
|
Welcome back! Please login.
|
||||||
</Typography>
|
</Typography>
|
||||||
{renderThirdPartyLoginMethods()}
|
{renderThirdPartyLoginMethods()}
|
||||||
{Object.keys(authMethods).length > 1 && <Divider className={classes.divider}>or</Divider>}
|
{Object.keys(authMethods).length > 1 &&
|
||||||
|
Object.keys(authMethods).includes('openid') &&
|
||||||
|
Object.keys(authMethods.openid.providers).length > 0 && (
|
||||||
|
<Divider className={classes.divider} data-testId="openid-divider">
|
||||||
|
or
|
||||||
|
</Divider>
|
||||||
|
)}
|
||||||
{Object.keys(authMethods).includes('htpasswd') && (
|
{Object.keys(authMethods).includes('htpasswd') && (
|
||||||
<Box component="form" onSubmit={null} noValidate autoComplete="off">
|
<Box component="form" onSubmit={null} noValidate autoComplete="off">
|
||||||
<TextField
|
<TextField
|
||||||
|
Loading…
Reference in New Issue
Block a user