@@ -3,12 +3,14 @@ import 'package:flutter/material.dart';
3
3
import 'package:flutter_checks/flutter_checks.dart' ;
4
4
import 'package:flutter_test/flutter_test.dart' ;
5
5
import 'package:zulip/api/model/events.dart' ;
6
+ import 'package:zulip/model/narrow.dart' ;
6
7
import 'package:zulip/model/store.dart' ;
7
8
import 'package:zulip/widgets/app.dart' ;
8
9
import 'package:zulip/widgets/app_bar.dart' ;
9
10
import 'package:zulip/widgets/home.dart' ;
10
11
import 'package:zulip/widgets/icons.dart' ;
11
12
import 'package:zulip/widgets/inbox.dart' ;
13
+ import 'package:zulip/widgets/message_list.dart' ;
12
14
import 'package:zulip/widgets/page.dart' ;
13
15
import 'package:zulip/widgets/profile.dart' ;
14
16
import 'package:zulip/widgets/subscription_list.dart' ;
@@ -19,22 +21,29 @@ import '../example_data.dart' as eg;
19
21
import '../flutter_checks.dart' ;
20
22
import '../model/binding.dart' ;
21
23
import '../model/test_store.dart' ;
24
+ import '../test_navigation.dart' ;
25
+ import 'message_list_checks.dart' ;
22
26
import 'page_checks.dart' ;
23
27
import 'test_app.dart' ;
24
28
25
29
void main () {
26
30
TestZulipBinding .ensureInitialized ();
27
31
28
32
late PerAccountStore store;
33
+ late FakeApiConnection connection;
29
34
30
- Future <void > prepare (WidgetTester tester) async {
35
+ Future <void > prepare (WidgetTester tester, {
36
+ NavigatorObserver ? navigatorObserver,
37
+ }) async {
31
38
addTearDown (testBinding.reset);
32
39
await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot ());
33
40
store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
41
+ connection = store.connection as FakeApiConnection ;
34
42
await store.addUser (eg.selfUser);
35
43
36
44
await tester.pumpWidget (TestZulipApp (
37
45
accountId: eg.selfAccount.id,
46
+ navigatorObservers: navigatorObserver != null ? [navigatorObserver] : [],
38
47
child: const HomePage ()));
39
48
await tester.pump ();
40
49
}
@@ -88,6 +97,23 @@ void main () {
88
97
of: find.byType (ZulipAppBar ),
89
98
matching: find.text ('Direct messages' ))).findsOne ();
90
99
});
100
+
101
+ testWidgets ('combined feed' , (tester) async {
102
+ final pushedRoutes = < Route <dynamic >> [];
103
+ final testNavObserver = TestNavigatorObserver ()
104
+ ..onPushed = (route, prevRoute) => pushedRoutes.add (route);
105
+ await prepare (tester, navigatorObserver: testNavObserver);
106
+ pushedRoutes.clear ();
107
+
108
+ connection.prepare (json: eg.newestGetMessagesResult (
109
+ foundOldest: true , messages: []).toJson ());
110
+ await tester.tap (find.byIcon (ZulipIcons .message_feed));
111
+ await tester.pump ();
112
+ await tester.pump (const Duration (milliseconds: 250 ));
113
+ check (pushedRoutes).single.isA <WidgetRoute >().page
114
+ .isA <MessageListPage >()
115
+ .initNarrow.equals (const CombinedFeedNarrow ());
116
+ });
91
117
});
92
118
93
119
group ('menu' , () {
0 commit comments