@@ -92,11 +92,15 @@ void main() {
92
92
93
93
TestZulipBinding .ensureInitialized ();
94
94
95
- Future <void > prepareContentBare (WidgetTester tester, String html, {
95
+ Widget plainContent (String html) {
96
+ return BlockContentList (nodes: parseContent (html).nodes);
97
+ }
98
+
99
+ Future <void > prepareContentBare (WidgetTester tester, Widget child, {
96
100
List <NavigatorObserver > navObservers = const [],
97
101
bool wrapWithPerAccountStoreWidget = false ,
98
102
}) async {
99
- Widget widget = BlockContentList (nodes : parseContent (html).nodes) ;
103
+ Widget widget = child ;
100
104
101
105
if (wrapWithPerAccountStoreWidget) {
102
106
await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot ());
@@ -132,7 +136,7 @@ void main() {
132
136
/// and write an appropriate content-has-rendered check directly.
133
137
void testContentSmoke (ContentExample example) {
134
138
testWidgets ('smoke: ${example .description }' , (tester) async {
135
- await prepareContentBare (tester, example.html);
139
+ await prepareContentBare (tester, plainContent ( example.html) );
136
140
assert (example.expectedText != null ,
137
141
'testContentExample requires expectedText' );
138
142
tester.widget (find.text (example.expectedText! ));
@@ -141,7 +145,7 @@ void main() {
141
145
142
146
group ('ThematicBreak' , () {
143
147
testWidgets ('smoke ThematicBreak' , (tester) async {
144
- await prepareContentBare (tester, ContentExample .thematicBreak.html);
148
+ await prepareContentBare (tester, plainContent ( ContentExample .thematicBreak.html) );
145
149
tester.widget (find.byType (ThematicBreak ));
146
150
});
147
151
});
@@ -150,14 +154,14 @@ void main() {
150
154
testWidgets ('plain h6' , (tester) async {
151
155
await prepareContentBare (tester,
152
156
// "###### six"
153
- '<h6>six</h6>' );
157
+ plainContent ( '<h6>six</h6>' ) );
154
158
tester.widget (find.text ('six' ));
155
159
});
156
160
157
161
testWidgets ('smoke test for h1, h2, h3, h4, h5' , (tester) async {
158
162
await prepareContentBare (tester,
159
163
// "# one\n## two\n### three\n#### four\n##### five"
160
- '<h1>one</h1>\n <h2>two</h2>\n <h3>three</h3>\n <h4>four</h4>\n <h5>five</h5>' );
164
+ plainContent ( '<h1>one</h1>\n <h2>two</h2>\n <h3>three</h3>\n <h4>four</h4>\n <h5>five</h5>' ) );
161
165
check (find.byType (Heading ).evaluate ()).length.equals (5 );
162
166
});
163
167
});
@@ -454,9 +458,9 @@ void main() {
454
458
required String targetHtml,
455
459
required double Function (InlineSpan rootSpan) targetFontSizeFinder,
456
460
}) async {
457
- await prepareContentBare (tester,
461
+ await prepareContentBare (tester, plainContent (
458
462
'<h1>header-plain $targetHtml </h1>\n '
459
- '<p>paragraph-plain $targetHtml </p>' );
463
+ '<p>paragraph-plain $targetHtml </p>' )) ;
460
464
461
465
final headerRootSpan = tester.renderObject <RenderParagraph >(find.textContaining ('header' )).text;
462
466
final headerPlainStyle = mergedStyleOfSubstring (headerRootSpan, 'header-plain ' );
@@ -708,7 +712,7 @@ void main() {
708
712
final renderedTextRegexp = RegExp (r'^(Tue, Jan 30|Wed, Jan 31), 2024, \d+:\d\d [AP]M$' );
709
713
710
714
testWidgets ('smoke' , (tester) async {
711
- await prepareContentBare (tester, '<p>$timeSpanHtml </p>' );
715
+ await prepareContentBare (tester, plainContent ( '<p>$timeSpanHtml </p>' ) );
712
716
tester.widget (find.textContaining (renderedTextRegexp));
713
717
});
714
718
0 commit comments