@@ -9,6 +9,7 @@ import 'package:zulip/widgets/color.dart';
99import 'package:zulip/widgets/home.dart' ;
1010import 'package:zulip/widgets/icons.dart' ;
1111import 'package:zulip/widgets/channel_colors.dart' ;
12+ import 'package:zulip/widgets/message_list.dart' ;
1213import 'package:zulip/widgets/theme.dart' ;
1314import 'package:zulip/widgets/unread_count_badge.dart' ;
1415
@@ -231,6 +232,42 @@ void main() {
231232
232233 // TODO test that tapping a conversation row opens the message list
233234 // for the conversation
235+ group ('navigation' , () {
236+ testWidgets ('tapping a topic row opens the message list' , (tester) async {
237+ final stream = eg.stream ();
238+ final subscription = eg.subscription (stream);
239+ const topic = 'lunch' ;
240+ final message = eg.streamMessage (stream: stream, topic: topic);
241+
242+ await setupPage (tester,
243+ streams: [stream],
244+ subscriptions: [subscription],
245+ unreadMessages: [message]);
246+
247+ final connection = store.connection as FakeApiConnection ;
248+
249+ connection.prepare (
250+ json: eg.newestGetMessagesResult (messages: [
251+ eg.streamMessage (stream: stream, topic: topic,
252+ flags: [MessageFlag .read]),
253+ ], foundOldest: false ).toJson (),
254+ );
255+
256+ connection.prepare (
257+ json: eg.newestGetMessagesResult (messages: [], foundOldest: true ).toJson (),
258+ );
259+
260+ await tester.tap (find.text (topic));
261+ await tester.pumpAndSettle ();
262+
263+ check (find.byType (HomePage )).findsNothing ();
264+ check (find.byType (MessageListPage )).findsOne ();
265+
266+ check (find.text (topic)).findsAny ();
267+
268+ });
269+
270+ });
234271
235272 // Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.
236273
0 commit comments