Skip to content

Commit

Permalink
exam card fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
annagav committed Feb 4, 2021
1 parent 29a36e3 commit 566059f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 40 deletions.
21 changes: 11 additions & 10 deletions static/js/components/dashboard/FinalExamCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,33 @@ import type { Program } from "../../flow/programTypes"
import type { UIState } from "../../reducers/ui"

type Props = {
profile: Profile,
program: Program,
ui: UIState,
program: Program
}

export default class FinalExamCard extends React.Component<void, Props, void> {
render() {
const { program } = this.props
if (program.exam_card_status === "") return null

return (
<Card className="card final-exam-card">
<CardContent>
<div className="card-header">
<div>
<img className="exam-icon" src="/static/images/exam_icon.png"/>
<img className="exam-icon" src="/static/images/exam_icon.png" />
</div>
<div className="exam-text">
<h2>Final Proctored Exam</h2>
<p>
To earn a certificate, you must take an online proctored exam
for each course. Before you can take a proctored exam, you
have to pay for the course and pass the online work.
for each course. Before you can take a proctored exam, you have
to pay for the course and pass the online work.
</p>
<p>
Exams will be available online on edX.org. You may take the
exam at any time during the exam period. No advance scheduling
is required, but you should verify your account and complete
the exam onboarding during the one week onboarding period.
Exams will be available online on edX.org. You may take the exam
at any time during the exam period. No advance scheduling is
required, but you should verify your account and complete the
exam onboarding during the one week onboarding period.
</p>
</div>
</div>
Expand Down
27 changes: 9 additions & 18 deletions static/js/components/dashboard/FinalExamCard_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ import React from "react"
import { mount } from "enzyme"
import { assert } from "chai"
import sinon from "sinon"
import IconButton from "@material-ui/core/IconButton"
import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles"

import FinalExamCard from "./FinalExamCard"
import { DASHBOARD_RESPONSE, USER_PROFILE_RESPONSE } from "../../test_constants"
import {
PEARSON_PROFILE_ABSENT,
} from "../../constants"
import { PEARSON_PROFILE_ABSENT } from "../../constants"
import { INITIAL_UI_STATE } from "../../reducers/ui"
import { stringStrip, getEl } from "../../util/test_utils"
import type { Program } from "../../flow/programTypes"
Expand All @@ -27,40 +24,34 @@ describe("FinalExamCard", () => {
sandbox = sinon.sandbox.create()
const program: Program = (_.cloneDeep(
DASHBOARD_RESPONSE.programs.find(
program => program.pearson_exam_status !== undefined
program => program.exam_card_status !== undefined
)
): any)
props = {
profile: profile,
program: program,
ui: { ...INITIAL_UI_STATE },
profile: profile,
program: program,
ui: { ...INITIAL_UI_STATE }
}
})

const commonText = `You must take a proctored exam for each course. Exams may
be taken at any authorized Pearson test center. Before you can take an exam, you have to
pay for the course and pass the online work.`
const commonText = `To earn a certificate, you must take an online proctored exam for each
course. Before you can take a proctored exam, you have to pay for the course and pass the online work.`

const getDialog = () => document.querySelector(".dialog-to-pearson-site")
const renderCard = props =>
mount(
<MuiThemeProvider theme={createMuiTheme()}>
<FinalExamCard {...props} />
</MuiThemeProvider>
)

it("should not render when pearson_exam_status is empty", () => {
it("should not render when exam_card_status is empty", () => {
const card = renderCard(props)
assert.equal(card.html(), "")
})

it("should just show a basic message if the profile is absent", () => {
props.program.pearson_exam_status = PEARSON_PROFILE_ABSENT
props.program.exam_card_status = PEARSON_PROFILE_ABSENT
const card = renderCard(props)
assert.include(stringStrip(card.text()), stringStrip(commonText))
assert.notInclude(
stringStrip(card.text()),
"Your Pearson Testing account has been created"
)
})
})
2 changes: 1 addition & 1 deletion static/js/factories/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const makeProgram = (): Program => {
min_possible_cost: 1000,
id: newFinancialAidId()
},
pearson_exam_status:
exam_card_status:
PEARSON_STATUSES[Math.floor(Math.random() * PEARSON_STATUSES.length)],
grade_average: Math.floor(Math.random() * 100),
certificate: "",
Expand Down
2 changes: 1 addition & 1 deletion static/js/flow/programTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type Program = {
title: string,
financial_aid_availability: boolean,
financial_aid_user_info: FinancialAidUserInfo,
pearson_exam_status: string,
exam_card_status: string,
grade_average: ?number,
certificate: string,
grade_records_url: string,
Expand Down
12 changes: 6 additions & 6 deletions static/js/global_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ const _createSettings = () => ({
last_name: "Doe",
preferred_name: "JD"
},
edx_base_url: "/edx/",
search_url: "/",
roles: [],
support_email: "[email protected]",
es_page_size: 40,
FEATURES: {
edx_base_url: "/edx/",
search_url: "/",
roles: [],
support_email: "[email protected]",
es_page_size: 40,
FEATURES: {
PROGRAM_LEARNERS: true,
DISCUSSIONS_POST_UI: true,
DISCUSSIONS_CREATE_CHANNEL_UI: true,
Expand Down
8 changes: 4 additions & 4 deletions static/js/test_constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -1280,10 +1280,10 @@ export const DASHBOARD_RESPONSE: Dashboard = deepFreeze({
id: 2
},
{
title: "Last program",
description: "The last program",
pearson_exam_status: "",
courses: [
title: "Last program",
description: "The last program",
exam_card_status: "",
courses: [
{
id: 13,
position_in_program: 0,
Expand Down

0 comments on commit 566059f

Please sign in to comment.