Skip to content

Commit d0db6d4

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 6ec1def commit d0db6d4

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
@@ -199,14 +199,17 @@ void main() {
199199

200200
Future<void> showFromAppBar(WidgetTester tester, {
201201
ZulipStream? channel,
202-
List<StreamMessage>? messages,
203202
required Narrow narrow,
204203
}) async {
205204
channel ??= someChannel;
206-
messages ??= [someMessage];
207205

208206
connection.prepare(json: eg.newestGetMessagesResult(
209-
foundOldest: true, messages: messages).toJson());
207+
foundOldest: true, messages: []).toJson());
208+
if (narrow case ChannelNarrow()) {
209+
// We auto-focus the topic input when there are no messages;
210+
// this is for topic autocomplete.
211+
connection.prepare(json: GetStreamTopicsResult(topics: []).toJson());
212+
}
210213
await tester.pumpWidget(TestZulipApp(
211214
accountId: eg.selfAccount.id,
212215
child: MessageListPage(
@@ -446,13 +449,11 @@ void main() {
446449

447450
testWidgets('smoke, public channel', (tester) async {
448451
final channel = eg.stream(inviteOnly: false);
449-
final message = eg.streamMessage(stream: channel);
450452
await prepare();
451453
await store.addStream(channel);
452454
await store.addSubscription(eg.subscription(channel));
453455
final narrow = ChannelNarrow(channel.streamId);
454-
await showFromAppBar(tester,
455-
channel: channel, narrow: narrow, messages: [message]);
456+
await showFromAppBar(tester, channel: channel, narrow: narrow);
456457

457458
connection.prepare(json: {});
458459
await tapButton(tester);
@@ -470,13 +471,11 @@ void main() {
470471

471472
testWidgets('smoke, private channel', (tester) async {
472473
final channel = eg.stream(inviteOnly: true);
473-
final message = eg.streamMessage(stream: channel);
474474
await prepare();
475475
await store.addStream(channel);
476476
await store.addSubscription(eg.subscription(channel));
477477
final narrow = ChannelNarrow(channel.streamId);
478-
await showFromAppBar(tester,
479-
channel: channel, narrow: narrow, messages: [message]);
478+
await showFromAppBar(tester, channel: channel, narrow: narrow);
480479
connection.takeRequests();
481480

482481
connection.prepare(json: {});

0 commit comments

Comments
 (0)