diff --git a/app/javascript/Components/Result/left_pane.jsx b/app/javascript/Components/Result/left_pane.jsx index a1825de9a6..177ae9ade8 100644 --- a/app/javascript/Components/Result/left_pane.jsx +++ b/app/javascript/Components/Result/left_pane.jsx @@ -9,7 +9,6 @@ import {SubmissionFilePanel} from "./submission_file_panel"; import {TestRunTable} from "../test_run_table"; import {ResultContext} from "./result_context"; - export class LeftPane extends React.Component { constructor(props) { super(props); @@ -69,7 +68,10 @@ export class LeftPane extends React.Component { render() { return ( - this.setState({tabIndex})}> + this.setState({tabIndex})} + > {I18n.t("activerecord.attributes.submission.submission_files")} {I18n.t("activerecord.models.annotation.other")} @@ -92,7 +94,9 @@ export class LeftPane extends React.Component { grouping_id={this.context.grouping_id} revision_identifier={this.props.revision_identifier} show_annotation_manager={!this.props.released_to_students} - canDownload={this.context.is_reviewer === undefined ? undefined : !this.context.is_reviewer} + canDownload={ + this.context.is_reviewer === undefined ? undefined : !this.context.is_reviewer + } fileData={this.props.submission_files} annotation_categories={this.props.annotation_categories} annotations={this.props.annotations} diff --git a/app/javascript/Components/__tests__/markdown_editor.test.jsx b/app/javascript/Components/__tests__/markdown_editor.test.jsx index 98ea166478..d9a45cf769 100644 --- a/app/javascript/Components/__tests__/markdown_editor.test.jsx +++ b/app/javascript/Components/__tests__/markdown_editor.test.jsx @@ -32,7 +32,11 @@ describe("MarkdownEditor", () => { }); it("should properly handle the text input change", async () => { - render(); + render( + + + + ); const inputBox = screen.getByRole("textbox"); await userEvent.type(inputBox, "Hello world"); @@ -43,7 +47,11 @@ describe("MarkdownEditor", () => { it("should show autocomplete if desired", async () => { props.show_autocomplete = true; props.annotation_text_id = "id"; - render(); + render( + + + + ); const autocompleteList = screen.queryByTestId("markdown-editor-autocomplete-root"); expect(autocompleteList).toBeTruthy(); @@ -51,7 +59,11 @@ describe("MarkdownEditor", () => { it("should properly display and pass down props to the preview tab", async () => { props.content = "arma virumque cano"; - render(); + render( + + + + ); await userEvent.click(screen.getByRole("tab", {name: "Preview"})); diff --git a/app/javascript/Components/__tests__/submission_selector.test.jsx b/app/javascript/Components/__tests__/submission_selector.test.jsx index a9e9098c93..95a5c06b18 100644 --- a/app/javascript/Components/__tests__/submission_selector.test.jsx +++ b/app/javascript/Components/__tests__/submission_selector.test.jsx @@ -71,12 +71,20 @@ describe("SubmissionSelector", () => { it("should not show anything if it is being viewed by a non-reviewer student", () => { const newContextValue = JSON.parse(JSON.stringify(contextValue)); newContextValue.role = "Student"; - render(); + render( + + + + ); expect(screen.queryByTestId("submission-selector-container")).toBeNull(); }); it("should call nextSubmission when the next-button is pressed", () => { - render(); + render( + + + + ); const button = screen.getByTitle(I18n.t("results.next_submission"), {exact: false}); fireEvent.click(button); @@ -84,7 +92,11 @@ describe("SubmissionSelector", () => { }); it("should call previousSubmission when the next-button is pressed", () => { - render(); + render( + + + + ); const button = screen.getByTitle(I18n.t("results.previous_submission"), {exact: false}); fireEvent.click(button); @@ -92,12 +104,20 @@ describe("SubmissionSelector", () => { }); it("should display the group name", () => { - render(); + render( + + + + ); expect(screen.getByText(props.group_name)).toBeTruthy(); }); it.skip("should show filter modal when filter-button is pressed", () => { - render(); + render( + + + + ); const button = screen.getByTitle(I18n.t("results.filter_submissions")); fireEvent.click(button); @@ -109,7 +129,11 @@ describe("SubmissionSelector", () => { it("should pass correct values to the progress meter", () => { props.num_marked = 50; props.num_collected = 100; - render(); + render( + + + + ); const meter = screen.getByTestId("progress-bar"); expect(meter).toHaveAttribute("value", String(props.num_marked)); expect(meter).toHaveAttribute("min", "0"); @@ -123,7 +147,11 @@ describe("SubmissionSelector", () => { it("should display the total correctly", () => { props.total = 50; props.assignment_max_mark = 100; - render(); + render( + + + + ); const expected_display = `${Math.round(props.total * 100) / 100} / ${ props.assignment_max_mark }`; @@ -131,7 +159,11 @@ describe("SubmissionSelector", () => { }); it("can toggle into fullscreen", () => { - render(); + render( + + + + ); const button = screen.getByTitle(I18n.t("results.fullscreen_enter"), {exact: false}); fireEvent.click(button); @@ -140,7 +172,11 @@ describe("SubmissionSelector", () => { it("can toggle out of fullscreen", () => { props.fullscreen = true; - render(); + render( + + + + ); const button = screen.getByTitle(I18n.t("results.fullscreen_exit"), {exact: false}); fireEvent.click(button); @@ -149,14 +185,22 @@ describe("SubmissionSelector", () => { it("should not allow release if can_release is false", () => { props.can_release = false; - render(); + render( + + + + ); expect(screen.queryByText(I18n.t("submissions.release_marks"))).toBeNull(); }); it("should set the text as unrelease if it has already been released", () => { props.released_to_students = true; props.can_release = true; - render(); + render( + + + + ); const element = screen.queryByRole("button", {name: I18n.t("submissions.unrelease_marks")}); expect(element).toBeTruthy(); }); @@ -164,7 +208,11 @@ describe("SubmissionSelector", () => { it("should set the text as release if it has not already been released and disable it if marking state is not complete", () => { props.released_to_students = false; props.can_release = true; - render(); + render( + + + + ); const element = screen.getByRole("button", {name: I18n.t("submissions.release_marks")}); expect(element).toBeDisabled(); }); @@ -173,7 +221,11 @@ describe("SubmissionSelector", () => { props.released_to_students = false; props.can_release = true; props.marking_state = "complete"; - render(); + render( + + + + ); const element = screen.getByRole("button", {name: I18n.t("submissions.release_marks")}); expect(element).toBeEnabled(); }); @@ -182,7 +234,11 @@ describe("SubmissionSelector", () => { props.marking_state = "complete"; props.released_to_students = false; props.can_release = true; - render(); + render( + + + + ); const element = screen.getByRole("button", {name: I18n.t("submissions.release_marks")}); fireEvent.click(element); @@ -192,7 +248,11 @@ describe("SubmissionSelector", () => { it("should have the marking state button function as expected when marking_state is complete", () => { props.marking_state = "complete"; props.released_to_students = false; - render(); + render( + + + + ); const button = screen.queryByRole("button", {name: I18n.t("results.set_to_incomplete")}); expect(button).toBeTruthy(); @@ -201,7 +261,11 @@ describe("SubmissionSelector", () => { it("should have the marking state button function as expected when marking_state is incomplete", () => { props.marking_state = "incomplete"; - render(); + render( + + + + ); const button = screen.queryByRole("button", {name: I18n.t("results.set_to_complete")}); expect(button).toBeTruthy(); @@ -210,7 +274,11 @@ describe("SubmissionSelector", () => { it("should have the marking state button enabled if props.marks have no unmarked marks and marking_state is incomplete", () => { props.marking_state = "incomplete"; props.marks = [{mark: 5}]; - render(); + render( + + + + ); const button = screen.queryByRole("button", {name: I18n.t("results.set_to_complete")}); expect(button).toBeEnabled(); @@ -219,7 +287,11 @@ describe("SubmissionSelector", () => { it("should have the marking state button disabled if props.marks has at least 1 mark with no mark and marking_state is incomplete", () => { props.marking_state = "incomplete"; props.marks = [{mark: 5}, {mark: null}]; - render(); + render( + + + + ); const button = screen.queryByRole("button", {name: I18n.t("results.set_to_complete")}); expect(button).toBeDisabled();