1
- import { CellProps , Grid , GridProps } from "@/components" ;
2
- import { renderCUI } from "@/utils/test-utils" ;
3
- import { SelectionFocus } from "./types" ;
4
- import { ReactNode } from "react" ;
1
+ import { CellProps , Grid , GridProps } from "@/components" ;
2
+ import { renderCUI } from "@/utils/test-utils" ;
3
+ import { SelectionFocus } from "./types" ;
4
+ import { ReactNode } from "react" ;
5
5
6
6
const Cell : CellProps = ( { type, rowIndex, columnIndex, isScrolling, ...props } ) => {
7
- let content = `${ rowIndex } ${ columnIndex } - ${ type } ` ;
8
-
9
- if ( rowIndex === 0 && columnIndex === 0 ) {
10
- content = `CREATE TABLE random_user_events (
11
- user_id UInt32,
12
- event_time DateTime,
13
- event_type Enum8('click' = 1, 'view' = 2, 'purchase' = 3),
14
- item_id String,
15
- price Decimal(10,2),
16
- quantity UInt16
17
- ) ENGINE = MergeTree()
18
- ORDER BY (user_id, event_time)
19
- PARTITION BY toYYYYMM(event_time)
20
- SETTINGS index_granularity = 8192;` ;
21
- }
22
-
23
7
return (
24
8
< div
25
9
data-scrolling = { isScrolling }
26
10
{ ...props }
27
11
data-testid = { `${ type } -${ rowIndex ?? "x" } -${ columnIndex ?? "x" } ` }
28
12
>
29
- { content }
13
+ { rowIndex } { columnIndex } - { type }
30
14
</ div >
31
15
) ;
32
16
} ;
@@ -47,7 +31,6 @@ interface Props
47
31
focus ?: SelectionFocus ;
48
32
onFocusChange ?: ( rowIndex : number , columnIndex : number ) => void ;
49
33
onColumnResize ?: ( ) => void ;
50
- rowAutoHeight ?: boolean ;
51
34
}
52
35
type AutoSizerModule = typeof import ( "react-virtualized-auto-sizer" ) ;
53
36
@@ -77,7 +60,6 @@ describe("Grid", () => {
77
60
onColumnResize,
78
61
focus,
79
62
onFocusChange,
80
- rowAutoHeight,
81
63
...props
82
64
} : Props ) =>
83
65
renderCUI (
@@ -90,7 +72,6 @@ describe("Grid", () => {
90
72
onColumnResize = { onColumnResize ?? onColumnResizeTestFn }
91
73
onFocusChange = { onFocusChange ?? onFocusChangeTestFn }
92
74
getMenuOptions = { getMenuOptions }
93
- rowAutoHeight = { rowAutoHeight }
94
75
{ ...props }
95
76
/>
96
77
) ;
@@ -118,31 +99,4 @@ describe("Grid", () => {
118
99
cell && expect ( cell . dataset . selected ) . toEqual ( "true" ) ;
119
100
cell && expect ( cell . dataset . focused ) . toEqual ( "true" ) ;
120
101
} ) ;
121
-
122
- it ( "should set row height to default (33px) when rowAutoHeight is false" , async ( ) => {
123
- const { getByTestId } = renderGrid ( {
124
- rowCount : 10 ,
125
- columnCount : 10 ,
126
- rowAutoHeight : false ,
127
- } ) ;
128
-
129
- const cell = getByTestId ( "row-cell-0-0" ) ;
130
-
131
- const computedHeight = window . getComputedStyle ( cell ) . height ;
132
- const heightValue = parseFloat ( computedHeight ) ;
133
- expect ( heightValue ) . toBe ( 33 ) ;
134
- } ) ;
135
-
136
- it ( "should expand row height to 100% when rowAutoHeight is true" , async ( ) => {
137
- const { getByTestId } = renderGrid ( {
138
- rowCount : 1 ,
139
- columnCount : 1 ,
140
- rowAutoHeight : true ,
141
- } ) ;
142
-
143
- const cell = getByTestId ( "row-cell-0-0" ) ;
144
-
145
- const computedHeight = window . getComputedStyle ( cell ) . height ;
146
- expect ( computedHeight ) . toBe ( "100%" ) ;
147
- } ) ;
148
102
} ) ;
0 commit comments