@@ -40,21 +40,44 @@ describe('Table.Basic', () => {
40
40
} ) ;
41
41
} ) ;
42
42
43
- it ( 'renders empty text correctly' , ( ) => {
44
- const wrapper1 = mount ( createTable ( { data : [ ] , emptyText : 'No data' } ) ) ;
45
- const wrapper2 = mount ( createTable ( { data : [ ] , emptyText : ( ) => 'No data' } ) ) ;
46
- expect (
47
- wrapper1
48
- . find ( '.rc-table-placeholder' )
49
- . hostNodes ( )
50
- . text ( ) ,
51
- ) . toEqual ( 'No data' ) ;
52
- expect (
53
- wrapper2
54
- . find ( '.rc-table-placeholder' )
55
- . hostNodes ( )
56
- . text ( ) ,
57
- ) . toEqual ( 'No data' ) ;
43
+ describe ( 'renders empty text correctly' , ( ) => {
44
+ it ( 'ReactNode' , ( ) => {
45
+ const wrapper = mount ( createTable ( { data : [ ] , emptyText : 'No data' } ) ) ;
46
+ expect (
47
+ wrapper
48
+ . find ( '.rc-table-placeholder' )
49
+ . hostNodes ( )
50
+ . text ( ) ,
51
+ ) . toEqual ( 'No data' ) ;
52
+ } ) ;
53
+
54
+ it ( 'renderProps' , ( ) => {
55
+ const wrapper = mount ( createTable ( { data : [ ] , emptyText : ( ) => 'No data' } ) ) ;
56
+ expect (
57
+ wrapper
58
+ . find ( '.rc-table-placeholder' )
59
+ . hostNodes ( )
60
+ . text ( ) ,
61
+ ) . toEqual ( 'No data' ) ;
62
+ } ) ;
63
+
64
+ it ( 'effect update' , ( ) => {
65
+ const App = ( ) => {
66
+ const [ emptyText , setEmptyText ] = React . useState ( 'light' ) ;
67
+ React . useEffect ( ( ) => {
68
+ setEmptyText ( 'bamboo' ) ;
69
+ } , [ ] ) ;
70
+ return < Table emptyText = { emptyText } /> ;
71
+ } ;
72
+ const wrapper = mount ( < App /> ) ;
73
+ wrapper . update ( ) ;
74
+ expect (
75
+ wrapper
76
+ . find ( '.rc-table-placeholder' )
77
+ . hostNodes ( )
78
+ . text ( ) ,
79
+ ) . toEqual ( 'bamboo' ) ;
80
+ } ) ;
58
81
} ) ;
59
82
60
83
it ( 'renders without header' , ( ) => {
0 commit comments