diff --git a/src/common-components/EnterpriseSSO.jsx b/src/common-components/EnterpriseSSO.jsx
index e27bd1a6..a3361a38 100644
--- a/src/common-components/EnterpriseSSO.jsx
+++ b/src/common-components/EnterpriseSSO.jsx
@@ -4,8 +4,9 @@ import { getConfig } from '@edx/frontend-platform';
import { useIntl } from '@edx/frontend-platform/i18n';
import {
Button, Form,
+ Icon,
} from '@edx/paragon';
-import { faSignInAlt } from '@fortawesome/free-solid-svg-icons';
+import { Login } from '@edx/paragon/icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import PropTypes from 'prop-types';
@@ -54,9 +55,11 @@ const EnterpriseSSO = (props) => {
: (
<>
-
+ {SUPPORTED_ICON_CLASSES.includes(tpaProvider.iconClass) ? (
+ )
+ : (
+
+ )}
{ tpaProvider.name }
>
diff --git a/src/common-components/SocialAuthProviders.jsx b/src/common-components/SocialAuthProviders.jsx
index 8a21211b..1ff73f1f 100644
--- a/src/common-components/SocialAuthProviders.jsx
+++ b/src/common-components/SocialAuthProviders.jsx
@@ -2,7 +2,8 @@ import React from 'react';
import { getConfig } from '@edx/frontend-platform';
import { useIntl } from '@edx/frontend-platform/i18n';
-import { faSignInAlt } from '@fortawesome/free-solid-svg-icons';
+import { Icon } from '@edx/paragon';
+import { Login } from '@edx/paragon/icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import PropTypes from 'prop-types';
@@ -36,9 +37,11 @@ const SocialAuthProviders = (props) => {
)
: (
-
+ {SUPPORTED_ICON_CLASSES.includes(provider.iconClass) ? (
+ )
+ : (
+
+ )}
)}
{provider.name}
diff --git a/src/common-components/tests/__snapshots__/SocialAuthProviders.test.jsx.snap b/src/common-components/tests/__snapshots__/SocialAuthProviders.test.jsx.snap
index 6152667a..3176a864 100644
--- a/src/common-components/tests/__snapshots__/SocialAuthProviders.test.jsx.snap
+++ b/src/common-components/tests/__snapshots__/SocialAuthProviders.test.jsx.snap
@@ -12,23 +12,25 @@ exports[`SocialAuthProviders should match social auth provider with default icon
aria-hidden="true"
className="font-container"
>
-
+
+
{
const ssoProvider = {
id: 'oa2-apple-id',
name: 'Apple',
- iconClass: null,
+ iconClass: 'apple',
iconImage: 'https://openedx.devstack.lms/logo.png',
loginUrl: '/auth/login/apple-id/?auth_entry=login&next=/dashboard',
};
@@ -414,7 +414,7 @@ describe('LoginPage', () => {
+ 'to the courses you are enrolled in. Sign in to continue.';
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: '?account_activation_status=success' };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: '?account_activation_status=success' };
const loginPage = mount(reduxWrapper());
expect(loginPage.find('div#account-activation-message').text()).toEqual(activationMessage);
@@ -569,7 +569,7 @@ describe('LoginPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: `?next=/dashboard&tpa_hint=${ssoProvider.id}` };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: `?next=/dashboard&tpa_hint=${ssoProvider.id}` };
ssoProvider.iconImage = null;
const loginPage = mount(reduxWrapper());
@@ -592,7 +592,7 @@ describe('LoginPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: `?next=/dashboard&tpa_hint=${secondaryProviders.id}` };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: `?next=/dashboard&tpa_hint=${secondaryProviders.id}` };
secondaryProviders.iconImage = null;
mount(reduxWrapper());
@@ -617,7 +617,7 @@ describe('LoginPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: '?next=/dashboard&tpa_hint=invalid' };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: '?next=/dashboard&tpa_hint=invalid' };
ssoProvider.iconImage = null;
const loginPage = mount(reduxWrapper());
@@ -642,7 +642,7 @@ describe('LoginPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: `?tpa_hint=${ssoProvider.id}` };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: `?tpa_hint=${ssoProvider.id}` };
ssoProvider.iconImage = null;
const loginPage = mount(reduxWrapper());
@@ -666,7 +666,7 @@ describe('LoginPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: `?tpa_hint=${ssoProvider.id}` };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: `?tpa_hint=${ssoProvider.id}` };
ssoProvider.iconImage = null;
const loginPage = mount(reduxWrapper());
diff --git a/src/register/tests/RegistrationPage.test.jsx b/src/register/tests/RegistrationPage.test.jsx
index e7c84429..00fb8bcc 100644
--- a/src/register/tests/RegistrationPage.test.jsx
+++ b/src/register/tests/RegistrationPage.test.jsx
@@ -13,7 +13,9 @@ import { Router } from 'react-router-dom';
import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
-import { AUTHN_PROGRESSIVE_PROFILING, COMPLETE_STATE, PENDING_STATE } from '../../data/constants';
+import {
+ AUTHN_PROGRESSIVE_PROFILING, COMPLETE_STATE, LOGIN_PAGE, PENDING_STATE, REGISTER_PAGE,
+} from '../../data/constants';
import {
backupRegistrationFormBegin,
clearUsernameSuggestions,
@@ -131,7 +133,7 @@ describe('RegistrationPage', () => {
const ssoProvider = {
id: 'oa2-apple-id',
name: 'Apple',
- iconClass: null,
+ iconClass: 'apple',
iconImage: 'https://openedx.devstack.lms/logo.png',
loginUrl: '/auth/login/apple-id/?auth_entry=login&next=/dashboard',
};
@@ -856,7 +858,7 @@ describe('RegistrationPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: `?next=/dashboard&tpa_hint=${ssoProvider.id}` };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: `?next=/dashboard&tpa_hint=${ssoProvider.id}` };
ssoProvider.iconImage = null;
const registrationPage = mount(reduxWrapper());
@@ -864,6 +866,27 @@ describe('RegistrationPage', () => {
expect(registrationPage.find(`button#${ssoProvider.id}`).hasClass(`btn-tpa btn-${ssoProvider.id}`)).toEqual(true);
});
+ it('should render icon if icon classes are missing in providers', () => {
+ ssoProvider.iconClass = null;
+ store = mockStore({
+ ...initialState,
+ commonComponents: {
+ ...initialState.commonComponents,
+ thirdPartyAuthContext: {
+ ...initialState.commonComponents.thirdPartyAuthContext,
+ providers: [ssoProvider],
+ },
+ thirdPartyAuthApiStatus: COMPLETE_STATE,
+ },
+ });
+
+ delete window.location;
+ window.location = { href: getConfig().BASE_URL.concat(REGISTER_PAGE), search: `?next=/dashboard&tpa_hint=${ssoProvider.id}` };
+
+ const registrationPage = mount(reduxWrapper());
+ expect(registrationPage.find(`button#${ssoProvider.id}`).find('div').find('span').hasClass('pgn__icon')).toEqual(true);
+ });
+
it('should render tpa button for tpa_hint id matching one of the secondary providers', () => {
secondaryProviders.skipHintedLogin = true;
store = mockStore({
@@ -879,7 +902,7 @@ describe('RegistrationPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/register'), search: `?next=/dashboard&tpa_hint=${secondaryProviders.id}` };
+ window.location = { href: getConfig().BASE_URL.concat(REGISTER_PAGE), search: `?next=/dashboard&tpa_hint=${secondaryProviders.id}` };
secondaryProviders.iconImage = null;
mount(reduxWrapper());
@@ -901,7 +924,7 @@ describe('RegistrationPage', () => {
});
delete window.location;
- window.location = { href: getConfig().BASE_URL.concat('/login'), search: '?next=/dashboard&tpa_hint=invalid' };
+ window.location = { href: getConfig().BASE_URL.concat(LOGIN_PAGE), search: '?next=/dashboard&tpa_hint=invalid' };
ssoProvider.iconImage = null;
const registrationPage = mount(reduxWrapper());