Skip to content

Commit 9703379

Browse files
committed
action_sheet test: Remove messages in showFromAppBar channel-sheet setup
It looks like this param was only being used to avoid the topic-autocomplete behavior mentioned in the code comment. For invoking the channel action sheet by long-pressing the app bar, it shouldn't matter if the message list isn't showing any messages.
1 parent ffd96fe commit 9703379

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

test/widgets/action_sheet_test.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,17 @@ void main() {
203203

204204
Future<void> showFromAppBar(WidgetTester tester, {
205205
ZulipStream? channel,
206-
List<StreamMessage>? messages,
207206
required Narrow narrow,
208207
}) async {
209208
channel ??= someChannel;
210-
messages ??= [someMessage];
211209

212210
connection.prepare(json: eg.newestGetMessagesResult(
213-
foundOldest: true, messages: messages).toJson());
211+
foundOldest: true, messages: []).toJson());
212+
if (narrow case ChannelNarrow()) {
213+
// We auto-focus the topic input when there are no messages;
214+
// this is for topic autocomplete.
215+
connection.prepare(json: GetStreamTopicsResult(topics: []).toJson());
216+
}
214217
await tester.pumpWidget(TestZulipApp(
215218
accountId: eg.selfAccount.id,
216219
child: MessageListPage(
@@ -450,13 +453,11 @@ void main() {
450453

451454
testWidgets('smoke, public channel', (tester) async {
452455
final channel = eg.stream(inviteOnly: false);
453-
final message = eg.streamMessage(stream: channel);
454456
await prepare();
455457
await store.addStream(channel);
456458
await store.addSubscription(eg.subscription(channel));
457459
final narrow = ChannelNarrow(channel.streamId);
458-
await showFromAppBar(tester,
459-
channel: channel, narrow: narrow, messages: [message]);
460+
await showFromAppBar(tester, channel: channel, narrow: narrow);
460461

461462
connection.prepare(json: {});
462463
await tapButton(tester);
@@ -474,13 +475,11 @@ void main() {
474475

475476
testWidgets('smoke, private channel', (tester) async {
476477
final channel = eg.stream(inviteOnly: true);
477-
final message = eg.streamMessage(stream: channel);
478478
await prepare();
479479
await store.addStream(channel);
480480
await store.addSubscription(eg.subscription(channel));
481481
final narrow = ChannelNarrow(channel.streamId);
482-
await showFromAppBar(tester,
483-
channel: channel, narrow: narrow, messages: [message]);
482+
await showFromAppBar(tester, channel: channel, narrow: narrow);
484483
connection.takeRequests();
485484

486485
connection.prepare(json: {});

0 commit comments

Comments
 (0)