Skip to content

Commit 2e0c092

Browse files
content test: Add test for negative margins on a vlist row in KaTeX content
Skipped currently, because the parser incorrectly doesn't filter the negative margin styles on the vlist row span after generating a `KatexNegativeMarginNode` to specifically handle negative margins.
1 parent 7f31ea4 commit 2e0c092

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

test/model/content_test.dart

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,87 @@ class ContentExample {
13991399
]),
14001400
]);
14011401

1402+
static const mathBlockNegativeMarginsOnVlistRow = ContentExample(
1403+
'math block, KaTeX negative margins on a vlist row',
1404+
'```math\nX_n\n```',
1405+
'<p>'
1406+
'<span class="katex-display"><span class="katex">'
1407+
'<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>X</mi><mi>n</mi></msub></mrow><annotation encoding="application/x-tex">X_n</annotation></semantics></math></span>'
1408+
'<span class="katex-html" aria-hidden="true">'
1409+
'<span class="base">'
1410+
'<span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span>'
1411+
'<span class="mord">'
1412+
'<span class="mord mathnormal" style="margin-right:0.07847em;">X</span>'
1413+
'<span class="msupsub">'
1414+
'<span class="vlist-t vlist-t2">'
1415+
'<span class="vlist-r">'
1416+
'<span class="vlist" style="height:0.1514em;">'
1417+
'<span style="top:-2.55em;margin-left:-0.0785em;margin-right:0.05em;">'
1418+
'<span class="pstrut" style="height:2.7em;"></span>'
1419+
'<span class="sizing reset-size6 size3 mtight">'
1420+
'<span class="mord mathnormal mtight">n</span></span></span></span>'
1421+
'<span class="vlist-s">​</span></span>'
1422+
'<span class="vlist-r">'
1423+
'<span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span></span></p>', [
1424+
MathBlockNode(
1425+
texSource: 'X_n',
1426+
nodes: [
1427+
KatexSpanNode(
1428+
styles: KatexSpanStyles(),
1429+
text: null,
1430+
nodes: [
1431+
KatexStrutNode(heightEm: 0.8333, verticalAlignEm: -0.15),
1432+
KatexSpanNode(
1433+
styles: KatexSpanStyles(),
1434+
text: null,
1435+
nodes: [
1436+
KatexSpanNode(
1437+
styles: KatexSpanStyles(
1438+
marginRightEm: 0.07847,
1439+
fontFamily: 'KaTeX_Math',
1440+
fontStyle: KatexSpanFontStyle.italic),
1441+
text: 'X',
1442+
nodes: null),
1443+
KatexSpanNode(
1444+
styles: KatexSpanStyles(textAlign: KatexSpanTextAlign.left),
1445+
text: null,
1446+
nodes: [
1447+
KatexVlistNode(
1448+
rows: [
1449+
KatexVlistRowNode(
1450+
verticalOffsetEm: -2.55 + 2.7,
1451+
node: KatexSpanNode(
1452+
styles: KatexSpanStyles(),
1453+
text: null,
1454+
nodes: [
1455+
KatexNegativeMarginNode(
1456+
leftOffsetEm: -0.0785,
1457+
nodes: [
1458+
KatexSpanNode(
1459+
styles: KatexSpanStyles(marginRightEm: 0.05),
1460+
text: null,
1461+
nodes: [
1462+
KatexSpanNode(
1463+
styles: KatexSpanStyles(fontSizeEm: 0.7),
1464+
text: null,
1465+
nodes: [
1466+
KatexSpanNode(
1467+
styles: KatexSpanStyles(
1468+
fontFamily: 'KaTeX_Math',
1469+
fontStyle: KatexSpanFontStyle.italic),
1470+
text: 'n',
1471+
nodes: null),
1472+
]),
1473+
]),
1474+
]),
1475+
])),
1476+
]),
1477+
]),
1478+
]),
1479+
]),
1480+
]),
1481+
]);
1482+
14021483
static const imageSingle = ContentExample(
14031484
'single image',
14041485
// https://chat.zulip.org/#narrow/stream/7-test-here/topic/Thumbnails/near/1900103
@@ -2494,6 +2575,10 @@ void main() async {
24942575
testParseExample(ContentExample.mathBlockKatexSubSuperScript);
24952576
testParseExample(ContentExample.mathBlockKatexRaisebox);
24962577
testParseExample(ContentExample.mathBlockKatexNegativeMargins);
2578+
testParseExample(ContentExample.mathBlockNegativeMarginsOnVlistRow,
2579+
// TODO fix parser to filter negative margins styles from
2580+
// vlist row span styles.
2581+
skip: true);
24972582

24982583
testParseExample(ContentExample.imageSingle);
24992584
testParseExample(ContentExample.imageSingleNoDimensions);

0 commit comments

Comments
 (0)