From 4558f4b737ef3c77a28cc968d983b13782e7bbba Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 13 Sep 2024 16:00:53 +0100 Subject: [PATCH 01/20] Fixed console.error Warning: Failed prop type: SubMenu: prop type `isCalculatedSummary` is invalid and console.error Warning: Failed prop type: The prop `fetchAnswers` is marked as required in `StatelessAdditionalInfo` error --- .../QuestionProperties/AdditionalContentOptions.js | 2 +- eq-author/src/components/ContentPickerv3/Menu.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eq-author/src/App/page/Design/QuestionPageEditor/QuestionProperties/AdditionalContentOptions.js b/eq-author/src/App/page/Design/QuestionPageEditor/QuestionProperties/AdditionalContentOptions.js index 1b413e2139..374d05a4fd 100644 --- a/eq-author/src/App/page/Design/QuestionPageEditor/QuestionProperties/AdditionalContentOptions.js +++ b/eq-author/src/App/page/Design/QuestionPageEditor/QuestionProperties/AdditionalContentOptions.js @@ -220,7 +220,7 @@ export const StatelessAdditionalInfo = ({ StatelessAdditionalInfo.propTypes = { onChange: PropTypes.func.isRequired, onUpdate: PropTypes.func.isRequired, - fetchAnswers: PropTypes.func.isRequired, + fetchAnswers: PropTypes.func, page: propType(pageFragment).isRequired, onChangeUpdate: PropTypes.func.isRequired, option: PropTypes.string.isRequired, diff --git a/eq-author/src/components/ContentPickerv3/Menu.js b/eq-author/src/components/ContentPickerv3/Menu.js index 29dd61ccd4..aebfc98f43 100644 --- a/eq-author/src/components/ContentPickerv3/Menu.js +++ b/eq-author/src/components/ContentPickerv3/Menu.js @@ -290,7 +290,7 @@ const FlatSectionMenu = ({ data, isCalculatedSummary, ...otherProps }) => FlatSectionMenu.propTypes = { data: PropTypes.arrayOf( PropTypes.shape({ - id: PropTypes.string.isRequired, + id: PropTypes.string, }) ), }; From a960f7517b54e802d9e2b0e6d3a6e73e585e9449 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Tue, 17 Sep 2024 12:18:07 +0100 Subject: [PATCH 02/20] qcodes unique key ID console error fixed --- eq-author/src/App/qcodes/QCodesTable/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eq-author/src/App/qcodes/QCodesTable/index.js b/eq-author/src/App/qcodes/QCodesTable/index.js index ab57c0a305..25cd9b1129 100644 --- a/eq-author/src/App/qcodes/QCodesTable/index.js +++ b/eq-author/src/App/qcodes/QCodesTable/index.js @@ -271,7 +271,7 @@ export const QCodeTable = () => { (dataVersion === "3" || item.type !== "CheckboxOption") ) { return ( - <> + { {...item.additionalAnswer} errorMessage={getErrorMessage(item.additionalAnswer.qCode)} /> - + ); } else { return ( From 67e1e874de6277aae08ca06e90e925de87185ba7 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Tue, 17 Sep 2024 20:40:11 +0100 Subject: [PATCH 03/20] console.error Warning: A component is changing an uncontrolled input of type text to be controlled resolved --- eq-author/src/App/qcodes/QCodesTable/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eq-author/src/App/qcodes/QCodesTable/index.js b/eq-author/src/App/qcodes/QCodesTable/index.js index 25cd9b1129..caf84bed32 100644 --- a/eq-author/src/App/qcodes/QCodesTable/index.js +++ b/eq-author/src/App/qcodes/QCodesTable/index.js @@ -197,7 +197,7 @@ const Row = memo((props) => { data-test={`${id}${secondary ? "-secondary" : ""}${ listAnswerType === DRIVING ? "-driving" : "" }${listAnswerType === ANOTHER ? "-another" : ""}-test-input`} - value={qCode} + value={qCode || ""} // Ensure the input always has a value (empty string if qCode is null or undefined) onChange={(e) => setQcode(e.value)} onBlur={() => handleBlur(qCode)} hasError={Boolean(errorMessage)} From 204b05d4a5426a2fd5b8c403c8c69a62f67db704 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Tue, 17 Sep 2024 22:54:03 +0100 Subject: [PATCH 04/20] console.error Warning: Failed prop type: Invalid prop `in` of type `function` supplied to `CSSTransition`, expected `boolean`, console.error Warning: Failed prop type: Invalid prop `in` of type `function` supplied to `Transition`, expected `boolean` and console.error Warning: Failed prop type: The prop `value` is marked as required in `WrappingInput`, but its value is `undefined` fixed --- eq-author/src/App/page/Logic/BinaryExpressionEditor/index.js | 5 +++-- eq-author/src/components/Forms/WrappingInput/index.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eq-author/src/App/page/Logic/BinaryExpressionEditor/index.js b/eq-author/src/App/page/Logic/BinaryExpressionEditor/index.js index e7de84795e..985cba9a75 100644 --- a/eq-author/src/App/page/Logic/BinaryExpressionEditor/index.js +++ b/eq-author/src/App/page/Logic/BinaryExpressionEditor/index.js @@ -191,9 +191,10 @@ export const UnwrappedBinaryExpressionEditor = ({ const MetadataEditor = METADATA_TYPE_TO_RIGHT_EDITOR[expression?.left?.metadataType]; - const shouldRenderEditor = + const shouldRenderEditor = Boolean( (AnswerEditor && !expression.left.reason && !answerPickerError) || - MetadataEditor; + MetadataEditor + ); const isLastExpression = expressionIndex === expressionGroup.expressions.length - 1; diff --git a/eq-author/src/components/Forms/WrappingInput/index.js b/eq-author/src/components/Forms/WrappingInput/index.js index 0efd856966..ec85b679bf 100644 --- a/eq-author/src/components/Forms/WrappingInput/index.js +++ b/eq-author/src/components/Forms/WrappingInput/index.js @@ -27,7 +27,7 @@ const TextArea = styled(AutoResizeTextArea)` class WrappingInput extends React.Component { static propTypes = { - value: PropTypes.string.isRequired, + value: PropTypes.string, onChange: PropTypes.func.isRequired, onBlur: PropTypes.func.isRequired, onPaste: PropTypes.func, From a1e92502b76bf5326fcdaa117a9e6c2067afc217 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Sat, 21 Sep 2024 17:24:32 +0100 Subject: [PATCH 05/20] console.error Warning: Failed prop type: page missing on {id:1,title:,description:,type:Date,guidance:,label:,secondaryLabel:,secondaryLabelDefault:,properties:{},displayName:,qCode:,advancedProperties:false} in DateSingle fixed --- .../AnswerEditor/__snapshots__/index.test.js.snap | 4 ++++ .../AnswersEditor/AnswerEditor/index.js | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap index c3817f40f0..e3b0053e7e 100644 --- a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap @@ -371,6 +371,10 @@ exports[`Answer Editor should render Date 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "page-1", + "pageType": "QuestionPage", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", diff --git a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js index 28e2e6ae8f..348bdd049e 100644 --- a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js +++ b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js @@ -139,10 +139,17 @@ class AnswerEditor extends React.Component { if (type === DATE_RANGE) { return ; } - // Only option left is Date as validation done in prop types + const updatedProps = { + ...this.props, + answer: { + ...this.props.answer, + page: this.props.page, + }, + }; + return ( Date: Sun, 22 Sep 2024 18:23:37 +0100 Subject: [PATCH 06/20] console.error Warning: Failed prop type: The prop `getValidationError` is marked as required in `SectionEditor`, but its value is `undefined`. in SectionEditor and console.error Warning: Failed prop type: introductionEnabled missing on {"id":"section-1","title":"Section 1","alias":"alias","introductionTitle":"Intro title","introductionContent":"Intro content","introductionPageDescription":"Intro description","requiredCompleted":true,"showOnHub":true,"sectionSummary":false,"sectionSummaryPageDescription":"Summary description","collapsibleSummary":false,"repeatingSection":false,"repeatingSectionListId":null,"questionnaire":{"id":"2","navigation":true,"hub":false},"validationErrorInfo":{"id":"3","totalCount":0,"errors":[]},"comments":[]} in SectionEditor fixed. Snapshots updated! --- .../App/section/Design/SectionEditor/SectionEditor.test.js | 4 +++- eq-author/src/App/section/Design/SectionEditor/index.js | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js b/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js index 2a8bae98bb..5db80ba4ae 100644 --- a/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js +++ b/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js @@ -30,13 +30,13 @@ describe("SectionEditor", () => { id: "section-1", title: "Section 1", alias: "alias", + introductionEnabled: true, introductionTitle: "Intro title", introductionContent: "Intro content", introductionPageDescription: "Intro description", requiredCompleted: true, showOnHub: true, sectionSummary: false, - sectionSummaryPageDescription: "Summary description", collapsibleSummary: false, repeatingSection: false, repeatingSectionListId: null, @@ -58,8 +58,10 @@ describe("SectionEditor", () => { id: "section-2", title: "Section 2", alias: "alias", + introductionEnabled: true, introductionTitle: "Intro title", introductionContent: "Intro content", + introductionPageDescription: "Intro description", requiredCompleted: true, showOnHub: true, sectionSummary: false, diff --git a/eq-author/src/App/section/Design/SectionEditor/index.js b/eq-author/src/App/section/Design/SectionEditor/index.js index 518c07f0b7..57e15b75cb 100644 --- a/eq-author/src/App/section/Design/SectionEditor/index.js +++ b/eq-author/src/App/section/Design/SectionEditor/index.js @@ -67,7 +67,10 @@ const getMultipleErrorsByField = (field, errorMessages, validationErrors) => { export class SectionEditor extends React.Component { static propTypes = { - section: propType(sectionFragment), + section: PropTypes.shape({ + ...propType(sectionFragment).type, + sectionSummaryPageDescription: PropTypes.string, // Make sectionSummaryPageDescription optional + }).isRequired, onChange: PropTypes.func.isRequired, onUpdate: PropTypes.func.isRequired, onDeleteSectionConfirm: PropTypes.func.isRequired, @@ -77,7 +80,7 @@ export class SectionEditor extends React.Component { showMoveSectionDialog: PropTypes.bool.isRequired, onCloseMoveSectionDialog: PropTypes.func.isRequired, match: CustomPropTypes.match.isRequired, - getValidationError: PropTypes.func.isRequired, + getValidationError: PropTypes.func, }; state = { From e70860d39fdb024cf1d35eec6dc98e1cfa59f724 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Sun, 22 Sep 2024 18:23:59 +0100 Subject: [PATCH 07/20] Snapshots updated --- .../__snapshots__/SectionEditor.test.js.snap | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap b/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap index e47a4df53c..a7bfe38048 100644 --- a/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap +++ b/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap @@ -61,6 +61,7 @@ exports[`SectionEditor should render 1`] = ` "comments": Array [], "id": "section-1", "introductionContent": "Intro content", + "introductionEnabled": true, "introductionPageDescription": "Intro description", "introductionTitle": "Intro title", "questionnaire": Object { @@ -73,7 +74,6 @@ exports[`SectionEditor should render 1`] = ` "repeatingSectionListId": null, "requiredCompleted": true, "sectionSummary": false, - "sectionSummaryPageDescription": "Summary description", "showOnHub": true, "title": "Section 1", "validationErrorInfo": Object { @@ -89,7 +89,6 @@ exports[`SectionEditor should render 1`] = ` errors={Array []} id="section-1" sectionSummary={false} - sectionSummaryPageDescription="Summary description" /> Date: Sun, 22 Sep 2024 18:31:49 +0100 Subject: [PATCH 08/20] index.js:166 Warning: Failed prop type: Invalid prop `introductionContentErrorMessage` of type `array` supplied to `SectionIntroduction`, expected `string` fixed --- .../section/Design/SectionEditor/SectionIntroduction/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eq-author/src/App/section/Design/SectionEditor/SectionIntroduction/index.js b/eq-author/src/App/section/Design/SectionEditor/SectionIntroduction/index.js index d5fd0b3019..d1a0472f00 100644 --- a/eq-author/src/App/section/Design/SectionEditor/SectionIntroduction/index.js +++ b/eq-author/src/App/section/Design/SectionEditor/SectionIntroduction/index.js @@ -103,8 +103,8 @@ const SectionIntroduction = ({ SectionIntroduction.propTypes = { section: CustomPropTypes.section.isRequired, handleUpdate: PropTypes.func.isRequired, - introductionTitleErrorMessage: PropTypes.string, - introductionContentErrorMessage: PropTypes.string, + introductionTitleErrorMessage: PropTypes.array, //eslint-disable-line + introductionContentErrorMessage: PropTypes.array, //eslint-disable-line }; export default SectionIntroduction; From 274bc1fd8a865e9af4e271dd89e2b7c81cf7d5ab Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Mon, 23 Sep 2024 16:16:56 +0100 Subject: [PATCH 09/20] console.error Warning: Failed prop type: SubMenu: prop type `isCalculatedSummary` is invalid; it must be a function, usually from the `prop-types` package, but received `undefined` fixed --- eq-author/src/components/ContentPickerv3/Menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eq-author/src/components/ContentPickerv3/Menu.js b/eq-author/src/components/ContentPickerv3/Menu.js index aebfc98f43..860cab1351 100644 --- a/eq-author/src/components/ContentPickerv3/Menu.js +++ b/eq-author/src/components/ContentPickerv3/Menu.js @@ -264,7 +264,7 @@ SubMenu.propTypes = { onSelected: PropTypes.func.isRequired, isSelected: PropTypes.func.isRequired, isDisabled: PropTypes.func, - isCalculatedSummary: PropTypes.boolean, + isCalculatedSummary: PropTypes.func, }; const FlatSectionMenu = ({ data, isCalculatedSummary, ...otherProps }) => From c1bd1cf5cb0750c23b557a0e7c6d45f4920fc351 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Wed, 25 Sep 2024 12:30:21 +0100 Subject: [PATCH 10/20] Console console.error Warning: Failed prop type: Invalid prop `isCalculatedSummary` of type `boolean` supplied to `SubMenu`, expected `function`. Fixed --- eq-author/src/components/ContentPickerv3/Menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eq-author/src/components/ContentPickerv3/Menu.js b/eq-author/src/components/ContentPickerv3/Menu.js index 860cab1351..c11413a076 100644 --- a/eq-author/src/components/ContentPickerv3/Menu.js +++ b/eq-author/src/components/ContentPickerv3/Menu.js @@ -264,7 +264,7 @@ SubMenu.propTypes = { onSelected: PropTypes.func.isRequired, isSelected: PropTypes.func.isRequired, isDisabled: PropTypes.func, - isCalculatedSummary: PropTypes.func, + isCalculatedSummary: PropTypes.bool, }; const FlatSectionMenu = ({ data, isCalculatedSummary, ...otherProps }) => From f635b696575cb133f71fde81e1a848e3c0279c99 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 12:33:29 +0100 Subject: [PATCH 11/20] Missing properties in the tests added --- .../DateRange/__snapshots__/index.test.js.snap | 18 ++++++++++++++++++ .../Design/answers/DateRange/index.test.js | 3 +++ .../page/Preview/QuestionPagePreview.test.js | 3 +++ .../Design/__snapshots__/index.test.js.snap | 1 + .../questionConfirmation/Design/index.test.js | 1 + .../questionConfirmation/Preview/index.test.js | 1 + .../Preview/__snapshots__/index.test.js.snap | 3 +++ .../src/App/section/Preview/index.test.js | 6 ++++++ 8 files changed, 36 insertions(+) diff --git a/eq-author/src/App/page/Design/answers/DateRange/__snapshots__/index.test.js.snap b/eq-author/src/App/page/Design/answers/DateRange/__snapshots__/index.test.js.snap index 8b6787e69c..f063ef2af0 100644 --- a/eq-author/src/App/page/Design/answers/DateRange/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/page/Design/answers/DateRange/__snapshots__/index.test.js.snap @@ -13,6 +13,9 @@ exports[`DateRange should render 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "Page 1", + }, "properties": Object { "required": false, }, @@ -42,6 +45,9 @@ exports[`DateRange should render 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "Page 1", + }, "properties": Object { "required": false, }, @@ -71,6 +77,9 @@ exports[`DateRange should render 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "Page 1", + }, "properties": Object { "required": false, }, @@ -94,6 +103,9 @@ exports[`DateRange should render 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "Page 1", + }, "properties": Object { "required": false, }, @@ -118,6 +130,9 @@ exports[`DateRange should render 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "Page 1", + }, "properties": Object { "required": false, }, @@ -140,6 +155,9 @@ exports[`DateRange should render 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "Page 1", + }, "properties": Object { "required": false, }, diff --git a/eq-author/src/App/page/Design/answers/DateRange/index.test.js b/eq-author/src/App/page/Design/answers/DateRange/index.test.js index a3580c24d1..173fb8e175 100644 --- a/eq-author/src/App/page/Design/answers/DateRange/index.test.js +++ b/eq-author/src/App/page/Design/answers/DateRange/index.test.js @@ -22,6 +22,9 @@ describe("DateRange", () => { id: "1", label: "", type: "DateRange", + page: { + id: "Page 1", + }, description: "test", guidance: "", secondaryLabel: "", diff --git a/eq-author/src/App/page/Preview/QuestionPagePreview.test.js b/eq-author/src/App/page/Preview/QuestionPagePreview.test.js index 831ed0529a..0fbf76a778 100644 --- a/eq-author/src/App/page/Preview/QuestionPagePreview.test.js +++ b/eq-author/src/App/page/Preview/QuestionPagePreview.test.js @@ -45,6 +45,9 @@ describe("QuestionPagePreview", () => { additionalInfoLabel: "

Additional Info Label

", additionalInfoContent: "

Additional Info Content

", additionalInfoEnabled: true, + confirmation: { + id: "confirmation-1", + }, validationErrorInfo: { totalCount: 0, errors: [] }, answers: [{ id: "1", type: TEXTFIELD }], comments: [], diff --git a/eq-author/src/App/questionConfirmation/Design/__snapshots__/index.test.js.snap b/eq-author/src/App/questionConfirmation/Design/__snapshots__/index.test.js.snap index b6d9932b9a..74f6f7c9d5 100644 --- a/eq-author/src/App/questionConfirmation/Design/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/questionConfirmation/Design/__snapshots__/index.test.js.snap @@ -45,6 +45,7 @@ exports[`QuestionConfirmationRoute should render 1`] = ` "displayName": "My question", "id": "1", }, + "pageDescription": "Page description 1", "positive": Object { "description": "Positive description", "id": "1", diff --git a/eq-author/src/App/questionConfirmation/Design/index.test.js b/eq-author/src/App/questionConfirmation/Design/index.test.js index 947632faf1..e312204a42 100644 --- a/eq-author/src/App/questionConfirmation/Design/index.test.js +++ b/eq-author/src/App/questionConfirmation/Design/index.test.js @@ -19,6 +19,7 @@ describe("QuestionConfirmationRoute", () => { id: "1", displayName: "My first displayname", title: "My first confirmation", + pageDescription: "Page description 1", qCode: "", page: { id: "1", diff --git a/eq-author/src/App/questionConfirmation/Preview/index.test.js b/eq-author/src/App/questionConfirmation/Preview/index.test.js index 7adb8bc62f..76145294bf 100644 --- a/eq-author/src/App/questionConfirmation/Preview/index.test.js +++ b/eq-author/src/App/questionConfirmation/Preview/index.test.js @@ -11,6 +11,7 @@ describe("Question Confirmation Preview", () => { id: "1", displayName: "Hello world", title: "

Hello world

", + pageDescription: "Page description 1", qCode: "", positive: { id: "1", diff --git a/eq-author/src/App/section/Preview/__snapshots__/index.test.js.snap b/eq-author/src/App/section/Preview/__snapshots__/index.test.js.snap index cea1171df3..69648d228a 100644 --- a/eq-author/src/App/section/Preview/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/section/Preview/__snapshots__/index.test.js.snap @@ -40,6 +40,8 @@ exports[`PreviewSectionRoute should show the section intro preview when it is fi "comments": Array [], "id": "1", "introductionContent": "intro content", + "introductionEnabled": true, + "introductionPageDescription": "Introduction page description 1", "introductionTitle": "intro title", "questionnaire": Object { "hub": false, @@ -50,6 +52,7 @@ exports[`PreviewSectionRoute should show the section intro preview when it is fi "repeatingSectionListId": null, "requiredCompleted": false, "sectionSummary": false, + "sectionSummaryPageDescription": "Section summary 2", "showOnHub": false, "title": "", "validationErrorInfo": Object { diff --git a/eq-author/src/App/section/Preview/index.test.js b/eq-author/src/App/section/Preview/index.test.js index 9513dbbbd7..ef548c166f 100644 --- a/eq-author/src/App/section/Preview/index.test.js +++ b/eq-author/src/App/section/Preview/index.test.js @@ -31,9 +31,12 @@ describe("PreviewSectionRoute", () => { title: "", introductionTitle: "intro title", introductionContent: "intro content", + introductionEnabled: true, + introductionPageDescription: "Introduction page description 1", requiredCompleted: false, showOnHub: false, sectionSummary: false, + sectionSummaryPageDescription: "Section summary 2", collapsibleSummary: false, repeatingSection: false, repeatingSectionListId: null, @@ -70,9 +73,12 @@ describe("PreviewSectionRoute", () => { title: "", introductionTitle: "", introductionContent: "", + introductionEnabled: true, + introductionPageDescription: "Introduction page description 2", requiredCompleted: false, showOnHub: false, sectionSummary: false, + sectionSummaryPageDescription: "Section summary 2", collapsibleSummary: false, repeatingSection: false, repeatingSectionListId: null, From 63d9808cadadb6c89f4f2648fa5fc51e204acd19 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 13:32:51 +0100 Subject: [PATCH 12/20] text changed to span --- .../src/App/introduction/Preview/IntroductionPreview/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js index 948b0079d2..2faca929cc 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js @@ -89,12 +89,12 @@ const CollapsiblesContent = styled.div` padding: 0.2em 0 0.2em 1em; `; -const DummyLink = styled.text` +const DummyLink = styled.span` color: ${colors.blue}; text-decoration: underline; `; -const MissingText = styled.text` +const MissingText = styled.span` font-weight: bold; background-color: ${colors.errorSecondary}; text-align: center; From 65d26c0ae02bc39b5779712e4fccc35c643cf733 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 13:50:58 +0100 Subject: [PATCH 13/20] Missing properties in the unit tests added --- .../Design/answers/DateSingle/__snapshots__/index.test.js.snap | 3 +++ eq-author/src/App/page/Design/answers/DateSingle/index.test.js | 3 +++ eq-author/src/App/page/Preview/index.test.js | 3 +++ eq-author/src/App/questionConfirmation/Design/Editor.test.js | 1 + .../Design/__snapshots__/Editor.test.js.snap | 2 ++ eq-author/src/App/section/Preview/SectionIntroPreview.test.js | 3 +++ 6 files changed, 15 insertions(+) diff --git a/eq-author/src/App/page/Design/answers/DateSingle/__snapshots__/index.test.js.snap b/eq-author/src/App/page/Design/answers/DateSingle/__snapshots__/index.test.js.snap index cb76f7775b..41e270389c 100644 --- a/eq-author/src/App/page/Design/answers/DateSingle/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/page/Design/answers/DateSingle/__snapshots__/index.test.js.snap @@ -17,6 +17,9 @@ exports[`Date should render 1`] = ` "mutuallyExclusive": false, }, ], + "page": Object { + "id": "Page 1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": null, diff --git a/eq-author/src/App/page/Design/answers/DateSingle/index.test.js b/eq-author/src/App/page/Design/answers/DateSingle/index.test.js index 161fdf49b5..a6d6318353 100644 --- a/eq-author/src/App/page/Design/answers/DateSingle/index.test.js +++ b/eq-author/src/App/page/Design/answers/DateSingle/index.test.js @@ -24,6 +24,9 @@ describe("Date", () => { answer = { id: "ansID1", title: "Date title", + page: { + id: "Page 1", + }, description: "date description", label: "", type: "Date", diff --git a/eq-author/src/App/page/Preview/index.test.js b/eq-author/src/App/page/Preview/index.test.js index 14d137d74f..ccc5c1e659 100644 --- a/eq-author/src/App/page/Preview/index.test.js +++ b/eq-author/src/App/page/Preview/index.test.js @@ -39,6 +39,9 @@ describe("page previews", () => { additionalInfoLabel: "

Additional Info Label

", additionalInfoContent: "

Additional Info Content

", additionalInfoEnabled: true, + confirmation: { + id: "confirmation-1", + }, validationErrorInfo: [], comments: [], answers: [], diff --git a/eq-author/src/App/questionConfirmation/Design/Editor.test.js b/eq-author/src/App/questionConfirmation/Design/Editor.test.js index ef538bd8a5..b5f792c91d 100644 --- a/eq-author/src/App/questionConfirmation/Design/Editor.test.js +++ b/eq-author/src/App/questionConfirmation/Design/Editor.test.js @@ -18,6 +18,7 @@ describe("Editor", () => { displayName: "My question", answers: [], }, + pageDescription: "Page description 1", positive: { id: "1", label: "Positive label", diff --git a/eq-author/src/App/questionConfirmation/Design/__snapshots__/Editor.test.js.snap b/eq-author/src/App/questionConfirmation/Design/__snapshots__/Editor.test.js.snap index ac6e5068f1..83672dd5be 100644 --- a/eq-author/src/App/questionConfirmation/Design/__snapshots__/Editor.test.js.snap +++ b/eq-author/src/App/questionConfirmation/Design/__snapshots__/Editor.test.js.snap @@ -27,6 +27,7 @@ exports[`Editor Editor Component should autoFocus the title when there is not on marginless={true} onChange={[MockFunction]} onUpdate={[MockFunction]} + pageDescription="Page description 1" /> @@ -108,6 +109,7 @@ exports[`Editor Editor Component should render 1`] = ` marginless={true} onChange={[MockFunction]} onUpdate={[MockFunction]} + pageDescription="Page description 1" /> diff --git a/eq-author/src/App/section/Preview/SectionIntroPreview.test.js b/eq-author/src/App/section/Preview/SectionIntroPreview.test.js index 29801c06b1..7d16fd55a2 100644 --- a/eq-author/src/App/section/Preview/SectionIntroPreview.test.js +++ b/eq-author/src/App/section/Preview/SectionIntroPreview.test.js @@ -11,11 +11,14 @@ describe("SectionIntroPreview", () => { id: "1", title: "", alias: "", + introductionEnabled: true, + introductionPageDescription: "Introduction page description 1", introductionTitle: "

title

", introductionContent: "

Content

", requiredCompleted: false, showOnHub: false, sectionSummary: false, + sectionSummaryPageDescription: "Section summary 1", collapsibleSummary: false, repeatingSection: false, repeatingSectionListId: null, From 43fbca7ce40fd67e29cd72369d470d4c65d07e5f Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 13:59:08 +0100 Subject: [PATCH 14/20] async await added --- .../RepeatLabelAndInput/index.test.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/eq-author/src/components/AnswerContent/RepeatLabelAndInput/index.test.js b/eq-author/src/components/AnswerContent/RepeatLabelAndInput/index.test.js index 9526b18b16..514f3ebfe4 100644 --- a/eq-author/src/components/AnswerContent/RepeatLabelAndInput/index.test.js +++ b/eq-author/src/components/AnswerContent/RepeatLabelAndInput/index.test.js @@ -1,6 +1,6 @@ import React from "react"; -import { render, fireEvent } from "tests/utils/rtl"; +import { render, fireEvent, waitFor } from "tests/utils/rtl"; import RepeatingLabelAndInput from "./index"; const handleUpdate = jest.fn(); @@ -25,8 +25,10 @@ const renderRepeatingLabelAndInput = (handleUpdate, answer) => ); describe("Repeating label and input", () => { - it("should render component", () => { - const { getByText } = renderRepeatingLabelAndInput(handleUpdate, answer); + it("should render component", async () => { + const { getByText } = await waitFor(() => + renderRepeatingLabelAndInput(handleUpdate, answer) + ); expect(getByText("Repeat label and input")).toBeTruthy(); }); @@ -35,7 +37,9 @@ describe("Repeating label and input", () => { answer.repeatingLabelAndInput = !answer.repeatingLabelAndInput; }); - const { getByTestId } = renderRepeatingLabelAndInput(handleUpdate, answer); + const { getByTestId } = await waitFor(() => + renderRepeatingLabelAndInput(handleUpdate, answer) + ); const toggle = getByTestId("repeat-label-and-input-toggle-input"); fireEvent.change(toggle, { target: { value: "On" } }); @@ -44,10 +48,12 @@ describe("Repeating label and input", () => { expect(handleUpdate).toHaveBeenCalled(); }); - it("should display collection lists", () => { + it("should display collection lists", async () => { answer.repeatingLabelAndInput = true; - const { getByText } = renderRepeatingLabelAndInput(handleUpdate, answer); + const { getByText } = await waitFor(() => + renderRepeatingLabelAndInput(handleUpdate, answer) + ); expect(getByText("Select a collection list")).toBeTruthy(); }); }); From f6848daf7a7eee679d4299890161e778b90042b7 Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 14:08:07 +0100 Subject: [PATCH 15/20] mockOnSelectFolders mock function added --- .../src/components/modals/ImportContentModal/index.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eq-author/src/components/modals/ImportContentModal/index.test.js b/eq-author/src/components/modals/ImportContentModal/index.test.js index a9d6d35f2a..4d22725816 100644 --- a/eq-author/src/components/modals/ImportContentModal/index.test.js +++ b/eq-author/src/components/modals/ImportContentModal/index.test.js @@ -9,6 +9,7 @@ const mockQuestionnaire = { }; const mockOnSelectQuestions = jest.fn(); +const mockOnSelectFolders = jest.fn(); const mockOnSelectSections = jest.fn(); const mockOnRemoveSingle = jest.fn(); const mockOnRemoveAll = jest.fn(); @@ -21,6 +22,7 @@ const setup = (props) => questionnaire={mockQuestionnaire} isOpen onSelectQuestions={mockOnSelectQuestions} + onSelectFolders={mockOnSelectFolders} onSelectSections={mockOnSelectSections} startingSelectedQuestions={[]} onConfirm={jest.fn()} From c010c2a545c5b51de98bcf8619a342e1eadc34da Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 14:14:02 +0100 Subject: [PATCH 16/20] IDs added to the test --- .../src/App/section/Design/SectionEditor/SectionEditor.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js b/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js index 5db80ba4ae..33b3126f1d 100644 --- a/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js +++ b/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js @@ -173,6 +173,7 @@ describe("SectionEditor", () => { validationErrorInfo: { errors: [ { + id: "1", type: "section", field: "title", errorCode: "ERR_REQUIRED_WHEN_SETTING", @@ -233,6 +234,7 @@ describe("SectionEditor", () => { validationErrorInfo: { errors: [ { + id: "2", type: "section", field: "title", errorCode: "ERR_REQUIRED_WHEN_SETTING", From 40f909f014db539e1d1e74432b96215b7cc0c25b Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 14:20:48 +0100 Subject: [PATCH 17/20] Missing properties added --- .../App/section/Design/SectionEditor/SectionEditor.test.js | 6 ++++++ .../SectionEditor/__snapshots__/SectionEditor.test.js.snap | 6 ++++++ eq-author/src/App/section/Design/SectionEditor/index.js | 5 +---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js b/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js index 33b3126f1d..c4bb6f9237 100644 --- a/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js +++ b/eq-author/src/App/section/Design/SectionEditor/SectionEditor.test.js @@ -37,6 +37,7 @@ describe("SectionEditor", () => { requiredCompleted: true, showOnHub: true, sectionSummary: false, + sectionSummaryPageDescription: "Section summary 1", collapsibleSummary: false, repeatingSection: false, repeatingSectionListId: null, @@ -65,6 +66,7 @@ describe("SectionEditor", () => { requiredCompleted: true, showOnHub: true, sectionSummary: false, + sectionSummaryPageDescription: "Section summary 2", collapsibleSummary: false, repeatingSection: false, repeatingSectionListId: null, @@ -171,6 +173,8 @@ describe("SectionEditor", () => { showOnHub: false, sectionSummary: true, validationErrorInfo: { + id: "1", + totalCount: 1, errors: [ { id: "1", @@ -232,6 +236,8 @@ describe("SectionEditor", () => { ...section1, title: "", validationErrorInfo: { + id: "2", + totalCount: 1, errors: [ { id: "2", diff --git a/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap b/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap index a7bfe38048..67b3b35dc6 100644 --- a/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap +++ b/eq-author/src/App/section/Design/SectionEditor/__snapshots__/SectionEditor.test.js.snap @@ -74,6 +74,7 @@ exports[`SectionEditor should render 1`] = ` "repeatingSectionListId": null, "requiredCompleted": true, "sectionSummary": false, + "sectionSummaryPageDescription": "Section summary 1", "showOnHub": true, "title": "Section 1", "validationErrorInfo": Object { @@ -89,6 +90,7 @@ exports[`SectionEditor should render 1`] = ` errors={Array []} id="section-1" sectionSummary={false} + sectionSummaryPageDescription="Section summary 1" /> { export class SectionEditor extends React.Component { static propTypes = { - section: PropTypes.shape({ - ...propType(sectionFragment).type, - sectionSummaryPageDescription: PropTypes.string, // Make sectionSummaryPageDescription optional - }).isRequired, + section: propType(sectionFragment), onChange: PropTypes.func.isRequired, onUpdate: PropTypes.func.isRequired, onDeleteSectionConfirm: PropTypes.func.isRequired, From 5681df86f8b3455240fb46557445e65e054aef2b Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Fri, 27 Sep 2024 14:27:54 +0100 Subject: [PATCH 18/20] Added the missing page prop to the tests --- .../__snapshots__/index.test.js.snap | 39 ++++++++++++++++++- .../AnswersEditor/AnswerEditor/index.js | 9 +---- .../AnswersEditor/AnswerEditor/index.test.js | 1 + 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap index e3b0053e7e..de428b8405 100644 --- a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/__snapshots__/index.test.js.snap @@ -110,6 +110,9 @@ exports[`Answer Editor should render Checkbox 1`] = ` "label": "", }, ], + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -240,6 +243,9 @@ exports[`Answer Editor should render Currency 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -372,8 +378,7 @@ exports[`Answer Editor should render Date 1`] = ` "id": "1", "label": "", "page": Object { - "id": "page-1", - "pageType": "QuestionPage", + "id": "1", }, "properties": Object {}, "qCode": "", @@ -508,6 +513,9 @@ exports[`Answer Editor should render DateRange 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -637,6 +645,9 @@ exports[`Answer Editor should render Duration 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object { "unit": "YearsMonths", }, @@ -779,6 +790,9 @@ exports[`Answer Editor should render Mutually Exclusive 1`] = ` "label": "", }, ], + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -909,6 +923,9 @@ exports[`Answer Editor should render Number 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -1040,6 +1057,9 @@ exports[`Answer Editor should render Percentage 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -1178,6 +1198,9 @@ exports[`Answer Editor should render Radio 1`] = ` "label": "", }, ], + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -1317,6 +1340,9 @@ exports[`Answer Editor should render Select 1`] = ` "label": "", }, ], + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -1448,6 +1474,9 @@ exports[`Answer Editor should render TextArea 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -1578,6 +1607,9 @@ exports[`Answer Editor should render TextField 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object {}, "qCode": "", "secondaryLabel": "", @@ -1709,6 +1741,9 @@ exports[`Answer Editor should render Unit 1`] = ` "guidance": "", "id": "1", "label": "", + "page": Object { + "id": "1", + }, "properties": Object { "unit": "Centimetres", }, diff --git a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js index 348bdd049e..4330bfb7a3 100644 --- a/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js +++ b/eq-author/src/App/page/Design/QuestionPageEditor/AnswersEditor/AnswerEditor/index.js @@ -139,17 +139,10 @@ class AnswerEditor extends React.Component { if (type === DATE_RANGE) { return ; } - const updatedProps = { - ...this.props, - answer: { - ...this.props.answer, - page: this.props.page, - }, - }; return ( { mockAnswer = { id: "1", title: "", + page: { id: "1" }, description: "", type: TEXTFIELD, guidance: "", From 8e4d988da8327673d9104202e428b331a21525be Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Mon, 30 Sep 2024 14:26:09 +0100 Subject: [PATCH 19/20] Test --- eq-author/src/components/ContentPickerv3/Menu.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eq-author/src/components/ContentPickerv3/Menu.js b/eq-author/src/components/ContentPickerv3/Menu.js index c11413a076..8d6333c05b 100644 --- a/eq-author/src/components/ContentPickerv3/Menu.js +++ b/eq-author/src/components/ContentPickerv3/Menu.js @@ -157,6 +157,7 @@ export const SectionTitle = styled.div` const Menu = ({ data, onSelected, isSelected }) => { const onEnterUp = (event, section) => { + console.log("Test"); if (event.keyCode === 13) { //13 is the enter keycode onSelected(section); From 0093c73a67fbb7a4deda38822346b2df9fc9c2dc Mon Sep 17 00:00:00 2001 From: sanjeevz3009 Date: Mon, 30 Sep 2024 14:26:37 +0100 Subject: [PATCH 20/20] Removing console.log --- eq-author/src/components/ContentPickerv3/Menu.js | 1 - 1 file changed, 1 deletion(-) diff --git a/eq-author/src/components/ContentPickerv3/Menu.js b/eq-author/src/components/ContentPickerv3/Menu.js index 8d6333c05b..c11413a076 100644 --- a/eq-author/src/components/ContentPickerv3/Menu.js +++ b/eq-author/src/components/ContentPickerv3/Menu.js @@ -157,7 +157,6 @@ export const SectionTitle = styled.div` const Menu = ({ data, onSelected, isSelected }) => { const onEnterUp = (event, section) => { - console.log("Test"); if (event.keyCode === 13) { //13 is the enter keycode onSelected(section);