@@ -104,7 +104,7 @@ void main() {
104
104
// TODO(#488) For content that we need to show outside a per-message context
105
105
// or a context without a full PerAccountStore, make sure to include tests
106
106
// that don't provide such context.
107
- Future <void > prepareContentBare (WidgetTester tester, Widget child, {
107
+ Future <void > prepareContent (WidgetTester tester, Widget child, {
108
108
List <NavigatorObserver > navObservers = const [],
109
109
bool wrapWithPerAccountStoreWidget = false ,
110
110
}) async {
@@ -140,11 +140,11 @@ void main() {
140
140
///
141
141
/// This requires [ContentExample.expectedText] to be non-null in order to
142
142
/// check that the content has actually rendered. For examples where there's
143
- /// no suitable value for [ContentExample.expectedText] , use [prepareContentBare ]
143
+ /// no suitable value for [ContentExample.expectedText] , use [prepareContent ]
144
144
/// and write an appropriate content-has-rendered check directly.
145
145
void testContentSmoke (ContentExample example) {
146
146
testWidgets ('smoke: ${example .description }' , (tester) async {
147
- await prepareContentBare (tester, plainContent (example.html));
147
+ await prepareContent (tester, plainContent (example.html));
148
148
assert (example.expectedText != null ,
149
149
'testContentExample requires expectedText' );
150
150
tester.widget (find.text (example.expectedText! ));
@@ -153,21 +153,21 @@ void main() {
153
153
154
154
group ('ThematicBreak' , () {
155
155
testWidgets ('smoke ThematicBreak' , (tester) async {
156
- await prepareContentBare (tester, plainContent (ContentExample .thematicBreak.html));
156
+ await prepareContent (tester, plainContent (ContentExample .thematicBreak.html));
157
157
tester.widget (find.byType (ThematicBreak ));
158
158
});
159
159
});
160
160
161
161
group ('Heading' , () {
162
162
testWidgets ('plain h6' , (tester) async {
163
- await prepareContentBare (tester,
163
+ await prepareContent (tester,
164
164
// "###### six"
165
165
plainContent ('<h6>six</h6>' ));
166
166
tester.widget (find.text ('six' ));
167
167
});
168
168
169
169
testWidgets ('smoke test for h1, h2, h3, h4, h5' , (tester) async {
170
- await prepareContentBare (tester,
170
+ await prepareContent (tester,
171
171
// "# one\n## two\n### three\n#### four\n##### five"
172
172
plainContent ('<h1>one</h1>\n <h2>two</h2>\n <h3>three</h3>\n <h4>four</h4>\n <h5>five</h5>' ));
173
173
check (find.byType (Heading ).evaluate ()).length.equals (5 );
@@ -184,13 +184,13 @@ void main() {
184
184
final pushedRoutes = < Route <dynamic >> [];
185
185
final testNavObserver = TestNavigatorObserver ()
186
186
..onPushed = (route, prevRoute) => pushedRoutes.add (route);
187
- await prepareContentBare (tester,
187
+ await prepareContent (tester,
188
188
// Message is needed for the image's lightbox.
189
189
messageContent (html),
190
190
navObservers: [testNavObserver],
191
191
// We try to resolve the image's URL on the self-account's realm.
192
192
wrapWithPerAccountStoreWidget: true );
193
- // `tester.pumpWidget` in prepareContentBare introduces an initial route;
193
+ // `tester.pumpWidget` in prepareContent introduces an initial route;
194
194
// remove it so consumers only have newly pushed routes.
195
195
assert (pushedRoutes.length == 1 );
196
196
pushedRoutes.removeLast ();
@@ -258,7 +258,7 @@ void main() {
258
258
259
259
group ('MessageImage, MessageImageList' , () {
260
260
Future <void > prepare (WidgetTester tester, String html) async {
261
- await prepareContentBare (tester,
261
+ await prepareContent (tester,
262
262
// Message is needed for an image's lightbox.
263
263
messageContent (html),
264
264
// We try to resolve image URLs on the self-account's realm.
@@ -347,7 +347,7 @@ void main() {
347
347
final pushedRoutes = < Route <dynamic >> [];
348
348
final testNavObserver = TestNavigatorObserver ()
349
349
..onPushed = (route, prevRoute) => pushedRoutes.add (route);
350
- await prepareContentBare (tester,
350
+ await prepareContent (tester,
351
351
// Message is needed for a video's lightbox.
352
352
messageContent (html),
353
353
navObservers: [testNavObserver],
@@ -357,7 +357,7 @@ void main() {
357
357
// self-account's realm, we'll request it with the auth credential.
358
358
// TODO(#656) in above comment, change "we will" to "we do"
359
359
wrapWithPerAccountStoreWidget: true );
360
- // `tester.pumpWidget` in prepareContentBare introduces an initial route;
360
+ // `tester.pumpWidget` in prepareContent introduces an initial route;
361
361
// remove it so consumers only have newly pushed routes.
362
362
assert (pushedRoutes.length == 1 );
363
363
pushedRoutes.removeLast ();
@@ -376,7 +376,7 @@ void main() {
376
376
377
377
group ("MessageEmbedVideo" , () {
378
378
Future <void > prepare (WidgetTester tester, String html) async {
379
- await prepareContentBare (tester,
379
+ await prepareContent (tester,
380
380
// Message is needed for a video's lightbox.
381
381
messageContent (html),
382
382
// We try to resolve a video preview URL on the self-account's realm.
@@ -441,7 +441,7 @@ void main() {
441
441
required String targetHtml,
442
442
required double Function (InlineSpan rootSpan) targetFontSizeFinder,
443
443
}) async {
444
- await prepareContentBare (tester, plainContent (
444
+ await prepareContent (tester, plainContent (
445
445
'<h1>header-plain $targetHtml </h1>\n '
446
446
'<p>paragraph-plain $targetHtml </p>' ));
447
447
@@ -520,7 +520,7 @@ void main() {
520
520
// We use this to simulate taps on specific glyphs.
521
521
522
522
Future <void > prepare (WidgetTester tester, String html) async {
523
- await prepareContentBare (tester, plainContent (html),
523
+ await prepareContent (tester, plainContent (html),
524
524
// We try to resolve relative links on the self-account's realm.
525
525
wrapWithPerAccountStoreWidget: true );
526
526
}
@@ -616,12 +616,12 @@ void main() {
616
616
final testNavObserver = TestNavigatorObserver ()
617
617
..onPushed = (route, prevRoute) => pushedRoutes.add (route);
618
618
619
- await prepareContentBare (tester, plainContent (html),
619
+ await prepareContent (tester, plainContent (html),
620
620
navObservers: [testNavObserver],
621
621
// We try to resolve relative links on the self-account's realm.
622
622
wrapWithPerAccountStoreWidget: true );
623
623
624
- // `tester.pumpWidget` in prepareContentBare introduces an initial route;
624
+ // `tester.pumpWidget` in prepareContent introduces an initial route;
625
625
// remove it so consumers only have newly pushed routes.
626
626
assert (pushedRoutes.length == 1 );
627
627
pushedRoutes.removeLast ();
@@ -684,12 +684,12 @@ void main() {
684
684
final renderedTextRegexp = RegExp (r'^(Tue, Jan 30|Wed, Jan 31), 2024, \d+:\d\d [AP]M$' );
685
685
686
686
testWidgets ('smoke' , (tester) async {
687
- await prepareContentBare (tester, plainContent ('<p>$timeSpanHtml </p>' ));
687
+ await prepareContent (tester, plainContent ('<p>$timeSpanHtml </p>' ));
688
688
tester.widget (find.textContaining (renderedTextRegexp));
689
689
});
690
690
691
691
testWidgets ('clock icon and text are the same color' , (tester) async {
692
- await prepareContentBare (tester,
692
+ await prepareContent (tester,
693
693
DefaultTextStyle (style: const TextStyle (color: Colors .green),
694
694
child: plainContent ('<p>$timeSpanHtml </p>' )));
695
695
@@ -749,7 +749,7 @@ void main() {
749
749
750
750
group ('MessageImageEmoji' , () {
751
751
Future <void > prepare (WidgetTester tester, String html) async {
752
- await prepareContentBare (tester, plainContent (html),
752
+ await prepareContent (tester, plainContent (html),
753
753
// We try to resolve image-emoji URLs on the self-account's realm.
754
754
// For URLs on the self-account's realm, we include the auth credential.
755
755
wrapWithPerAccountStoreWidget: true );
0 commit comments