@@ -25,26 +25,25 @@ describe('Table.Expanded', () => {
25
25
domSpy . mockRestore ( ) ;
26
26
} ) ;
27
27
28
- const columns : ColumnsType = [
29
- {
30
- title : 'key' ,
31
- dataIndex : 'key' ,
32
- width : 100 ,
33
- onCell : ( _ , index ) => {
34
- const props : React . TdHTMLAttributes < HTMLTableCellElement > = { } ;
35
- if ( index === 0 ) props . rowSpan = 1 ;
36
- if ( index === 1 ) props . rowSpan = 2 ;
37
- if ( index === 2 ) props . rowSpan = 0 ;
38
- if ( index === 3 ) props . rowSpan = undefined ;
39
- return props ;
40
- } ,
41
- } ,
42
- Table . EXPAND_COLUMN ,
43
- { title : 'key2' , dataIndex : 'key2' , width : 100 } ,
44
- ] ;
45
- const data = [ { key : 'a' } , { key : 'b' } , { key : 'c' } , { key : 'd' } ] ;
46
-
47
28
it ( 'expanded + rowSpan' , async ( ) => {
29
+ const columns : ColumnsType = [
30
+ {
31
+ title : 'key' ,
32
+ dataIndex : 'key' ,
33
+ width : 100 ,
34
+ onCell : ( _ , index ) => {
35
+ const props : React . TdHTMLAttributes < HTMLTableCellElement > = { } ;
36
+ if ( index === 0 ) props . rowSpan = 1 ;
37
+ if ( index === 1 ) props . rowSpan = 2 ;
38
+ if ( index === 2 ) props . rowSpan = 0 ;
39
+ if ( index === 3 ) props . rowSpan = undefined ;
40
+ return props ;
41
+ } ,
42
+ } ,
43
+ Table . EXPAND_COLUMN ,
44
+ { title : 'key2' , dataIndex : 'key2' , width : 100 } ,
45
+ ] ;
46
+ const data = [ { key : 'a' } , { key : 'b' } , { key : 'c' } , { key : 'd' } ] ;
48
47
const { container } = render (
49
48
< Table < Record < string , any > >
50
49
columns = { columns }
@@ -84,4 +83,41 @@ describe('Table.Expanded', () => {
84
83
expect ( trList [ 7 ] . querySelectorAll ( 'td' ) . length ) . toBe ( 1 ) ;
85
84
expect ( trList [ 7 ] . querySelectorAll ( 'td' ) [ 0 ] . getAttribute ( 'colspan' ) ) . toBe ( '3' ) ;
86
85
} ) ;
86
+
87
+ it ( 'expanded + sticky' , async ( ) => {
88
+ const columns : ColumnsType = [
89
+ {
90
+ title : '手机号' ,
91
+ dataIndex : 'a' ,
92
+ width : 100 ,
93
+ fixed : 'left' ,
94
+ onCell : ( _ , index ) => {
95
+ const props : React . TdHTMLAttributes < HTMLTableCellElement > = { } ;
96
+ if ( index === 0 ) props . rowSpan = 1 ;
97
+ if ( index === 1 ) props . rowSpan = 2 ;
98
+ if ( index === 2 ) props . rowSpan = 0 ;
99
+ return props ;
100
+ } ,
101
+ } ,
102
+ Table . EXPAND_COLUMN ,
103
+ { title : 'Name' , dataIndex : 'c' } ,
104
+ ] ;
105
+ const data = [ { key : 'a' } , { key : 'b' } , { key : 'c' } , { key : 'd' } ] ;
106
+ const { container } = render (
107
+ < Table < Record < string , any > >
108
+ columns = { columns }
109
+ data = { data }
110
+ sticky
111
+ expandable = { {
112
+ defaultExpandAllRows : true ,
113
+ expandedRowRender : record => < div > { record . key } </ div > ,
114
+ } }
115
+ /> ,
116
+ ) ;
117
+ console . log ( 'container' , container ) ;
118
+ await act ( async ( ) => {
119
+ vi . runAllTimers ( ) ;
120
+ await Promise . resolve ( ) ;
121
+ } ) ;
122
+ } ) ;
87
123
} ) ;
0 commit comments