Skip to content

Commit

Permalink
test(table): add mergeChildren to parseTableHtml
Browse files Browse the repository at this point in the history
  • Loading branch information
cycleccc committed Jan 31, 2025
1 parent 5c05143 commit 9f16956
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions packages/table-module/__tests__/parse-html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,54 @@ describe('table - parse html', () => {
children: [{ type: 'table-cell', children: [{ text: 'hello world' }] }],
},
]
const mergeChildren = [
{
type: 'table-row',
children: [
{
type: 'table-cell',
isHeader: false,
colSpan: 2,
rowSpan: 1,
width: 'auto',
children: [
{
text: '',
},
],
hidden: false,
borderWidth: '1',
borderStyle: 'solid',
borderColor: '#ccc',
},
{
type: 'table-cell',
children: [
{
text: '',
},
],
hidden: true,
},
{
type: 'table-cell',
isHeader: false,
colSpan: 1,
rowSpan: 1,
width: 'auto',
children: [
{
text: '',
},
],
hidden: true,
borderWidth: '1',
borderStyle: 'solid',
borderColor: '#ccc',
},
],
},
]

expect($table[0].matches(parseTableHtmlConf.selector)).toBeTruthy()

Expand All @@ -106,5 +154,12 @@ describe('table - parse html', () => {
children,
height: 0,
})

expect(parseTableHtmlConf.parseElemHtml($table[0], mergeChildren, editor)).toEqual({

Check failure on line 158 in packages/table-module/__tests__/parse-html.test.ts

View workflow job for this annotation

GitHub Actions / test

packages/table-module/__tests__/parse-html.test.ts > table - parse html > table

AssertionError: expected { type: 'table', width: '100%', …(2) } to deeply equal { type: 'table', width: '100%', …(2) } - Expected + Received Object { - "height": 0, - "mergeChildren": Array [ + "children": Array [ Object { "children": Array [ Object { "borderColor": "#ccc", "borderStyle": "solid", "borderWidth": "1", "children": Array [ Object { "text": "", }, ], "colSpan": 2, "hidden": false, "isHeader": false, "rowSpan": 1, "type": "table-cell", "width": "auto", }, Object { "children": Array [ Object { "text": "", }, ], "hidden": true, "type": "table-cell", }, Object { "borderColor": "#ccc", "borderStyle": "solid", "borderWidth": "1", "children": Array [ Object { "text": "", }, ], "colSpan": 1, "hidden": true, "isHeader": false, "rowSpan": 1, "type": "table-cell", "width": "auto", }, ], "type": "table-row", }, ], + "height": 0, "type": "table", "width": "100%", } ❯ packages/table-module/__tests__/parse-html.test.ts:158:80
type: 'table',
width: '100%',
mergeChildren,
height: 0,
})
})
})

0 comments on commit 9f16956

Please sign in to comment.