1
- import React , { useReducer } from 'react' ;
1
+ import React , { useReducer } from 'react' ;
2
2
import '@testing-library/jest-dom' ;
3
3
import { DndProvider } from 'react-dnd' ;
4
4
import { HTML5Backend } from 'react-dnd-html5-backend' ;
5
5
import { render , fireEvent , cleanup , screen } from '@testing-library/react' ;
6
- import StateContext from '../app/src/context/context' ;
7
- import initialState from '../app/src/context/initialState' ;
8
- import reducer from '../app/src/reducers/componentReducer' ;
6
+ // import StateContext from '../app/src/context/context';
7
+ // import initialState from '../app/src/context/initialState';
8
+ // import reducer from '../app/src/reducers/componentReducer';
9
9
import HTMLPanel from '../app/src/components/left/HTMLPanel' ;
10
10
function Test ( ) {
11
11
const [ state , dispatch ] = useReducer ( reducer , initialState ) ;
12
12
return (
13
13
< DndProvider backend = { HTML5Backend } >
14
- < StateContext . Provider value = { [ state , dispatch ] } >
15
- < HTMLPanel />
16
- </ StateContext . Provider >
14
+ { /* <StateContext.Provider value={[state, dispatch]}> */ }
15
+ < HTMLPanel />
16
+ { /* </StateContext.Provider> */ }
17
17
</ DndProvider >
18
- )
18
+ ) ;
19
19
}
20
20
xtest ( 'Renders HTMLPanel component properly' , ( ) => {
21
- render (
22
- < Test />
23
- ) ;
21
+ render ( < Test /> ) ;
24
22
expect ( screen . getAllByRole ( 'textbox' ) ) . toHaveLength ( 2 ) ;
25
23
expect ( screen . getByText ( 'Div' ) ) . toBeInTheDocument ( ) ;
26
24
expect ( screen . getByText ( 'Image' ) ) . toBeInTheDocument ( ) ;
@@ -36,9 +34,7 @@ xtest('Renders HTMLPanel component properly', () => {
36
34
} ) ;
37
35
38
36
xtest ( 'Adds new custom element' , ( ) => {
39
- render (
40
- < Test />
41
- ) ;
37
+ render ( < Test /> ) ;
42
38
fireEvent . change ( screen . getAllByRole ( 'textbox' ) [ 0 ] , {
43
39
target : { value : 'Testing' }
44
40
} ) ;
0 commit comments