Skip to content

Commit

Permalink
fix: replace Field.Email reference for Field.Text
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa authored and arbrandes committed Sep 25, 2023
1 parent 247e9f3 commit 1c70458
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/GradesView/GradebookTable/GradeButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const useGradeButtonData = ({ entry, subsection }) => {
const areGradesFrozen = selectors.assignmentTypes.useAreGradesFrozen();
const { gradeFormat } = selectors.grades.useGradeData();
const setModalState = thunkActions.app.useSetModalStateFromTable();
const label = transforms.grades.subsectionGrade({ gradeFormat, subsection });
const label = transforms.grades.subsectionGrade({ gradeFormat, subsection })();

const onClick = () => {
setModalState({
Expand Down
4 changes: 2 additions & 2 deletions src/components/GradesView/GradebookTable/GradeButton.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const props = {
};
const gradeFormat = 'percent';
const setModalState = jest.fn();
const subsectionGrade = 'test-subsection-grade';
const subsectionGrade = () => 'test-subsection-grade';
selectors.assignmentTypes.useAreGradesFrozen.mockReturnValue(false);
selectors.grades.useGradeData.mockReturnValue({ gradeFormat });
thunkActions.app.useSetModalStateFromTable.mockReturnValue(setModalState);
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('GradeButton', () => {
expect(out.areGradesFrozen).toEqual(false);
});
test('label passed from subsection grade redux hook', () => {
expect(out.label).toEqual(subsectionGrade);
expect(out.label).toEqual(subsectionGrade());
});
test('onClick sets modal state with user entry and subsection', () => {
out.onClick();
Expand Down
2 changes: 1 addition & 1 deletion src/components/GradesView/GradebookTable/hooks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const useGradebookTableData = () => {
[Headings.username]: (
<Fields.Username username={entry.username} userKey={entry.external_user_key} />
),
[Headings.email]: (<Fields.Email email={entry.email} />),
[Headings.email]: (<Fields.Text value={entry.email} />),
[Headings.totalGrade]: `${roundGrade(entry.percent * 100)}${getLocalizedPercentSign()}`,
...entry.section_breakdown.reduce((acc, subsection) => ({
...acc,
Expand Down
4 changes: 2 additions & 2 deletions src/components/GradesView/GradebookTable/hooks.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jest.mock('i18n/utils', () => ({
jest.mock('./GradeButton', () => 'GradeButton');
jest.mock('./Fields', () => jest.requireActual('testUtils').mockNestedComponents({
Username: 'Fields.Username',
Email: 'Fields.Email',
Text: 'Fields.Text',
}));
jest.mock('./LabelReplacements', () => jest.requireActual('testUtils').mockNestedComponents({
TotalGradeLabelReplacement: 'LabelReplacements.TotalGradeLabelReplacement',
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('useGradebookTableData', () => {
test('email field', () => {
allGrades.forEach((entry, index) => {
expect(out.data[index][Headings.email]).toMatchObject(
<Fields.Email email={entry.email} />,
<Fields.Text value={entry.email} />,
);
});
});
Expand Down

0 comments on commit 1c70458

Please sign in to comment.