Skip to content

Commit 679caa6

Browse files
authored
feat: Update link styling (#1631)
1 parent 4200609 commit 679caa6

File tree

6 files changed

+39
-14
lines changed

6 files changed

+39
-14
lines changed

src/courseware/course/course-license/CourseLicense.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ const CourseLicense = ({
134134
</span>
135135
))}
136136
{intl.formatMessage(messages['learn.course.license.creativeCommons.text'])}
137+
<span className="sr-only">
138+
{intl.formatMessage(messages['learn.course.license.creativeCommons.externalSite.screenreaderOnly.message'])}
139+
</span>
137140
</a>
138141
);
139142

src/courseware/course/course-license/messages.ts

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ const messages = defineMessages({
4242
defaultMessage: 'Some Rights Reserved',
4343
description: 'License text shown when using all Creative Commons license types.',
4444
},
45+
'learn.course.license.creativeCommons.externalSite.screenreaderOnly.message': {
46+
id: 'learn.course.license.creativeCommons.externalSite.screenreaderOnly.message',
47+
defaultMessage: 'external site, in a new tab',
48+
description: 'Screenreader only text for external site link',
49+
},
4550
});
4651

4752
export default messages;

src/generic/upgrade-notification/UpgradeNotification.jsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import classNames from 'classnames';
44
import { useIntl, FormattedDate, FormattedMessage } from '@edx/frontend-platform/i18n';
55
import { sendTrackEvent, sendTrackingLogEvent } from '@edx/frontend-platform/analytics';
66
import { Button, Icon, IconButton } from '@openedx/paragon';
7-
import { Close } from '@openedx/paragon/icons';
7+
import { Close, Launch } from '@openedx/paragon/icons';
88
import { setLocalStorage } from '../../data/localStorage';
99
import { UpgradeButton } from '../upgrade-button';
1010
import {
@@ -57,6 +57,17 @@ const UpsellFBESoonCardContent = ({ accessExpirationDate, timezoneFormatArgs })
5757
id="learning.generic.upgradeNotification.expirationVerifiedCert.benefits"
5858
defaultMessage="benefits of upgrading"
5959
/>
60+
<span
61+
className="pgn__hyperlink__external-icon"
62+
title="Opens in a new tab"
63+
>
64+
<Icon
65+
src={Launch}
66+
screenReaderText=" in a new tab"
67+
style={{ height: '1em', width: '1em' }}
68+
data-testid="hyperlink-icon"
69+
/>
70+
</span>
6071
</a>
6172
);
6273

src/generic/upgrade-notification/UpgradeNotification.test.jsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('Upgrade Notification', () => {
5050
it('renders non-FBE when there is a verified mode but no FBE', async () => {
5151
buildAndRender();
5252
expect(screen.getByRole('heading', { name: 'Pursue a verified certificate' })).toBeInTheDocument();
53-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
53+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
5454
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
5555
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
5656
});
@@ -64,7 +64,7 @@ describe('Upgrade Notification', () => {
6464
},
6565
});
6666
expect(screen.getByRole('heading', { name: 'Pursue a verified certificate' })).toBeInTheDocument();
67-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
67+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
6868
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
6969
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
7070
});
@@ -75,7 +75,7 @@ describe('Upgrade Notification', () => {
7575
accessExpiration: null,
7676
});
7777
expect(screen.getByRole('heading', { name: 'Pursue a verified certificate' })).toBeInTheDocument();
78-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
78+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
7979
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
8080
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
8181
});
@@ -94,7 +94,7 @@ describe('Upgrade Notification', () => {
9494
},
9595
});
9696
expect(screen.getByRole('heading', { name: 'Pursue a verified certificate' })).toBeInTheDocument();
97-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
97+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
9898
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
9999
expect(screen.getByText(/Upgrade for/).textContent).toMatch('$126.65 ($149)');
100100
expect(screen.getByText(/Use code.*?at checkout/s).textContent).toMatch('Use code Welcome15 at checkout');
@@ -112,7 +112,7 @@ describe('Upgrade Notification', () => {
112112
expect(screen.getByRole('heading', { name: 'Course Access Expiration' })).toBeInTheDocument();
113113
expect(screen.getByText('Less than 1 hour left')).toBeInTheDocument();
114114
expect(screen.getByText(/You will lose all access to this course.*?on/s).textContent).toMatch('You will lose all access to this course, including any progress, on April 13.');
115-
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading.');
115+
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading in a new tab.');
116116
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
117117
});
118118

@@ -128,7 +128,7 @@ describe('Upgrade Notification', () => {
128128
expect(screen.getByRole('heading', { name: 'Course Access Expiration' })).toBeInTheDocument();
129129
expect(screen.getByText('12 hours left')).toBeInTheDocument();
130130
expect(screen.getByText(/You will lose all access to this course.*?on/s)).toHaveTextContent('You will lose all access to this course, including any progress, on April 13.');
131-
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading.');
131+
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading in a new tab.');
132132
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
133133
});
134134

