Skip to content

Commit ad5844a

Browse files
committed
Fix tests due to style changes
1 parent 1736204 commit ad5844a

22 files changed

+13668
-16858
lines changed

csm_web/frontend/src/components/course/SectionCard.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,13 @@ export const SectionCard = ({
179179
MANAGE
180180
</Link>
181181
) : (
182-
<div
183-
className={`primary-btn section-card-footer ${courseOpen ? "" : "disabled"}`}
182+
<button
183+
className={`primary-btn section-card-footer`}
184+
disabled={!courseOpen || isFull}
184185
onClick={isFull ? undefined : enroll}
185186
>
186187
ENROLL
187-
</div>
188+
</button>
188189
)}
189190
</section>
190191
</React.Fragment>

csm_web/frontend/src/components/section/MentorSectionAttendance.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ const MentorSectionAttendance = ({ sectionId }: MentorSectionAttendanceProps): R
265265
</div>
266266
))}
267267
</div>
268-
<table id="csm-table mentor-attendance-table">
268+
<table className="csm-table" id="mentor-attendance-table">
269269
<tbody>
270270
{selectedOccurrence &&
271271
stagedAttendances.map(({ id, student, presence }) => {
@@ -322,7 +322,8 @@ const MentorSectionAttendance = ({ sectionId }: MentorSectionAttendanceProps): R
322322
<div className="word-of-the-day-action-container">
323323
<div className="word-of-the-day-input-container">
324324
<input
325-
className="word-of-the-day-input"
325+
className="form-input"
326+
name="word-of-the-day"
326327
type="text"
327328
placeholder="Word of the Day"
328329
value={wordOfTheDay}

csm_web/frontend/src/components/section/StudentSection.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ function StudentSectionAttendance({ associatedProfileId, id }: StudentSectionAtt
258258
<h3 className="word-of-the-day-title">Submit Word of the Day</h3>
259259
<div className="word-of-the-day-action-container">
260260
<div className="word-of-the-day-input-container">
261-
<select value={selectedAttendanceId} className="form-select" onChange={handleSelectedAttendanceIdChange}>
261+
<select
262+
value={selectedAttendanceId}
263+
className="form-select"
264+
name="word-of-the-day-date"
265+
onChange={handleSelectedAttendanceIdChange}
266+
>
262267
{attendances
263268
// only allow choosing from dates with blank attendances
264269
.filter(attendance => attendance.presence === "")
@@ -273,6 +278,7 @@ function StudentSectionAttendance({ associatedProfileId, id }: StudentSectionAtt
273278
</select>
274279
<input
275280
className="form-input"
281+
name="word-of-the-day"
276282
type="text"
277283
placeholder="Word of the Day"
278284
value={currentWord}

csm_web/frontend/src/css/base/form.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
border-radius: 6px;
3131

3232
box-sizing: content-box;
33+
font-family: inherit;
3334
}
3435

3536
.form-select:disabled,

csm_web/frontend/src/css/section.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,6 @@
434434
text-align: center;
435435
color: white;
436436
padding: 5px 10px;
437-
max-width: 200px;
437+
width: 200px;
438438
border-radius: 6px;
439439
}

csm_web/frontend/src/css/word-of-the-day.scss

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,6 @@
3030
gap: 8px;
3131
}
3232

33-
.word-of-the-day-input {
34-
border-radius: 6px;
35-
font-size: 14px;
36-
font-weight: 600;
37-
font-family: "Montserrat";
38-
border: none;
39-
background-color: #ededed;
40-
padding: 10px 20px;
41-
margin-right: 5px;
42-
}
43-
44-
.word-of-the-day-input::placeholder {
45-
opacity: 0.65;
46-
}
47-
4833
.word-of-the-day-status.unselected {
4934
color: $csm-danger;
5035
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Mock with no styles.
3+
*/
4+
5+
module.exports = {};

csm_web/frontend/src/tests/__snapshots__/Modal.test.tsx.snap

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ exports[`Modal should close correctly when an external modal closer is clicked 1
66
class="modal-overlay"
77
/>
88
<div
9-
class="modal test-modal"
9+
class="modal "
1010
>
1111
<div
12-
class="modal-contents"
12+
class="modal-close-container"
1313
>
14-
<div
14+
<button
15+
aria-label="close"
1516
class="modal-close-x"
1617
>
17-
<button
18-
aria-label="close"
19-
class="inline-plus-sign"
20-
>
21-
<span>
22-
×
23-
</span>
24-
</button>
25-
</div>
18+
<x-svg
19+
classname="icon"
20+
/>
21+
</button>
22+
</div>
23+
<div
24+
class="modal-contents test-modal"
25+
>
2626
<div>
2727
Hello World
2828
</div>
@@ -45,20 +45,20 @@ exports[`Modal should render correctly 1`] = `
4545
class="modal "
4646
>
4747
<div
48-
class="modal-contents"
48+
class="modal-close-container"
4949
>
50-
<div
50+
<button
51+
aria-label="close"
5152
class="modal-close-x"
5253
>
53-
<button
54-
aria-label="close"
55-
class="inline-plus-sign"
56-
>
57-
<span>
58-
×
59-
</span>
60-
</button>
61-
</div>
54+
<x-svg
55+
classname="icon"
56+
/>
57+
</button>
58+
</div>
59+
<div
60+
class="modal-contents "
61+
>
6262
<div>
6363
Hello World
6464
</div>
@@ -73,23 +73,23 @@ exports[`Modal should render correctly with className 1`] = `
7373
class="modal-overlay"
7474
/>
7575
<div
76-
class="modal test-modal"
76+
class="modal "
7777
>
7878
<div
79-
class="modal-contents"
79+
class="modal-close-container"
8080
>
81-
<div
81+
<button
82+
aria-label="close"
8283
class="modal-close-x"
8384
>
84-
<button
85-
aria-label="close"
86-
class="inline-plus-sign"
87-
>
88-
<span>
89-
×
90-
</span>
91-
</button>
92-
</div>
85+
<x-svg
86+
classname="icon"
87+
/>
88+
</button>
89+
</div>
90+
<div
91+
class="modal-contents test-modal"
92+
>
9393
<div>
9494
Hello World
9595
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Transform files to their path name.
3+
*/
4+
5+
/* eslint @typescript-eslint/no-var-requires: "off" */
6+
const path = require("path");
7+
8+
module.exports = {
9+
process(sourceText, sourcePath, options) {
10+
// convert path name to lowercase, and replace the "." with "-";
11+
// this circumvents errors relating to component naming
12+
const base = path.basename(sourcePath).toLowerCase().replace(".", "-");
13+
return {
14+
code: `module.exports = ${JSON.stringify(base)};`
15+
};
16+
}
17+
};

csm_web/frontend/src/tests/section/StudentDropper.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jest.mock("../../components/Modal", () => {
2222

2323
describe("StudentDropper", () => {
2424
it("should render correctly without interaction", () => {
25-
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" />, {
25+
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" courseRestricted={false} />, {
2626
wrapper: testQueryClientWrapper
2727
});
2828
expect(component.asFragment()).toMatchSnapshot();
2929
});
3030

3131
it("should render modal correctly after clicking x", () => {
32-
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" />, {
32+
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" courseRestricted={false} />, {
3333
wrapper: testQueryClientWrapper
3434
});
3535

@@ -42,7 +42,7 @@ describe("StudentDropper", () => {
4242
});
4343

4444
it("should close modal correctly", () => {
45-
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" />, {
45+
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" courseRestricted={false} />, {
4646
wrapper: testQueryClientWrapper
4747
});
4848

@@ -72,7 +72,7 @@ describe("StudentDropper", () => {
7272
return null as any;
7373
});
7474

75-
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" />, {
75+
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" courseRestricted={false} />, {
7676
wrapper: testQueryClientWrapper
7777
});
7878

@@ -129,7 +129,7 @@ describe("StudentDropper", () => {
129129
return null as any;
130130
});
131131

132-
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" />, {
132+
const component = render(<StudentDropper id={1} sectionId={2} name="Test Student" courseRestricted={false} />, {
133133
wrapper: testQueryClientWrapper
134134
});
135135

0 commit comments

Comments
 (0)