Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combined feed: Fix channel header tap behaviour in combined feed #1370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
?? zulipLocalizations.unknownChannelName; // TODO(log)

streamWidget = GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: ChannelNarrow(message.streamId))),
Expand Down
34 changes: 34 additions & 0 deletions test/widgets/message_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1470,4 +1470,38 @@ void main() {
..status.equals(AnimationStatus.dismissed);
});
});

testWidgets("navigates to ChannelNarrow when tapping the empty space in the channel part area of the CombinedFeedNarrow header", (tester) async {
final pushedRoutes = <Route<void>>[];
final navObserver = TestNavigatorObserver()
..onPushed = (route, prevRoute) => pushedRoutes.add(route);
final channel = eg.stream();
final message = eg.streamMessage(stream: channel);
await setupMessageListPage(tester,
narrow: const CombinedFeedNarrow(),
streams: [channel],
subscriptions: [eg.subscription(channel)],
messages: [message],
navObservers: [navObserver]);

assert(pushedRoutes.length == 1);
pushedRoutes.clear();

connection.prepare(json: eg.newestGetMessagesResult(
foundOldest: true, messages: [message]).toJson());

// Find the chevron icon
final chevronFinder = find.descendant(
of: find.byType(StreamMessageRecipientHeader),
matching: find.byIcon(ZulipIcons.chevron_right));

// Get the position of the chevron icon and tap 3px above it
final chevronRect = tester.getRect(chevronFinder);
await tester.tapAt(Offset(chevronRect.center.dx, chevronRect.top - 3));

await tester.pump();
check(pushedRoutes).single.isA<WidgetRoute>().page.isA<MessageListPage>()
.initNarrow.equals(ChannelNarrow(channel.streamId));
await tester.pumpAndSettle();
});
}