Skip to content

Commit 2a131e7

Browse files
committed
test(Slate) Tests for more headings and thematic breaks
Signed-off-by: Jerome Simeon <[email protected]>
1 parent 6dee40a commit 2a131e7

File tree

5 files changed

+355
-2
lines changed

5 files changed

+355
-2
lines changed

packages/markdown-slate/src/__snapshots__/SlateTransformer.test.js.snap

Lines changed: 250 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,45 @@ Object {
13541354
},
13551355
],
13561356
},
1357+
Object {
1358+
"$class": "org.accordproject.commonmark.Heading",
1359+
"level": "4",
1360+
"nodes": Array [
1361+
Object {
1362+
"$class": "org.accordproject.commonmark.Text",
1363+
"text": "H4",
1364+
},
1365+
],
1366+
},
1367+
Object {
1368+
"$class": "org.accordproject.commonmark.Heading",
1369+
"level": "5",
1370+
"nodes": Array [
1371+
Object {
1372+
"$class": "org.accordproject.commonmark.Text",
1373+
"text": "H5",
1374+
},
1375+
],
1376+
},
1377+
Object {
1378+
"$class": "org.accordproject.commonmark.Heading",
1379+
"level": "6",
1380+
"nodes": Array [
1381+
Object {
1382+
"$class": "org.accordproject.commonmark.Text",
1383+
"text": "H6",
1384+
},
1385+
],
1386+
},
1387+
Object {
1388+
"$class": "org.accordproject.commonmark.Paragraph",
1389+
"nodes": Array [
1390+
Object {
1391+
"$class": "org.accordproject.commonmark.Text",
1392+
"text": "####### Text!!",
1393+
},
1394+
],
1395+
},
13571396
Object {
13581397
"$class": "org.accordproject.commonmark.Paragraph",
13591398
"nodes": Array [
@@ -1378,7 +1417,20 @@ exports[`slate converts headings.json to and from CiceroMark 2`] = `
13781417
### H3
13791418
13801419
1381-
end."
1420+
#### H4
1421+
1422+
1423+
##### H5
1424+
1425+
1426+
###### H6
1427+
1428+
1429+
\\\\####### Text!!
1430+
1431+
1432+
end.
1433+
"
13821434
`;
13831435
13841436
exports[`slate converts headings.json to and from CiceroMark 3`] = `
@@ -1422,6 +1474,54 @@ Object {
14221474
"object": "block",
14231475
"type": "heading_three",
14241476
},
1477+
Object {
1478+
"data": Object {},
1479+
"nodes": Array [
1480+
Object {
1481+
"marks": Array [],
1482+
"object": "text",
1483+
"text": "H4",
1484+
},
1485+
],
1486+
"object": "block",
1487+
"type": "heading_four",
1488+
},
1489+
Object {
1490+
"data": Object {},
1491+
"nodes": Array [
1492+
Object {
1493+
"marks": Array [],
1494+
"object": "text",
1495+
"text": "H5",
1496+
},
1497+
],
1498+
"object": "block",
1499+
"type": "heading_five",
1500+
},
1501+
Object {
1502+
"data": Object {},
1503+
"nodes": Array [
1504+
Object {
1505+
"marks": Array [],
1506+
"object": "text",
1507+
"text": "H6",
1508+
},
1509+
],
1510+
"object": "block",
1511+
"type": "heading_six",
1512+
},
1513+
Object {
1514+
"data": Object {},
1515+
"nodes": Array [
1516+
Object {
1517+
"marks": Array [],
1518+
"object": "text",
1519+
"text": "####### Text!!",
1520+
},
1521+
],
1522+
"object": "block",
1523+
"type": "paragraph",
1524+
},
14251525
Object {
14261526
"data": Object {},
14271527
"nodes": Array [
@@ -1475,6 +1575,45 @@ Object {
14751575
},
14761576
],
14771577
},
1578+
Object {
1579+
"$class": "org.accordproject.commonmark.Heading",
1580+
"level": "4",
1581+
"nodes": Array [
1582+
Object {
1583+
"$class": "org.accordproject.commonmark.Text",
1584+
"text": "H4",
1585+
},
1586+
],
1587+
},
1588+
Object {
1589+
"$class": "org.accordproject.commonmark.Heading",
1590+
"level": "5",
1591+
"nodes": Array [
1592+
Object {
1593+
"$class": "org.accordproject.commonmark.Text",
1594+
"text": "H5",
1595+
},
1596+
],
1597+
},
1598+
Object {
1599+
"$class": "org.accordproject.commonmark.Heading",
1600+
"level": "6",
1601+
"nodes": Array [
1602+
Object {
1603+
"$class": "org.accordproject.commonmark.Text",
1604+
"text": "H6",
1605+
},
1606+
],
1607+
},
1608+
Object {
1609+
"$class": "org.accordproject.commonmark.Paragraph",
1610+
"nodes": Array [
1611+
Object {
1612+
"$class": "org.accordproject.commonmark.Text",
1613+
"text": "####### Text!!",
1614+
},
1615+
],
1616+
},
14781617
Object {
14791618
"$class": "org.accordproject.commonmark.Paragraph",
14801619
"nodes": Array [
@@ -5432,6 +5571,116 @@ Object {
54325571
}
54335572
`;
54345573
5574+
exports[`slate converts thematicbreak.json to and from CiceroMark 1`] = `
5575+
Object {
5576+
"$class": "org.accordproject.commonmark.Document",
5577+
"nodes": Array [
5578+
Object {
5579+
"$class": "org.accordproject.commonmark.Paragraph",
5580+
"nodes": Array [
5581+
Object {
5582+
"$class": "org.accordproject.commonmark.Text",
5583+
"text": "This is a",
5584+
},
5585+
],
5586+
},
5587+
Object {
5588+
"$class": "org.accordproject.commonmark.ThematicBreak",
5589+
},
5590+
Object {
5591+
"$class": "org.accordproject.commonmark.Paragraph",
5592+
"nodes": Array [
5593+
Object {
5594+
"$class": "org.accordproject.commonmark.Text",
5595+
"text": "thematic break",
5596+
},
5597+
],
5598+
},
5599+
],
5600+
"xmlns": "http://commonmark.org/xml/1.0",
5601+
}
5602+
`;
5603+
5604+
exports[`slate converts thematicbreak.json to and from CiceroMark 2`] = `
5605+
"This is a
5606+
5607+
----
5608+
5609+
thematic break"
5610+
`;
5611+
5612+
exports[`slate converts thematicbreak.json to and from CiceroMark 3`] = `
5613+
Object {
5614+
"document": Object {
5615+
"data": Object {},
5616+
"nodes": Array [
5617+
Object {
5618+
"data": Object {},
5619+
"nodes": Array [
5620+
Object {
5621+
"marks": Array [],
5622+
"object": "text",
5623+
"text": "This is a",
5624+
},
5625+
],
5626+
"object": "block",
5627+
"type": "paragraph",
5628+
},
5629+
Object {
5630+
"data": Object {},
5631+
"nodes": Array [],
5632+
"object": "block",
5633+
"type": "horizontal_rule",
5634+
},
5635+
Object {
5636+
"data": Object {},
5637+
"nodes": Array [
5638+
Object {
5639+
"marks": Array [],
5640+
"object": "text",
5641+
"text": "thematic break",
5642+
},
5643+
],
5644+
"object": "block",
5645+
"type": "paragraph",
5646+
},
5647+
],
5648+
"object": "document",
5649+
},
5650+
"object": "value",
5651+
}
5652+
`;
5653+
5654+
exports[`slate converts thematicbreak.json to and from CiceroMark 4`] = `
5655+
Object {
5656+
"$class": "org.accordproject.commonmark.Document",
5657+
"nodes": Array [
5658+
Object {
5659+
"$class": "org.accordproject.commonmark.Paragraph",
5660+
"nodes": Array [
5661+
Object {
5662+
"$class": "org.accordproject.commonmark.Text",
5663+
"text": "This is a",
5664+
},
5665+
],
5666+
},
5667+
Object {
5668+
"$class": "org.accordproject.commonmark.ThematicBreak",
5669+
},
5670+
Object {
5671+
"$class": "org.accordproject.commonmark.Paragraph",
5672+
"nodes": Array [
5673+
Object {
5674+
"$class": "org.accordproject.commonmark.Text",
5675+
"text": "thematic break",
5676+
},
5677+
],
5678+
},
5679+
],
5680+
"xmlns": "http://commonmark.org/xml/1.0",
5681+
}
5682+
`;
5683+
54355684
exports[`slate converts ulist.json to and from CiceroMark 1`] = `
54365685
Object {
54375686
"$class": "org.accordproject.commonmark.Document",

packages/markdown-slate/test/data/headings.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,54 @@
4040
}
4141
]
4242
},
43+
{
44+
"object": "block",
45+
"type": "heading_four",
46+
"data": {},
47+
"nodes": [
48+
{
49+
"object": "text",
50+
"text": "H4",
51+
"marks": []
52+
}
53+
]
54+
},
55+
{
56+
"object": "block",
57+
"type": "heading_five",
58+
"data": {},
59+
"nodes": [
60+
{
61+
"object": "text",
62+
"text": "H5",
63+
"marks": []
64+
}
65+
]
66+
},
67+
{
68+
"object": "block",
69+
"type": "heading_six",
70+
"data": {},
71+
"nodes": [
72+
{
73+
"object": "text",
74+
"text": "H6",
75+
"marks": []
76+
}
77+
]
78+
},
79+
{
80+
"object": "block",
81+
"type": "paragraph",
82+
"data": {},
83+
"nodes": [
84+
{
85+
"object": "text",
86+
"text": "####### Text!!",
87+
"marks": []
88+
}
89+
]
90+
},
4391
{
4492
"object": "block",
4593
"type": "paragraph",

packages/markdown-slate/test/data/headings.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,16 @@
77
### H3
88

99

10-
end.
10+
#### H4
11+
12+
13+
##### H5
14+
15+
16+
###### H6
17+
18+
19+
\####### Text!!
20+
21+
22+
end.

0 commit comments

Comments
 (0)