@@ -729,6 +729,22 @@ void main() {
729729 targetHtml: '<code>code</code>' ,
730730 targetFontSizeFinder: mkTargetFontSizeFinderFromPattern ('code' ));
731731 });
732+
733+ testFontWeight ('is bold in bold span' ,
734+ // Regression test for: https://github.com/zulip/zulip-flutter/issues/1812
735+ expectedWght: 600 ,
736+ // **bold**
737+ content: plainContent ('<p><strong><code>bold</code></strong></p>' ),
738+ styleFinder: (tester) => mergedStyleOf (tester, 'bold' )! ,
739+ );
740+
741+ testWidgets ('is link-colored in link span' , (tester) async {
742+ // Regression test for: https://github.com/zulip/zulip-flutter/issues/806
743+ await prepareContent (tester,
744+ plainContent ('<p><a href="https://example/"><code>code</code></a></p>' ));
745+ final style = mergedStyleOf (tester, 'code' );
746+ check (style! .color).equals (const HSLColor .fromAHSL (1 , 200 , 1 , 0.4 ).toColor ());
747+ });
732748 });
733749
734750 group ('UserMention' , () {
@@ -1046,9 +1062,39 @@ void main() {
10461062 tester.widget (find.text ('λ' , findRichText: true ));
10471063 });
10481064
1049- testWidgets ('fallback to displaying KaTeX source if unsupported KaTeX HTML' , (tester) async {
1050- await prepareContent (tester, plainContent (ContentExample .mathInlineUnknown.html));
1051- tester.widget (find.text (r'\lambda' ));
1065+ group ('fallback to displaying KaTeX source if unsupported KaTeX HTML' , () {
1066+ testWidgets ('smoke' , (tester) async {
1067+ await prepareContent (tester, plainContent (ContentExample .mathInlineUnknown.html));
1068+ tester.widget (find.text (r'\lambda' ));
1069+ });
1070+
1071+ testFontWeight ('is bold in bold span' ,
1072+ // Regression test for: https://github.com/zulip/zulip-flutter/issues/1812
1073+ expectedWght: 600 ,
1074+ // **bold**
1075+ content: plainContent ('<p><strong><span class="katex">'
1076+ '<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>'
1077+ '<annotation encoding="application/x-tex"> \\ lambda </annotation></semantics></math></span>'
1078+ '<span class="katex-html" aria-hidden="true">'
1079+ '<span class="base unknown">' // Server doesn't generate this 'unknown' class.
1080+ '<span class="strut" style="height:0.6944em;"></span>'
1081+ '<span class="mord mathnormal">λ</span></span></span></span></strong></p>' ),
1082+ styleFinder: (tester) => mergedStyleOf (tester, r'\lambda' )! ,
1083+ );
1084+
1085+ testWidgets ('is link-colored in link span' , (tester) async {
1086+ // Regression test for: https://github.com/zulip/zulip-flutter/issues/806
1087+ await prepareContent (tester,
1088+ plainContent ('<p><a href="https://example/"><span class="katex">'
1089+ '<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>'
1090+ '<annotation encoding="application/x-tex"> \\ lambda </annotation></semantics></math></span>'
1091+ '<span class="katex-html" aria-hidden="true">'
1092+ '<span class="base unknown">' // Server doesn't generate this 'unknown' class.
1093+ '<span class="strut" style="height:0.6944em;"></span>'
1094+ '<span class="mord mathnormal">λ</span></span></span></span></a></p>' ));
1095+ final style = mergedStyleOf (tester, r'\lambda' );
1096+ check (style! .color).equals (const HSLColor .fromAHSL (1 , 200 , 1 , 0.4 ).toColor ());
1097+ });
10521098 });
10531099 });
10541100
0 commit comments