diff --git a/Notes On Spearmintv15.md b/Notes On Spearmintv15.md
index ec99dc92..d12a0eac 100644
--- a/Notes On Spearmintv15.md
+++ b/Notes On Spearmintv15.md
@@ -14,8 +14,14 @@ Existed Since We've Started:
-Some Accessibility Test existed only in name, not in functionality
-Debugging. Error messages point to bundle. Also, unable to get Electrons "devtools" to
run react DevTools
--No Error Handler for Components
+-No Error Handler for Components(Look into Error Boundary and componentDidCatch)
-No Confirmation Dialogue before X'ing out of blocks
+-No way to import a test file and make modifications on it using the UI
+-No way to use the application as a functioning desktop app. Only as a github download
+-Working Backend(MongoDB connection and CRUD functionality) can't be confirmed
+-Mock Data functionality is tied between all testing widgets
+
+-
Changes Implemented:
For Accessibility Tool
@@ -39,9 +45,15 @@ should look)
Additinoal fixes/considerations needed needed
For the React(Beta)
+-File system structure: maybe grouping all files related to only 1 widget into 1 folder makes more sense then keeping them seperate(e.g., the 'ReactTestCase' and 'Reducer' files should be put inside a folder that contains the other files related to only the React tool widget)
-Decide for yourself which state structure makes the the most sense for you, and lends itself to implementing full jest testing capabilities
-AutoFill for options of Action and Assert Components needs to be updated wot work with
new state structure and re-enabled
+-Steps toward reduced Component rerenders
+-Custom Hooks
+-React.Memo
+React useMemo
+-React useCallback
-debug the Props Component so it will render properly
-Setup Teardowns need to be quanitfied in a way that can be represented
by a form like setup(e.g. user either fills out inputs or uses drags and drops
@@ -52,4 +64,4 @@ to create the setups and teardowns)
-for the switch case 'updatedReact' found in 'useGenerateTest'(or more specifically 'updatedUseGenerateTest' if you haven't moved),
-complete the test file generating needed for the 'updated react' switch case. Needs support for statements.
--lastly,typescript
+-lastly,typescript
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 08f75217..d087d471 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -120,7 +120,6 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
"integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==",
- "dev": true,
"dependencies": {
"@jridgewell/gen-mapping": "^0.1.0",
"@jridgewell/trace-mapping": "^0.3.9"
@@ -764,7 +763,6 @@
"version": "7.20.12",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.12.tgz",
"integrity": "sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==",
- "dev": true,
"dependencies": {
"@ampproject/remapping": "^2.1.0",
"@babel/code-frame": "^7.18.6",
@@ -1118,7 +1116,6 @@
"version": "7.20.13",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.13.tgz",
"integrity": "sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg==",
- "dev": true,
"dependencies": {
"@babel/template": "^7.20.7",
"@babel/traverse": "^7.20.13",
@@ -3236,7 +3233,6 @@
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.2.tgz",
"integrity": "sha512-eFZVFoRXb3GFGd7Ak7W4+6jBl9wBtiZ4AaYOse97ej6mKj5tkyO0dUnUChs1IhJZtx1BENo4/p4WUTXpi6vT+g==",
- "dev": true,
"dependencies": {
"debug": "^4.1.1",
"env-paths": "^2.2.0",
@@ -3257,7 +3253,6 @@
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
- "dev": true,
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0",
@@ -3271,7 +3266,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
- "dev": true,
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
@@ -3280,7 +3274,6 @@
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
- "dev": true,
"engines": {
"node": ">= 4.0.0"
}
@@ -4528,7 +4521,6 @@
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz",
"integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==",
- "dev": true,
"dependencies": {
"@jridgewell/set-array": "^1.0.0",
"@jridgewell/sourcemap-codec": "^1.4.10"
@@ -10563,7 +10555,6 @@
"version": "24.8.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-24.8.3.tgz",
"integrity": "sha512-6YTsEOIMIQNnOz0Fj5gAWtwCuDd66iYKkuRJGyc80jKKYI49jBeH+R7ZZry9uiVu4T4bZgBN2FAN24XfCioQZA==",
- "dev": true,
"hasInstallScript": true,
"dependencies": {
"@electron/get": "^2.0.0",
@@ -11952,7 +11943,6 @@
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
- "dev": true,
"optional": true,
"dependencies": {
"iconv-lite": "^0.6.2"
@@ -13637,7 +13627,6 @@
"version": "1.0.0-beta.2",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
"integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
- "dev": true,
"engines": {
"node": ">=6.9.0"
}
diff --git a/public/electron.jsx b/public/electron.jsx
index 01c65c97..aff47121 100644
--- a/public/electron.jsx
+++ b/public/electron.jsx
@@ -74,7 +74,7 @@ function createWindow() {
// });
mainWindow.loadFile(path.join(__dirname, 'index.html')); // unsure why we need the path.join, but index.html not found without it
- //mainWindow.webContents.openDevTools();
+ // mainWindow.webContents.openDevTools();
//////////////////////////////////////////////////
//Creates terminal, specifies dimensions based on columns and rows
//////////////////////////////////////////////////
diff --git a/src/components/TestCase/UpdatedReactTestCase.tsx b/src/components/TestCase/UpdatedReactTestCase.tsx
index 9057933a..90da16b8 100644
--- a/src/components/TestCase/UpdatedReactTestCase.tsx
+++ b/src/components/TestCase/UpdatedReactTestCase.tsx
@@ -1,4 +1,4 @@
-import React, { createContext, useContext, useReducer } from 'react';
+import React, { useContext } from 'react';
import styles from './TestCase.module.scss';
import { updateRenderComponent } from '../../context/actions/updatedFrontendFrameworkTestCaseActions';
import { GlobalContext } from '../../context/reducers/globalReducer';
@@ -8,94 +8,101 @@ import { createMockData } from '../../context/actions/mockDataActions';
import UpdatedReactTestMenu from '../TestMenu/UpdatedReactTestMenu';
import MockData from '../UpdatedReactTestComponent/MockData/MockData';
import { Button } from '@mui/material';
-import { RTFsContexts } from '../../context/RTFsContextsProvider';
+import { useRTFsContexts } from '../../context/RTFsContextsProvider';
import DescribeBlock from '../UpdatedReactTestComponent/DescribeBlock/DescribeBlock';
-const UpdatedReactTestCase = ({
- filterFileType,
-}: {
- filterFileType: Function;
-}) => {
- const { reactTestFileState, rTFDispatch, handleAddBlock } =
- useContext(RTFsContexts);
- const [{ mockData }, dispatchToMockData] = useContext(MockDataContext);
- const [{ filePathMap, theme }] = useContext(GlobalContext);
+const UpdatedReactTestCase = React.memo(
+ ({ filterFileType }: { filterFileType: Function }) => {
+ const { reactTestFileState, rTFDispatch, handleAddBlock } =
+ // useContext(RTFsContexts);
+ useRTFsContexts();
+ console.log('updatereact rerendered');
+ const [{ mockData }, dispatchToMockData] = useContext(MockDataContext);
+ const [{ filePathMap, theme }] = useContext(GlobalContext);
- const handleAddMockData = () => {
- dispatchToMockData(createMockData());
- };
+ const handleAddMockData = () => {
+ dispatchToMockData(createMockData());
+ };
- const reorder = (list: string[], startIndex: number, endIndex: number) => {
- const result = Array.from(list);
- const [removed] = result.splice(startIndex, 1);
- result.splice(endIndex, 0, removed);
- return result;
- };
+ const reorder = (list: string[], startIndex: number, endIndex: number) => {
+ const result = Array.from(list);
+ const [removed] = result.splice(startIndex, 1);
+ result.splice(endIndex, 0, removed);
+ return result;
+ };
- const reactTestFileStateChildren = Object.values(
- reactTestFileState.children
- ).map((childObject) => (
-
- ));
+ const reactTestFileStateChildren = Object.values(
+ reactTestFileState.children
+ ).map((childObject) => (
+
+ ));
- return (
- <>
-
-
React Testing
-
-
-
-
+ return (
+ <>
+
+
React Testing
+
+
+
+
+
+
-
-
- {mockData
- ? mockData.length > 0 && (
-
- )
- : null}
-
-
- {reactTestFileStateChildren}
+ {mockData
+ ? mockData.length > 0 && (
+
+ )
+ : null}
+
+
+ {reactTestFileStateChildren}
+
+
+
+
-
-
-
-
- >
- );
-};
+ >
+ );
+ }
+);
export default UpdatedReactTestCase;
diff --git a/src/components/UpdatedReactTestComponent/Action/Action.tsx b/src/components/UpdatedReactTestComponent/Action/Action.tsx
index b592ecdb..e863e88f 100644
--- a/src/components/UpdatedReactTestComponent/Action/Action.tsx
+++ b/src/components/UpdatedReactTestComponent/Action/Action.tsx
@@ -6,39 +6,32 @@ import { MockDataContext } from '../../../context/reducers/updatedMockDataReduce
import { GlobalContext } from '../../../context/reducers/globalReducer';
import { AiOutlineClose } from 'react-icons/ai';
import { ReactTestComponentAssertion } from '../../../utils/updatedReactTypes';
-import { RTFsContexts } from '../../../context/RTFsContextsProvider';
-
+import { useRTFsContexts } from '../../../context/RTFsContextsProvider';
const questionIcon = require('../../../assets/images/help-circle.png');
-
// This is tracking the actions that you have in a specific test, following the flow of data will
// help you better understand exactly how this is working
-
type EventTypes =
| React.ChangeEvent
| React.ChangeEvent;
-
type FieldTypes =
| 'eventType'
| 'eventValue'
| 'queryVariant'
| 'querySelector'
| 'queryValue';
-
// Action box in middle panel (testCase.jsx)
-const Action = ({ blockObjectsState }) => {
+const Action = React.memo(({ blockObjectsState }) => {
const thisBlockObjectsState = blockObjectsState;
-
const [{ mockData }] = useContext(MockDataContext);
const [{ theme }] = useContext(GlobalContext);
const { handleAddBlock, handleChange, handleDeleteBlock, rTFDispatch } =
- useContext(RTFsContexts);
-
+ //useContext(RTFsContexts);
+ useRTFsContexts();
/*const handleChangeActionFields = (e: EventTypes, field: FieldTypes) => {
let updatedAction = { ...statement };
updatedAction[field] = e.target.value;
rTFDispatch(updateAction(updatedAction));
};*/
-
//conditional rendering for events with values
const needsEventValue = (eventType: string) => {
const eventsWithValues = [
@@ -143,7 +136,6 @@ const Action = ({ blockObjectsState }) => {
-
);
-};
-
-export default Action;
+});
+export default Action;
\ No newline at end of file
diff --git a/src/components/UpdatedReactTestComponent/Assertion/Assertion.tsx b/src/components/UpdatedReactTestComponent/Assertion/Assertion.tsx
index f400339b..ec312ddf 100644
--- a/src/components/UpdatedReactTestComponent/Assertion/Assertion.tsx
+++ b/src/components/UpdatedReactTestComponent/Assertion/Assertion.tsx
@@ -8,46 +8,37 @@ import ToolTip from '../../ToolTip/ToolTip';
import ToolTipMatcher from '../../ToolTip/ToolTipMatcher';
import AutoComplete from '../../AutoComplete/AutoComplete';
import UpdatedAutoComplete from '../../AutoComplete/UpdatedAutoComplete';
-
import { GlobalContext } from '../../../context/reducers/globalReducer';
import { AiOutlineClose } from 'react-icons/ai';
import { ReactTestComponentAssertion } from '../../../utils/updatedReactTypes';
-import { RTFsContexts } from '../../../context/RTFsContextsProvider';
-
+import { useRTFsContexts } from '../../../context/RTFsContextsProvider';
const questionIcon = require('../../../assets/images/help-circle.png');
-
// This is tracking the assertions that you have in a certain test, following the flow of data will help
// you better understand how exactly this is working
-
type EventTypes =
| React.ChangeEvent
| React.ChangeEvent;
-
type FieldTypes =
| 'queryVariant'
| 'querySelector'
| 'queryValue'
| 'matcherValue';
-
-const Assertion = ({ blockObjectsState }) => {
+const Assertion = React.memo(({ blockObjectsState }) => {
const thisBlockObjectsState = blockObjectsState;
-
const { handleAddBlock, handleChange, handleDeleteBlock, rTFDispatch } =
- useContext(RTFsContexts);
+ // useContext(RTFsContexts);
+ useRTFsContexts();
const [{ theme }] = useContext(GlobalContext);
-
/*const handleChangeAssertionFields = (e: EventTypes, field: FieldTypes) => {
let updatedAssertion = { ...statement };
updatedAssertion[field] = e.target.value;
dispatchToReactTestCase(updateAssertion(updatedAssertion));
};*/
-
/*const handleIsNot = () => {
let updatedAssertion = { ...statement };
updatedAssertion.isNot = !updatedAssertion.isNot;
dispatchToReactTestCase(updateAssertion(updatedAssertion));
};*/
-
const needsMatcherValue = (matcherType: string) => {
const matchersWithValues = [
'toContainElement', //takes in a HTML element Ex:
@@ -122,7 +113,6 @@ const Assertion = ({ blockObjectsState }) => {
];
return matchersWithValues.includes(matcherType);
};
-
return (
{
dispatchToTestCase={rTFDispatch}
id={styles.matcherAuto}
/>*/}
-
@@ -295,6 +284,5 @@ const Assertion = ({ blockObjectsState }) => {
);
-};
-
-export default Assertion;
+});
+export default Assertion;
\ No newline at end of file
diff --git a/src/components/UpdatedReactTestComponent/DescribeBlock/DescribeBlock.tsx b/src/components/UpdatedReactTestComponent/DescribeBlock/DescribeBlock.tsx
index 329e3b76..cdfea052 100644
--- a/src/components/UpdatedReactTestComponent/DescribeBlock/DescribeBlock.tsx
+++ b/src/components/UpdatedReactTestComponent/DescribeBlock/DescribeBlock.tsx
@@ -1,4 +1,4 @@
-import React, { useState, useEffect, useContext } from 'react';
+import React, { useContext, useMemo } from 'react';
import cn from 'classnames';
import describeBlockStyles from './DescribeRenderer.module.scss';
import { AiOutlineCloseCircle } from 'react-icons/ai';
@@ -11,7 +11,7 @@ import {
} from '@mui/material';
import { DescribeBlocks } from '../../../utils/reactTypes';
import { GlobalContext } from '../../../context/reducers/globalReducer';
-import { RTFsContexts } from '../../../context/RTFsContextsProvider';
+import { useRTFsContexts } from '../../../context/RTFsContextsProvider';
import styles from '../../Modals/Modal.module.scss';
@@ -24,7 +24,7 @@ interface DescribeBlockProps {
theme: string;
}
-const DescribeBlock = ({ blockObjectsState }) => {
+const DescribeBlock = React.memo(({ blockObjectsState }) => {
const [{ theme }] = useContext(GlobalContext);
const thisBlockObjectsState = blockObjectsState;
@@ -34,8 +34,9 @@ const DescribeBlock = ({ blockObjectsState }) => {
handleChange,
handleDeleteBlock,
setChildrenComponents,
- } = useContext(RTFsContexts);
+ } = useRTFsContexts();
+ console.log(`describe ${thisBlockObjectsState.key} rerendered`);
// useEffect(() => {
// setHasSetupTeardown(false);
// }, []);
@@ -46,9 +47,13 @@ const DescribeBlock = ({ blockObjectsState }) => {
//}
- const { setupTeardownBlock, arrayOfChildComponents } = setChildrenComponents(
- blockObjectsState,
- theme
+ const { setupTeardownBlock, arrayOfChildComponents } = useMemo(
+ () =>
+ setChildrenComponents(
+ blockObjectsState
+ //theme
+ ),
+ [blockObjectsState]
);
return (
@@ -150,6 +155,6 @@ const DescribeBlock = ({ blockObjectsState }) => {
>
);
-};
+});
-export default DescribeBlock;
+export default DescribeBlock;
\ No newline at end of file
diff --git a/src/components/UpdatedReactTestComponent/Render/Render.tsx b/src/components/UpdatedReactTestComponent/Render/Render.tsx
index 048d0e41..704115c4 100644
--- a/src/components/UpdatedReactTestComponent/Render/Render.tsx
+++ b/src/components/UpdatedReactTestComponent/Render/Render.tsx
@@ -4,7 +4,7 @@
import React, { useContext } from 'react';
import styles from './Render.module.scss';
-import { RTFsContexts } from '../../../context/RTFsContextsProvider';
+import { useRTFsContexts } from '../../../context/RTFsContextsProvider';
import Prop from './Prop';
import { Button } from '@mui/material';
@@ -14,12 +14,13 @@ import { RenderProps } from '../../../utils/reactTypes';
// this is the file that shows what component you are rendering in your test
-const Render = ({ blockObjectsState }) => {
+const Render = React.memo(({ blockObjectsState }) => {
const thisBlockObjectsState = blockObjectsState;
const [{ theme }] = useContext(GlobalContext);
const { handleAddBlock, handleChange, handleDeleteBlock } =
- useContext(RTFsContexts);
+ //useContext(RTFsContexts);
+ useRTFsContexts();
return (
@@ -60,6 +61,6 @@ const Render = ({ blockObjectsState }) => {
);
-};
+});
-export default Render;
+export default Render;
\ No newline at end of file
diff --git a/src/components/UpdatedReactTestComponent/TestBlock/TestBlock.tsx b/src/components/UpdatedReactTestComponent/TestBlock/TestBlock.tsx
index cd4ec23e..9a01fc88 100644
--- a/src/components/UpdatedReactTestComponent/TestBlock/TestBlock.tsx
+++ b/src/components/UpdatedReactTestComponent/TestBlock/TestBlock.tsx
@@ -8,7 +8,7 @@ import {
} from '../../../context/actions/updatedFrontendFrameworkTestCaseActions';
import { GlobalContext } from '../../../context/reducers/globalReducer';
-import { RTFsContexts } from '../../../context/RTFsContextsProvider';
+import { useRTFsContexts } from '../../../context/RTFsContextsProvider';
import styles from './ItRenderer.module.scss';
import { Button, TextField } from '@mui/material';
import { AiOutlineClose } from 'react-icons/ai';
@@ -19,16 +19,17 @@ import { ItStatements, Statements } from '../../../utils/updatedReactTypes';
interface ItBlockProps {}
-const TestBlock = ({ blockObjectsState }) => {
+const TestBlock = React.memo(({ blockObjectsState }) => {
const [{ theme }] = useContext(GlobalContext);
const {
handleAddBlock,
handleChange,
handleDeleteBlock,
setChildrenComponents,
- } = useContext(RTFsContexts);
-
+ } = useRTFsContexts();
const thisBlockObjectsState = blockObjectsState;
+ console.log(`Test Block ${thisBlockObjectsState.key} rerendered`);
+
const { setupTeardownBlock, arrayOfChildComponents } = setChildrenComponents(
blockObjectsState,
theme
@@ -117,6 +118,6 @@ const TestBlock = ({ blockObjectsState }) => {
>
);
-};
+});
-export default TestBlock;
+export default TestBlock;
\ No newline at end of file
diff --git a/src/context/RTFsContextsProvider.tsx b/src/context/RTFsContextsProvider.tsx
index e84a4b02..3b00cab0 100644
--- a/src/context/RTFsContextsProvider.tsx
+++ b/src/context/RTFsContextsProvider.tsx
@@ -1,4 +1,10 @@
-import React, { createContext, useReducer } from 'react';
+import React, {
+ createContext,
+ useContext,
+ useCallback,
+ useMemo,
+ useReducer,
+} from 'react';
import {
reactTestFileReducer,
@@ -42,7 +48,57 @@ const RTFsContextsProvider = ({ children }) => {
let setupTeardownBlock = '';
const arrayOfChildComponents = [];
Object.values(parent.children).forEach((childComponent: object) => {
- if (childComponent['objectType'] === 'describe') {
+ switch (childComponent['objectType']) {
+ case 'describe':
+ arrayOfChildComponents.push(
+
+ );
+ case 'setupTeardown':
+ setupTeardownBlock = (
+
+ );
+ case 'test':
+ arrayOfChildComponents.push(
+
+ );
+ case 'statement':
+ if (
+ childComponent['statementType'] === 'render' //&&
+ //(!extraClauses || !extraClauses['setupTeardownExist'])
+ ) {
+ arrayOfChildComponents.push(
+
+ );
+ //setHasSetupTeardown(true);
+ } else if (childComponent['statementType'] === 'action') {
+ arrayOfChildComponents.push(
+
+ );
+ } else if (childComponent['statementType'] === 'assertion') {
+ arrayOfChildComponents.push(
+
+ );
+ }
+ }
+ /*if (childComponent['objectType'] === 'describe') {
arrayOfChildComponents.push(
{
/>
);
}
- }
+ }*/
});
return { setupTeardownBlock, arrayOfChildComponents };
};
@@ -114,37 +170,46 @@ const RTFsContextsProvider = ({ children }) => {
});
};
- const handleAddBlock = (
- e: React.SyntheticEvent,
- objectType: String,
- addObjectToWhere: String //filepath
- ) => {
- const newObjectsKey = uid(8);
- rTFDispatch(
- addObjectToStateObject(objectType, addObjectToWhere, newObjectsKey)
- );
- };
+ const handleAddBlock = useCallback(
+ (
+ e: React.SyntheticEvent,
+ objectType: String,
+ addObjectToWhere: String //filepath
+ ) => {
+ const newObjectsKey = uid(8);
+ rTFDispatch(
+ addObjectToStateObject(objectType, addObjectToWhere, newObjectsKey)
+ );
+ },
+ []
+ );
- const handleChange = (
- pathToTargetStateObject: String,
- propertyToUpdate: String,
- updatedValue: String
- ): void => {
- rTFDispatch(
- updateObjectInStateObject(
- pathToTargetStateObject,
- propertyToUpdate,
- updatedValue
- )
- );
- };
+ const handleChange = useCallback(
+ (
+ pathToTargetStateObject: String,
+ propertyToUpdate: String,
+ updatedValue: String
+ ): void => {
+ rTFDispatch(
+ updateObjectInStateObject(
+ pathToTargetStateObject,
+ propertyToUpdate,
+ updatedValue
+ )
+ );
+ },
+ []
+ );
- const handleDeleteBlock = (
- parentsFilepath: String, //filepath
- targetsKey: String //parentsFilepath
- ) => {
- rTFDispatch(deleteObjectFromStateObject(parentsFilepath, targetsKey));
- };
+ const handleDeleteBlock = useCallback(
+ (
+ parentsFilepath: String, //filepath
+ targetsKey: String //parentsFilepath
+ ) => {
+ rTFDispatch(deleteObjectFromStateObject(parentsFilepath, targetsKey));
+ },
+ []
+ );
return (
{
);
};
-export default RTFsContextsProvider;
+export const useRTFsContexts = () => {
+ return useContext(RTFsContexts);
+};
+
+export default RTFsContextsProvider;
\ No newline at end of file
diff --git a/src/context/actions/updatedFrontendFrameworkTestCaseActions.ts b/src/context/actions/updatedFrontendFrameworkTestCaseActions.ts
index d1f52b59..b6ff397b 100644
--- a/src/context/actions/updatedFrontendFrameworkTestCaseActions.ts
+++ b/src/context/actions/updatedFrontendFrameworkTestCaseActions.ts
@@ -17,22 +17,6 @@ export const actionTypes = {
UPDATE_ITSTATEMENT_ORDER: 'UPDATE_ITSTATEMENT_ORDER',
- ADD_ACTION: 'ADD_ACTION',
- DELETE_ACTION: 'DELETE_ACTION',
- UPDATE_ACTION: 'UPDATE_ACTION',
-
- ADD_ASSERTION: 'ADD_ASSERTION',
- DELETE_ASSERTION: 'DELETE_ASSERTION',
- UPDATE_ASSERTION: 'UPDATE_ASSERTION',
-
- ADD_RENDER: 'ADD_RENDER',
- DELETE_RENDER: 'DELETE_RENDER',
- UPDATE_RENDER_COMPONENT: 'UPDATE_RENDER_COMPONENT',
-
- ADD_PROP: 'ADD_PROP',
- DELETE_PROP: 'DELETE_PROP',
- UPDATE_PROP: 'UPDATE_PROP',
-
CREATE_NEW_TEST: 'CREATE_NEW_TEST',
OPEN_INFO_MODAL: 'OPEN_INFO_MODAL',
CLOSE_INFO_MODAL: 'CLOSE_INFO_MODAL',
@@ -154,4 +138,4 @@ export function deleteObjectFromStateObject(parentsFilepath, targetsKey) {
type: actionTypes.DELETE_OBJECT_FROM_STATE_OBJECT,
payload: { parentsFilepath, targetsKey },
};
-}
+}
\ No newline at end of file
diff --git a/src/context/updatedUseGenerateTest.jsx b/src/context/updatedUseGenerateTest.jsx
index 483fd8ed..f11103a3 100644
--- a/src/context/updatedUseGenerateTest.jsx
+++ b/src/context/updatedUseGenerateTest.jsx
@@ -1751,7 +1751,7 @@ function useGenerateTest(test, projectFilePath) {
e4x: true,
}))
);
- //---------------------------------------------------React switch statement---------------------------------------------
+ //---------------------------------------------------Updated React switch statement---------------------------------------------
case 'updatedReact':
var reactTestCase = testState;
var mockData = mockDataState;