File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 11import { createContext } from 'react' ;
22import { PuppeteerTestCaseState , PuppeteerAction } from '../../utils/puppeteerTypes' ;
3- //import { actionTypes } from '../actions/puppeteerTestCaseActions';
3+
44export const PuppeteerTestCaseContext = createContext < any > ( null ) ;
55
66export const puppeteerTestCaseState = {
@@ -21,7 +21,7 @@ export const puppeteerTestCaseState = {
2121 browserOptionId : 0 ,
2222 } ,
2323 ] ,
24- statementId : 0 ,
24+ statementId : 1 ,
2525 modalOpen : false ,
2626} ;
2727
@@ -56,10 +56,14 @@ export const puppeteerTestCaseReducer = (
5656
5757 switch ( action . type ) {
5858 case 'DELETE_PUPPETEER_TEST' :
59- puppeteerStatements = puppeteerStatements . filter ( ( statement ) => statement . id !== action . id ) ;
59+ puppeteerStatements . splice ( action . id , 1 ) ;
60+ puppeteerStatements . forEach ( ( statement ) => {
61+ if ( statement . id > action . id ) statement . id -= 1 ;
62+ } ) ;
6063 return {
6164 ...state ,
6265 puppeteerStatements,
66+ statementId : state . statementId - 1 ,
6367 } ;
6468
6569 case 'ADD_PUPPETEER_PAINT_TIMING' : {
@@ -90,7 +94,7 @@ export const puppeteerTestCaseReducer = (
9094 browserOptionId : 0 ,
9195 } ,
9296 ] ,
93- statementId : 0 ,
97+ statementId : 1 ,
9498 } ;
9599
96100 case 'DELETE_BROWSER_OPTION' :
@@ -171,7 +175,6 @@ export const puppeteerTestCaseReducer = (
171175 puppeteerStatements : [ ...action . draggableStatements ] ,
172176 } ;
173177 case 'OPEN_INFO_MODAL' :
174- console . log ( 'reducer' ) ;
175178 return {
176179 ...state ,
177180 modalOpen : true ,
You can’t perform that action at this time.
0 commit comments