@@ -353,24 +353,27 @@ void main() {
353
353
354
354
Future <void > showFromAppBar (WidgetTester tester, {
355
355
ZulipStream ? channel,
356
- String topic = someTopic ,
356
+ TopicName ? topic,
357
357
List <StreamMessage >? messages,
358
358
}) async {
359
359
final effectiveChannel = channel ?? someChannel;
360
+ final effectiveTopic = topic ?? TopicName (someTopic);
360
361
final effectiveMessages = messages ?? [someMessage];
361
- assert (effectiveMessages.every ((m) => m.topic.apiName == topic ));
362
+ assert (effectiveMessages.every ((m) => m.topic.apiName == effectiveTopic.apiName ));
362
363
363
364
connection.prepare (json: eg.newestGetMessagesResult (
364
365
foundOldest: true , messages: effectiveMessages).toJson ());
365
366
await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount.id,
366
367
child: MessageListPage (
367
- initNarrow: eg. topicNarrow (effectiveChannel.streamId, topic ))));
368
+ initNarrow: TopicNarrow (effectiveChannel.streamId, effectiveTopic ))));
368
369
// global store, per-account store, and message list get loaded
369
370
await tester.pumpAndSettle ();
370
371
371
372
final topicRow = find.descendant (
372
373
of: find.byType (ZulipAppBar ),
373
- matching: find.text (topic));
374
+ matching: find.text (
375
+ // ignore: dead_null_aware_expression // null topic names soon to be enabled
376
+ effectiveTopic.displayName ?? eg.defaultRealmEmptyTopicDisplayName));
374
377
await tester.longPress (topicRow);
375
378
// sheet appears onscreen; default duration of bottom-sheet enter animation
376
379
await tester.pump (const Duration (milliseconds: 250 ));
@@ -446,6 +449,16 @@ void main() {
446
449
check (findButtonForLabel ('Mark as unresolved' )).findsNothing ();
447
450
});
448
451
452
+ testWidgets ('show from app bar: resolve/unresolve not offered when topic is empty' , (tester) async {
453
+ await prepare ();
454
+ final message = eg.streamMessage (stream: someChannel, topic: '' );
455
+ await showFromAppBar (tester,
456
+ topic: TopicName ('' ),
457
+ messages: [message]);
458
+ check (findButtonForLabel ('Mark as resolved' )).findsNothing ();
459
+ check (findButtonForLabel ('Mark as unresolved' )).findsNothing ();
460
+ }, skip: true ); // null topic names soon to be enabled
461
+
449
462
testWidgets ('show from recipient header' , (tester) async {
450
463
await prepare ();
451
464
await showFromRecipientHeader (tester);
@@ -485,7 +498,7 @@ void main() {
485
498
final message = eg.streamMessage (
486
499
stream: someChannel, topic: topic, sender: eg.otherUser);
487
500
await showFromAppBar (tester,
488
- channel: someChannel, topic: topic, messages: [message]);
501
+ channel: someChannel, topic: TopicName ( topic) , messages: [message]);
489
502
}
490
503
491
504
void checkButtons (List <Finder > expectedButtonFinders) {
@@ -697,7 +710,8 @@ void main() {
697
710
testWidgets ('unresolve: happy path' , (tester) async {
698
711
final message = eg.streamMessage (stream: someChannel, topic: '✔ zulip' );
699
712
await prepare (topic: '✔ zulip' );
700
- await showFromAppBar (tester, topic: '✔ zulip' , messages: [message]);
713
+ await showFromAppBar (tester,
714
+ topic: TopicName ('✔ zulip' ), messages: [message]);
701
715
connection.takeRequests ();
702
716
connection.prepare (json: UpdateMessageResult ().toJson ());
703
717
await tester.tap (findButtonForLabel ('Mark as unresolved' ));
@@ -710,7 +724,8 @@ void main() {
710
724
testWidgets ('unresolve: weird prefix' , (tester) async {
711
725
final message = eg.streamMessage (stream: someChannel, topic: '✔ ✔ zulip' );
712
726
await prepare (topic: '✔ ✔ zulip' );
713
- await showFromAppBar (tester, topic: '✔ ✔ zulip' , messages: [message]);
727
+ await showFromAppBar (tester,
728
+ topic: TopicName ('✔ ✔ zulip' ), messages: [message]);
714
729
connection.takeRequests ();
715
730
connection.prepare (json: UpdateMessageResult ().toJson ());
716
731
await tester.tap (findButtonForLabel ('Mark as unresolved' ));
0 commit comments