Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace Field.Email reference for Field.Text #345

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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