@@ -9,9 +9,11 @@ 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
16+ import '../api/fake_api.dart' ;
1517import '../example_data.dart' as eg;
1618import '../flutter_checks.dart' ;
1719import '../model/binding.dart' ;
@@ -231,6 +233,42 @@ void main() {
231233
232234 // TODO test that tapping a conversation row opens the message list
233235 // for the conversation
236+ group ('navigation' , () {
237+ testWidgets ('tapping a topic row opens the message list' , (tester) async {
238+ final stream = eg.stream ();
239+ final subscription = eg.subscription (stream);
240+ const topic = 'lunch' ;
241+ final message = eg.streamMessage (stream: stream, topic: topic);
242+
243+ await setupPage (tester,
244+ streams: [stream],
245+ subscriptions: [subscription],
246+ unreadMessages: [message]);
247+
248+ final connection = store.connection as FakeApiConnection ;
249+
250+ connection.prepare (
251+ json: eg.newestGetMessagesResult (messages: [
252+ eg.streamMessage (stream: stream, topic: topic,
253+ flags: [MessageFlag .read]),
254+ ], foundOldest: false ).toJson (),
255+ );
256+
257+ connection.prepare (
258+ json: eg.newestGetMessagesResult (messages: [], foundOldest: true ).toJson (),
259+ );
260+
261+ await tester.tap (find.text (topic));
262+ await tester.pumpAndSettle ();
263+
264+ check (find.byType (HomePage )).findsNothing ();
265+ check (find.byType (MessageListPage )).findsOne ();
266+
267+ check (find.text (topic)).findsAny ();
268+
269+ });
270+
271+ });
234272
235273 // Tests for the topic action sheet are in test/widgets/action_sheet_test.dart.
236274
0 commit comments