Skip to content

Commit 645ae8a

Browse files
committed
content test [nfc]: Get unsupported-katex HTML from ContentExample
NFC because this is the same string.
1 parent f3c86aa commit 645ae8a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

test/widgets/content_test.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,17 +1031,16 @@ void main() {
10311031
group('fallback to displaying KaTeX source if unsupported KaTeX HTML', () {
10321032
testContentSmoke(ContentExample.mathInlineUnknown);
10331033

1034+
assert(ContentExample.mathInlineUnknown.html.startsWith('<p>'));
1035+
assert(ContentExample.mathInlineUnknown.html.endsWith('</p>'));
1036+
final unsupportedKatexHtml = ContentExample.mathInlineUnknown.html
1037+
.substring(3, ContentExample.mathInlineUnknown.html.length - 4);
1038+
final expectedText = ContentExample.mathInlineUnknown.expectedText!;
1039+
10341040
testWidgets('maintains font-size ratio with surrounding text, when falling back to TeX source', (tester) async {
1035-
const unsupportedHtml = '<span class="katex">'
1036-
'<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>'
1037-
'<annotation encoding="application/x-tex"> \\lambda </annotation></semantics></math></span>'
1038-
'<span class="katex-html" aria-hidden="true">'
1039-
'<span class="base unknown">' // Server doesn't generate this 'unknown' class.
1040-
'<span class="strut" style="height:0.6944em;"></span>'
1041-
'<span class="mord mathnormal">λ</span></span></span></span>';
10421041
await checkFontSizeRatio(tester,
1043-
targetHtml: unsupportedHtml,
1044-
targetFontSizeFinder: mkTargetFontSizeFinderFromPattern(r'\lambda'));
1042+
targetHtml: unsupportedKatexHtml,
1043+
targetFontSizeFinder: mkTargetFontSizeFinderFromPattern(expectedText));
10451044
});
10461045
});
10471046
});

0 commit comments

Comments
 (0)