Skip to content

Commit 06b84af

Browse files
committed
Added advanced table test
1 parent b2c3660 commit 06b84af

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

tests/src/unit/core/formatConversion/exportParseEquality/exportParseEqualityTestInstances.ts

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,115 @@ export const exportParseEqualityTestInstancesHTML: TestInstance<
200200
},
201201
executeTest: testExportParseEqualityHTML,
202202
},
203+
{
204+
testCase: {
205+
name: "tables/advanced",
206+
content: [
207+
{
208+
type: "table",
209+
content: {
210+
type: "tableContent",
211+
columnWidths: [199, 148, 201],
212+
headerRows: 1,
213+
rows: [
214+
{
215+
cells: [
216+
{
217+
type: "tableCell",
218+
content: "This row has headers",
219+
props: {
220+
textAlignment: "center",
221+
},
222+
},
223+
{
224+
type: "tableCell",
225+
content: [
226+
{
227+
type: "text",
228+
text: "This is ",
229+
styles: {},
230+
},
231+
{
232+
type: "text",
233+
text: "RED",
234+
styles: {
235+
bold: true,
236+
},
237+
},
238+
],
239+
props: {
240+
backgroundColor: "red",
241+
textAlignment: "center",
242+
},
243+
},
244+
{
245+
type: "tableCell",
246+
content: "Text is Blue",
247+
props: {
248+
textColor: "blue",
249+
textAlignment: "center",
250+
},
251+
},
252+
],
253+
},
254+
{
255+
cells: [
256+
{
257+
type: "tableCell",
258+
content: "This spans 2 columns\nand 2 rows",
259+
props: {
260+
colspan: 2,
261+
rowspan: 2,
262+
backgroundColor: "yellow",
263+
},
264+
},
265+
{
266+
type: "tableCell",
267+
content: "Sooo many features",
268+
props: {
269+
backgroundColor: "gray",
270+
textColor: "default",
271+
textAlignment: "left",
272+
},
273+
},
274+
],
275+
},
276+
{
277+
cells: [
278+
{
279+
type: "tableCell",
280+
content: [],
281+
props: {
282+
backgroundColor: "gray",
283+
textColor: "purple",
284+
},
285+
},
286+
],
287+
},
288+
{
289+
cells: [
290+
{
291+
type: "tableCell",
292+
content: "A cell",
293+
},
294+
{
295+
type: "tableCell",
296+
content: "Another Cell",
297+
},
298+
{
299+
type: "tableCell",
300+
content: "Aligned center",
301+
props: {
302+
textAlignment: "center",
303+
},
304+
},
305+
],
306+
},
307+
],
308+
},
309+
},
310+
],
311+
},
312+
executeTest: testExportParseEqualityHTML,
313+
},
203314
];

tests/src/unit/core/setupTestEditor.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export const setupTestEditor = <
3636
},
3737
},
3838
schema,
39+
tables: {
40+
splitCells: true,
41+
cellBackgroundColor: true,
42+
cellTextColor: true,
43+
headers: true,
44+
},
3945
trailingBlock: false,
4046
uploadFile: uploadToTmpFilesDotOrg_DEV_ONLY,
4147
});

0 commit comments

Comments
 (0)