Skip to content

Commit

Permalink
fix: a few typos (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
leangseu-edx authored Jan 31, 2024
1 parent 69e090e commit 513d3fc
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 97 deletions.
4 changes: 2 additions & 2 deletions src/ExperimentContext.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('experiments context', () => {
it('calls useEffect once', () => {
expect(calls.length).toEqual(1);
});
describe('successfull fetch', () => {
describe('successful fetch', () => {
it('sets the country code', async () => {
let resolveFn;
api.fetchRecommendationsContext.mockReturnValueOnce(
Expand All @@ -57,7 +57,7 @@ describe('experiments context', () => {
});
});
});
describe('unsuccessfull fetch', () => {
describe('unsuccessful fetch', () => {
it('sets the country code to an empty string', async () => {
let rejectFn;
api.fetchRecommendationsContext.mockReturnValueOnce(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ export const RelatedProgramsBanner = ({ cardId }) => {

const programData = reduxHooks.useCardRelatedProgramsData(cardId);

if (!programData?.length) {
return null;
}

return (
programData?.length > 0 && (
<Banner
icon={Program}
className="bg-white border-top border-bottom mb-0 related-programs-banner"
>
<span className="font-weight-bolder">{formatMessage(messages.relatedPrograms)}</span>
<ProgramList programs={programData.list} />
</Banner>
)
<Banner
icon={Program}
className="bg-white border-top border-bottom mb-0 related-programs-banner"
>
<span className="font-weight-bolder">
{formatMessage(messages.relatedPrograms)}
</span>
<ProgramList programs={programData.list} />
</Banner>
);
};
RelatedProgramsBanner.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import useRelatedProgramsBadgeData from './hooks';

export const RelatedProgramsBadge = ({ cardId }) => {
const {
isOpen,
openModal,
closeModal,
numPrograms,
programsMessage,
isOpen, openModal, closeModal, numPrograms, programsMessage,
} = useRelatedProgramsBadgeData({ cardId });
return (numPrograms > 0) && (

if (numPrograms === 0) {
return null;
}

return (
<>
<Button
data-testid="RelatedProgramsBadge"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,80 +21,82 @@ export const CollapseMenuBody = ({ isOpen }) => {
const dashboard = reduxHooks.useEnterpriseDashboardData();
const { courseSearchUrl } = reduxHooks.usePlatformSettingsData();

const exploreCoursesClick = findCoursesNavDropdownClicked(urls.baseAppUrl(courseSearchUrl));
const exploreCoursesClick = findCoursesNavDropdownClicked(
urls.baseAppUrl(courseSearchUrl),
);

if (!isOpen) {
return null;
}

return (
isOpen && (
<div className="d-flex flex-column shadow-sm nav-small-menu">
<Button as="a" href="/" variant="inverse-primary">
{formatMessage(messages.course)}
</Button>
<Button as="a" href={urls.programsUrl} variant="inverse-primary">
{formatMessage(messages.program)}
</Button>
<Button
as="a"
href={urls.baseAppUrl(courseSearchUrl)}
variant="inverse-primary"
onClick={exploreCoursesClick}
>
{formatMessage(messages.discoverNew)}
</Button>
<WidgetNavbar placement={COLLAPSED_NAVBAR} />
<Button as="a" href={getConfig().SUPPORT_URL} variant="inverse-primary">
{formatMessage(messages.help)}
</Button>
{authenticatedUser && (
<>
{!!dashboard && (
<Button as="a" href={dashboard.url} variant="inverse-primary">
{formatMessage(messages.dashboard)}
</Button>
)}
{!dashboard && getConfig().CAREER_LINK_URL && (
<Button href={`${getConfig().CAREER_LINK_URL}`}>
{formatMessage(messages.career)}
<Badge className="px-2 mx-2" variant="warning">
{formatMessage(messages.newAlert)}
</Badge>
</Button>
)}
<Button
as="a"
href={`${getConfig().LMS_BASE_URL}/u/${
authenticatedUser.username
}`}
variant="inverse-primary"
>
{formatMessage(messages.profile)}
<div className="d-flex flex-column shadow-sm nav-small-menu">
<Button as="a" href="/" variant="inverse-primary">
{formatMessage(messages.course)}
</Button>
<Button as="a" href={urls.programsUrl} variant="inverse-primary">
{formatMessage(messages.program)}
</Button>
<Button
as="a"
href={urls.baseAppUrl(courseSearchUrl)}
variant="inverse-primary"
onClick={exploreCoursesClick}
>
{formatMessage(messages.discoverNew)}
</Button>
<WidgetNavbar placement={COLLAPSED_NAVBAR} />
<Button as="a" href={getConfig().SUPPORT_URL} variant="inverse-primary">
{formatMessage(messages.help)}
</Button>
{authenticatedUser && (
<>
{!!dashboard && (
<Button as="a" href={dashboard.url} variant="inverse-primary">
{formatMessage(messages.dashboard)}
</Button>
<Button
as="a"
href={`${getConfig().LMS_BASE_URL}/account/settings`}
variant="inverse-primary"
>
{formatMessage(messages.account)}
)}
{!dashboard && getConfig().CAREER_LINK_URL && (
<Button href={`${getConfig().CAREER_LINK_URL}`}>
{formatMessage(messages.career)}
<Badge className="px-2 mx-2" variant="warning">
{formatMessage(messages.newAlert)}
</Badge>
</Button>
{getConfig().ORDER_HISTORY_URL && (
<Button
as="a"
variant="inverse-primary"
href={getConfig().ORDER_HISTORY_URL}
>
{formatMessage(messages.orderHistory)}
</Button>
)}
)}
<Button
as="a"
href={`${getConfig().LMS_BASE_URL}/u/${authenticatedUser.username}`}
variant="inverse-primary"
>
{formatMessage(messages.profile)}
</Button>
<Button
as="a"
href={`${getConfig().LMS_BASE_URL}/account/settings`}
variant="inverse-primary"
>
{formatMessage(messages.account)}
</Button>
{getConfig().ORDER_HISTORY_URL && (
<Button
as="a"
href={getConfig().LOGOUT_URL}
variant="inverse-primary"
href={getConfig().ORDER_HISTORY_URL}
>
{formatMessage(messages.signOut)}
{formatMessage(messages.orderHistory)}
</Button>
</>
)}
</div>
)
)}
<Button
as="a"
href={getConfig().LOGOUT_URL}
variant="inverse-primary"
>
{formatMessage(messages.signOut)}
</Button>
</>
)}
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exports[`CollapseMenuBody render 1`] = `
</div>
`;

exports[`CollapseMenuBody render empty if not open 1`] = `false`;
exports[`CollapseMenuBody render empty if not open 1`] = `null`;

exports[`CollapseMenuBody render unauthenticated 1`] = `
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exports[`ConfirmEmailBanner snapshot Show on unverified 1`] = `
<p
className="text-center"
>
We've sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning.
We've sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.
</p>
</MarketingModal>
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const messages = defineMessages({
confirmEmailModalBody: {
id: 'leanerDashboard.confirmEmailModalBody',
description: 'text hint for confirming email modal',
defaultMessage: 'We\'ve sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning.',
defaultMessage: 'We\'ve sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.',
},
confirmEmailImageAlt: {
id: 'leanerDashboard.confirmEmailImageAlt',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ exports[`ExpandedHeader render 1`] = `
</header>
`;

exports[`ExpandedHeader render empty if collapsed 1`] = `false`;
exports[`ExpandedHeader render empty if collapsed 1`] = `null`;
10 changes: 7 additions & 3 deletions src/containers/LearnerDashboardHeader/ExpandedHeader/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ export const ExpandedHeader = () => {
const { courseSearchUrl } = reduxHooks.usePlatformSettingsData();
const isCollapsed = useIsCollapsed();

const exploreCoursesClick = findCoursesNavClicked(urls.baseAppUrl(courseSearchUrl));
const exploreCoursesClick = findCoursesNavClicked(
urls.baseAppUrl(courseSearchUrl),
);

if (isCollapsed) {
return null;
}

return (
!isCollapsed && (
<header className="d-flex shadow-sm align-items-center learner-variant-header pl-4">
<div className="flex-grow-1 d-flex align-items-center">
<BrandLogo />
Expand Down Expand Up @@ -66,7 +71,6 @@ export const ExpandedHeader = () => {

<AuthenticatedUserDropdown />
</header>
)
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/i18n/messages/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"leanerDashboard.confirmEmailTextReminderBanner": "Remember to confirm your email so that you can keep learning on edX! {confirmNowButton}.",
"leanerDashboard.verifiedConfirmEmailButton": "I've confirmed my email",
"leanerDashboard.confirmEmailModalHeader": "Confirm your email",
"leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning.",
"leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.",
"leanerDashboard.confirmEmailImageAlt": "confirm email background",
"learnerVariantDashboard.menu.dashboard.label": "Painel de controle",
"learnerVariantDashboard.help.label": "Ajuda",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/messages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"leanerDashboard.confirmEmailTextReminderBanner": "Remember to confirm your email so that you can keep learning on edX! {confirmNowButton}.",
"leanerDashboard.verifiedConfirmEmailButton": "I've confirmed my email",
"leanerDashboard.confirmEmailModalHeader": "Confirm your email",
"leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your acccount. Please check your inbox and click on the big red button to confirm and keep learning.",
"leanerDashboard.confirmEmailModalBody": "We've sent you an email to verify your account. Please check your inbox and click on the big red button to confirm and keep learning.",
"leanerDashboard.confirmEmailImageAlt": "confirm email background",
"learnerVariantDashboard.menu.dashboard.label": "Dashboard",
"learnerVariantDashboard.help.label": "Help",
Expand Down
12 changes: 6 additions & 6 deletions src/widgets/ProductRecommendations/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('ProductRecommendations', () => {
hasFailed: false,
};

const successfullLoadValues = {
const successfulLoadValues = {
...defaultValues,
isLoaded: true,
productRecommendations: mockCrossProductResponse,
Expand All @@ -42,7 +42,7 @@ describe('ProductRecommendations', () => {
it('matches snapshot', () => {
hooks.useIsMobile.mockReturnValueOnce(false);
hooks.useProductRecommendationsData.mockReturnValueOnce({
...successfullLoadValues,
...successfulLoadValues,
});

expect(shallow(<ProductRecommendations />).snapshot).toMatchSnapshot();
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('ProductRecommendations', () => {
it('renders nothing if the user is on the mobile view', () => {
hooks.useIsMobile.mockReturnValueOnce(true);
hooks.useProductRecommendationsData.mockReturnValueOnce({
...successfullLoadValues,
...successfulLoadValues,
});

const wrapper = shallow(<ProductRecommendations />);
Expand All @@ -84,7 +84,7 @@ describe('ProductRecommendations', () => {
it('renders NoCoursesView if the request is loaded, user has courses, and the response is empty', () => {
hooks.useIsMobile.mockReturnValueOnce(false);
hooks.useProductRecommendationsData.mockReturnValueOnce({
...successfullLoadValues,
...successfulLoadValues,
productRecommendations: {
amplitudeCourses: [],
crossProductCourses: [],
Expand All @@ -100,7 +100,7 @@ describe('ProductRecommendations', () => {
it('renders with cross product data if the request completed and the user has courses', () => {
hooks.useIsMobile.mockReturnValueOnce(false);
hooks.useProductRecommendationsData.mockReturnValueOnce({
...successfullLoadValues,
...successfulLoadValues,
});

expect({ ...shallow(<ProductRecommendations />).shallowWrapper, children: expect.any(Array) }).toMatchObject(
Expand All @@ -116,7 +116,7 @@ describe('ProductRecommendations', () => {
it('renders the LoadedView with Amplitude course data if the request completed', () => {
hooks.useIsMobile.mockReturnValueOnce(false);
hooks.useProductRecommendationsData.mockReturnValueOnce({
...successfullLoadValues,
...successfulLoadValues,
productRecommendations: mockAmplitudeResponse,
});

Expand Down

0 comments on commit 513d3fc

Please sign in to comment.