Skip to content

Commit 55f9c4b

Browse files
committed
msglist [nfc]: Set route settings on message-list page route, for testing
This way, the Route object itself is distinguishable from other Route objects. This will come in handy in widget tests for the upcoming recent-DMs screen (zulip#119), where we'll want to assert that tapping on a conversation brings up the appropriate message list. While we're at it, add the usual `extension FooChecks on Subject<Foo>` boilerplate that we'll use in those tests.
1 parent 73d6aa3 commit 55f9c4b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/widgets/message_list.dart

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class MessageListPage extends StatefulWidget {
2121

2222
static Route<void> buildRoute({required BuildContext context, required Narrow narrow}) {
2323
return MaterialAccountPageRoute(context: context,
24+
settings: RouteSettings(name: 'message_list', arguments: narrow), // for testing
2425
builder: (context) => MessageListPage(narrow: narrow));
2526
}
2627

test/flutter_checks.dart

+9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ extension GlobalKeyChecks<T extends State<StatefulWidget>> on Subject<GlobalKey<
1515
Subject<T?> get currentState => has((k) => k.currentState, 'currentState');
1616
}
1717

18+
extension RouteChecks<T> on Subject<Route<T>> {
19+
Subject<RouteSettings> get settings => has((r) => r.settings, 'settings');
20+
}
21+
22+
extension RouteSettingsChecks<T> on Subject<RouteSettings> {
23+
Subject<String?> get name => has((s) => s.name, 'name');
24+
Subject<Object?> get arguments => has((s) => s.arguments, 'arguments');
25+
}
26+
1827
extension ValueNotifierChecks<T> on Subject<ValueNotifier<T>> {
1928
Subject<T> get value => has((c) => c.value, 'value');
2029
}

0 commit comments

Comments
 (0)