Skip to content

Commit 1301fdd

Browse files
authored
Audit usage of header elements in Learner Dashboard (#618)
2 parents 14c03d8 + 5dcd596 commit 1301fdd

File tree

8 files changed

+45
-27
lines changed

8 files changed

+45
-27
lines changed

src/containers/CoursesPanel/NoCoursesView/__snapshots__/index.test.jsx.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ exports[`NoCoursesView snapshot 1`] = `
99
alt="No Courses view banner"
1010
src="icon/mock/path"
1111
/>
12-
<h1>
12+
<h3
13+
className="h1"
14+
>
1315
Looking for a new challenge?
14-
</h1>
16+
</h3>
1517
<p>
1618
Explore our courses to add them to your dashboard.
1719
</p>

src/containers/CoursesPanel/NoCoursesView/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export const NoCoursesView = () => {
1919
className="d-flex align-items-center justify-content-center mb-4.5"
2020
>
2121
<Image src={emptyCourseSVG} alt={formatMessage(messages.bannerAlt)} />
22-
<h1>
22+
<h3 className="h1">
2323
{formatMessage(messages.lookingForChallengePrompt)}
24-
</h1>
24+
</h3>
2525
<p>
2626
{formatMessage(messages.exploreCoursesPrompt)}
2727
</p>

src/containers/Dashboard/DashboardLayout.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ export const DashboardLayout = ({ children }) => {
4040
<Col {...courseListColumnProps} className="course-list-column">
4141
{children}
4242
</Col>
43-
<Col {...columnConfig.sidebar} className="sidebar-column">
44-
{!isCollapsed && (<h2 className="course-list-title">&nbsp;</h2>)}
43+
<Col {...columnConfig.sidebar} className={['sidebar-column', !isCollapsed && 'not-collapsed']}>
4544
<WidgetSidebarSlot />
4645
</Col>
4746
</Row>

src/containers/Dashboard/DashboardLayout.test.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ describe('DashboardLayout', () => {
8484

8585
describe('not collapsed', () => {
8686
const testWidgetSpacing = () => {
87-
it('shows a blank (nbsp) h2 spacer component above widget sidebar', () => {
87+
it('shows not-collapsed class on widget sidebar', () => {
8888
const columns = el.instance.findByType(Col);
89-
// nonbreaking space equivalent
90-
expect(columns[1].findByType('h2')[0].children[0].el).toEqual('\xA0');
89+
expect(columns[1].props.className).toContain('not-collapsed');
9190
});
9291
};
9392
describe('sidebar showing', () => {

src/containers/Dashboard/__snapshots__/DashboardLayout.test.jsx.snap

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ exports[`DashboardLayout collapsed sidebar not showing snapshot 1`] = `
2424
test-children
2525
</Col>
2626
<Col
27-
className="sidebar-column"
27+
className={
28+
[
29+
"sidebar-column",
30+
false,
31+
]
32+
}
2833
lg={
2934
{
3035
"offset": 0,
@@ -68,7 +73,12 @@ exports[`DashboardLayout collapsed sidebar showing snapshot 1`] = `
6873
test-children
6974
</Col>
7075
<Col
71-
className="sidebar-column"
76+
className={
77+
[
78+
"sidebar-column",
79+
false,
80+
]
81+
}
7282
lg={
7383
{
7484
"offset": 0,
@@ -112,7 +122,12 @@ exports[`DashboardLayout not collapsed sidebar not showing snapshot 1`] = `
112122
test-children
113123
</Col>
114124
<Col
115-
className="sidebar-column"
125+
className={
126+
[
127+
"sidebar-column",
128+
"not-collapsed",
129+
]
130+
}
116131
lg={
117132
{
118133
"offset": 0,
@@ -126,11 +141,6 @@ exports[`DashboardLayout not collapsed sidebar not showing snapshot 1`] = `
126141
}
127142
}
128143
>
129-
<h2
130-
className="course-list-title"
131-
>
132-
 
133-
</h2>
134144
<WidgetSidebarSlot />
135145
</Col>
136146
</Row>
@@ -161,7 +171,12 @@ exports[`DashboardLayout not collapsed sidebar showing snapshot 1`] = `
161171
test-children
162172
</Col>
163173
<Col
164-
className="sidebar-column"
174+
className={
175+
[
176+
"sidebar-column",
177+
"not-collapsed",
178+
]
179+
}
165180
lg={
166181
{
167182
"offset": 0,
@@ -175,11 +190,6 @@ exports[`DashboardLayout not collapsed sidebar showing snapshot 1`] = `
175190
}
176191
}
177192
>
178-
<h2
179-
className="course-list-title"
180-
>
181-
 
182-
</h2>
183193
<WidgetSidebarSlot />
184194
</Col>
185195
</Row>

src/containers/Dashboard/index.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
.sidebar-column {
88
padding: 0 map-get($spacers, 3) 0 map-get($spacers, 1);
9+
10+
&.not-collapsed {
11+
padding-top: map-get($spacers, 2);
12+
13+
& >:first-child {
14+
margin-top: map-get($spacers, 5\.5);
15+
}
16+
}
917
}
1018

1119
@include media-breakpoint-down(lg) {

src/containers/LearnerDashboardHeader/ConfirmEmailBanner/__snapshots__/index.test.jsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ exports[`ConfirmEmailBanner snapshot Show on unverified 1`] = `
5555
onClose={[MockFunction closeConfirmModal]}
5656
title=""
5757
>
58-
<h1
59-
className="text-center p-3"
58+
<h2
59+
className="text-center p-3 h1"
6060
>
6161
Confirm your email
62-
</h1>
62+
</h2>
6363
<p
6464
className="text-center"
6565
>

src/containers/LearnerDashboardHeader/ConfirmEmailBanner/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const ConfirmEmailBanner = () => {
6464
</Button>
6565
)}
6666
>
67-
<h1 className="text-center p-3">{formatMessage(messages.confirmEmailModalHeader)}</h1>
67+
<h2 className="text-center p-3 h1">{formatMessage(messages.confirmEmailModalHeader)}</h2>
6868
<p className="text-center">{formatMessage(messages.confirmEmailModalBody)}</p>
6969
</MarketingModal>
7070
</>

0 commit comments

Comments
 (0)