@@ -144,7 +144,7 @@ describe('Upgrade Notification', () => {
144144
expect(screen.getByRole('heading', { name: 'Course Access Expiration' })).toBeInTheDocument();
145145
expect(screen.getByText('6 days left')).toBeInTheDocument(); // setting the time to 12 will mean that it's slightly less than 12
146146
expect(screen.getByText(/You will lose all access to this course.*?on/s).textContent).toMatch('You will lose all access to this course, including any progress, on April 19.');
147-
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading.');
147+
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading in a new tab.');
148148
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
149149
});
150150

@@ -159,7 +159,7 @@ describe('Upgrade Notification', () => {
159159
});
160160
expect(screen.getByRole('heading', { name: 'Upgrade your course today' })).toBeInTheDocument();
161161
expect(screen.getByText(/Course access will expire/s).textContent).toMatch('Course access will expire April 27');
162-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
162+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
163163
expect(screen.getByText(/Unlock your access/s).textContent).toMatch('Unlock your access to all course activities, including graded assignments');
164164
expect(screen.getByText(/to course content and materials/s).textContent).toMatch('Full access to course content and materials, even after the course ends');
165165
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
@@ -187,7 +187,7 @@ describe('Upgrade Notification', () => {
187187
});
188188
expect(screen.getByRole('heading', { name: '15% First-Time Learner Discount' })).toBeInTheDocument();
189189
expect(screen.getByText('Less than 1 hour left')).toBeInTheDocument();
190-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
190+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
191191
expect(screen.getByText(/Unlock your access/s).textContent).toMatch('Unlock your access to all course activities, including graded assignments');
192192
expect(screen.getByText(/to course content and materials/s).textContent).toMatch('Full access to course content and materials, even after the course ends');
193193
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
@@ -216,7 +216,7 @@ describe('Upgrade Notification', () => {
216216
});
217217
expect(screen.getByRole('heading', { name: '15% First-Time Learner Discount' })).toBeInTheDocument();
218218
expect(screen.getByText(/hours left/s).textContent).toMatch('12 hours left');
219-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
219+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
220220
expect(screen.getByText(/Unlock your access/s).textContent).toMatch('Unlock your access to all course activities, including graded assignments');
221221
expect(screen.getByText(/to course content and materials/s).textContent).toMatch('Full access to course content and materials, even after the course ends');
222222
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
@@ -245,7 +245,7 @@ describe('Upgrade Notification', () => {
245245
});
246246
expect(screen.getByRole('heading', { name: '15% First-Time Learner Discount' })).toBeInTheDocument();
247247
expect(screen.getByText(/days left/s).textContent).toMatch('6 days left');
248-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
248+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
249249
expect(screen.getByText(/Unlock your access/s).textContent).toMatch('Unlock your access to all course activities, including graded assignments');
250250
expect(screen.getByText(/to course content and materials/s).textContent).toMatch('Full access to course content and materials, even after the course ends');
251251
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');
@@ -275,7 +275,7 @@ describe('Upgrade Notification', () => {
275275
expect(screen.getByRole('heading', { name: 'Course Access Expiration' })).toBeInTheDocument();
276276
expect(screen.getByText('5 days left')).toBeInTheDocument(); // setting the time to 12 will mean that it's slightly less than 12
277277
expect(screen.getByText(/You will lose all access to this course.*?on/s).textContent).toMatch('You will lose all access to this course, including any progress, on April 18.');
278-
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading.');
278+
expect(screen.getByText(/Upgrading your course enables you/s).textContent).toMatch('Upgrading your course enables you to pursue a verified certificate and unlocks numerous features. Learn more about the benefits of upgrading in a new tab.');
279279
expect(screen.getByText(/Upgrade for/).textContent).toMatch('$126.65 ($149)');
280280
expect(screen.getByText(/Use code.*?at checkout/s).textContent).toMatch('Use code Welcome15 at checkout');
281281
});

src/generic/upsell-bullets/UpsellBullets.jsx

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export const VerifiedCertBullet = () => {
1717
defaultMessage="verified certificate"
1818
description="Bolded words 'verified certificate', which is the name of credential the learner receives."
1919
/>
20+
<span className="sr-only">
21+
<FormattedMessage
22+
id="learning.generic.upsell.verifiedCertBullet.verifiedCert.newTab.screenreaderOnly.message"
23+
defaultMessage=" (learn more in a new tab)"
24+
/>
25+
</span>
2026
</a>
2127
);
2228
return (

src/generic/upsell-bullets/UpsellBullets.test.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('UpsellBullets', () => {
2727

2828
it('upsell bullet text properly rendered', async () => {
2929
render(bullets);
30-
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate of completion to showcase on your resumé');
30+
expect(screen.getByText(/Earn a.*?of completion to showcase on your resumé/s).textContent).toMatch('Earn a verified certificate (learn more in a new tab) of completion to showcase on your resumé');
3131
expect(screen.getByText(/Unlock your access/s).textContent).toMatch('Unlock your access to all course activities, including graded assignments');
3232
expect(screen.getByText(/to course content and materials/s).textContent).toMatch('Full access to course content and materials, even after the course ends');
3333
expect(screen.getByText(/Support our.*?at edX/s).textContent).toMatch('Support our mission at edX');

0 commit comments

Comments
 (0)