File tree Expand file tree Collapse file tree 1 file changed +31
-3
lines changed
tests/src/unit/core/formatConversion Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Original file line number Diff line number Diff line change 9
9
PartialBlock ,
10
10
PartialInlineContent ,
11
11
PartialTableCell ,
12
+ PartialTableContent ,
12
13
StyledText ,
13
14
StyleSchema ,
14
15
TableCell ,
@@ -153,10 +154,10 @@ export function partialBlockToBlockForTesting<
153
154
) ;
154
155
155
156
if ( contentType === "inline" ) {
156
- const content = withDefaults . content as InlineContent < I , S > [ ] | undefined ;
157
+ const content = withDefaults . content as PartialInlineContent < I , S > ;
157
158
withDefaults . content = partialContentToInlineContent ( content ) as any ;
158
159
} else if ( contentType === "table" ) {
159
- const content = withDefaults . content as TableContent < I , S > | undefined ;
160
+ const content = withDefaults . content as PartialTableContent < I , S > ;
160
161
withDefaults . content = {
161
162
type : "tableContent" ,
162
163
columnWidths :
@@ -167,7 +168,34 @@ export function partialBlockToBlockForTesting<
167
168
headerCols : content ?. headerCols || undefined ,
168
169
rows :
169
170
content ?. rows . map ( ( row ) => ( {
170
- cells : row . cells . map ( ( cell ) => partialContentToInlineContent ( cell ) ) ,
171
+ cells : row . cells . map ( ( cell ) =>
172
+ typeof cell === "object" &&
173
+ "type" in cell &&
174
+ cell . type === "tableCell"
175
+ ? {
176
+ type : "tableCell" ,
177
+ props : {
178
+ backgroundColor : "default" ,
179
+ colspan : 1 ,
180
+ rowspan : 1 ,
181
+ textAlignment : "left" ,
182
+ textColor : "default" ,
183
+ ...cell . props ,
184
+ } ,
185
+ content : partialContentToInlineContent ( cell . content ) ,
186
+ }
187
+ : {
188
+ type : "tableCell" ,
189
+ props : {
190
+ backgroundColor : "default" ,
191
+ colspan : 1 ,
192
+ rowspan : 1 ,
193
+ textAlignment : "left" ,
194
+ textColor : "default" ,
195
+ } ,
196
+ content : partialContentToInlineContent ( cell ) ,
197
+ }
198
+ ) ,
171
199
} ) ) || [ ] ,
172
200
} as any ;
173
201
}
You can’t perform that action at this time.
0 commit comments