File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Component , PureComponent } from 'react'
2
+ import { easyComp , easyStore } from 'react-easy-state'
3
+
4
+ describe ( 'static props' , ( ) => {
5
+ test ( 'easyComp should proxy react specific static properties from the component' , ( ) => {
6
+ class Comp extends Component { }
7
+ function FuncComp ( ) { }
8
+
9
+ Comp . displayName = FuncComp . displayName = 'Name'
10
+ Comp . contextTypes = FuncComp . contextTypes = { }
11
+ Comp . propTypes = FuncComp . propTypes = { }
12
+ Comp . defaultProps = FuncComp . defaultProps = { }
13
+
14
+ const EasyComp = easyComp ( Comp )
15
+ const EasyFuncComp = easyComp ( FuncComp )
16
+
17
+ expect ( EasyComp . displayName ) . toBe ( Comp . displayName )
18
+ expect ( EasyComp . contextTypes ) . toBe ( Comp . contextTypes )
19
+ expect ( EasyComp . propTypes ) . toBe ( Comp . propTypes )
20
+ expect ( EasyComp . defaultProps ) . toBe ( Comp . defaultProps )
21
+
22
+ expect ( EasyFuncComp . displayName ) . toBe ( FuncComp . displayName )
23
+ expect ( EasyFuncComp . contextTypes ) . toBe ( FuncComp . contextTypes )
24
+ expect ( EasyFuncComp . propTypes ) . toBe ( FuncComp . propTypes )
25
+ expect ( EasyFuncComp . defaultProps ) . toBe ( FuncComp . defaultProps )
26
+ } )
27
+ } )
You can’t perform that action at this time.
0 commit comments