From 5a48f05e77bd075b89fd40301381b075beaea1d9 Mon Sep 17 00:00:00 2001 From: jschwarz2030 <79289630+jschwarz2030@users.noreply.github.com> Date: Fri, 19 Mar 2021 20:28:51 -0500 Subject: [PATCH] add comments to task bundle widget (#1587) --- .../TaskAnalysisTable/TaskAnalysisTable.js | 6 +-- .../TaskAnalysisTable.test.js | 38 +++++++++++++++++++ .../TaskBundleWidget/TaskBundleWidget.js | 2 +- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 src/components/TaskAnalysisTable/TaskAnalysisTable.test.js diff --git a/src/components/TaskAnalysisTable/TaskAnalysisTable.js b/src/components/TaskAnalysisTable/TaskAnalysisTable.js index 24a781752..5d4ad903a 100644 --- a/src/components/TaskAnalysisTable/TaskAnalysisTable.js +++ b/src/components/TaskAnalysisTable/TaskAnalysisTable.js @@ -82,7 +82,7 @@ const DEFAULT_COLUMNS = ["featureId", "id", "status", "priority", "controls", "c * * @author [Neil Rotstan](https://github.com/nrotstan) */ -export class TaskAnalysisTable extends Component { +export class TaskAnalysisTableInternal extends Component { state = { openComments: null, showConfigureColumns: false, @@ -682,7 +682,7 @@ const setupColumnTypes = (props, taskBaseRoute, manager, data, openComments) => return columns } -TaskAnalysisTable.propTypes = { +TaskAnalysisTableInternal.propTypes = { /** The tasks to display */ taskInfo: PropTypes.shape({ challengeId: PropTypes.number, @@ -701,7 +701,7 @@ TaskAnalysisTable.propTypes = { export default injectIntl( WithConfigurableColumns( - TaskAnalysisTable, + TaskAnalysisTableInternal, ALL_COLUMNS, DEFAULT_COLUMNS, messages diff --git a/src/components/TaskAnalysisTable/TaskAnalysisTable.test.js b/src/components/TaskAnalysisTable/TaskAnalysisTable.test.js new file mode 100644 index 000000000..e25e2fb20 --- /dev/null +++ b/src/components/TaskAnalysisTable/TaskAnalysisTable.test.js @@ -0,0 +1,38 @@ +import "@testing-library/jest-dom"; +import * as React from "react"; +import { IntlProvider } from "react-intl"; +import { render, fireEvent, screen, waitFor } from "@testing-library/react"; +import { TaskAnalysisTableInternal as TaskAnalysisTable } from "./TaskAnalysisTable"; + +jest.mock( + "../../components/KeywordAutosuggestInput/InTableTagFilter", + () => ({}) +); +jest.mock("./TaskAnalysisTableHeader", () => () =>
Header
); +jest.mock("../ViewTask/ViewTask", () => () =>
ViewTask
); + +describe("TaskAnalysisTable", () => { + it("doesn't break if given some basic props", () => { + const { getByText, debug } = render( + + null} + showColumns={[ + "selected", + "featureId", + "id", + "status", + "priority", + "comments", + ]} + intl={{ formatMessage: () => null }} + getUserAppSetting={() => null} + selectedTaskCount={() => null} + /> + + ); + const text = getByText("Header"); + expect(text).toBeInTheDocument(); + }); +}); diff --git a/src/components/Widgets/TaskBundleWidget/TaskBundleWidget.js b/src/components/Widgets/TaskBundleWidget/TaskBundleWidget.js index 45875338f..9d767089b 100644 --- a/src/components/Widgets/TaskBundleWidget/TaskBundleWidget.js +++ b/src/components/Widgets/TaskBundleWidget/TaskBundleWidget.js @@ -347,7 +347,7 @@ const BuildBundle = props => { taskData={_get(props, 'taskInfo.tasks')} totalTaskCount={totalTaskCount} totalTasksInChallenge={ calculateTasksInChallenge(props) } - showColumns={['selected', 'featureId', 'id', 'status', 'priority']} + showColumns={['selected', 'featureId', 'id', 'status', 'priority', 'comments']} taskSelectionStatuses={[TaskStatus.created, TaskStatus.skipped, TaskStatus.tooHard]} taskSelectionReviewStatuses={[]} customHeaderControls={bundleButton}