@@ -187,6 +187,49 @@ void main() {
187187 check (find.byType (UnreadCountBadge ).evaluate ()).length.equals (0 );
188188 });
189189
190+ testWidgets ('muted unread badge shows with muted unreads' , (tester) async {
191+ final stream = eg.stream ();
192+ final unreadMsgs = eg.unreadMsgs (streams: [
193+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
194+ ]);
195+ await setupStreamListPage (tester,
196+ subscriptions: [eg.subscription (stream, isMuted: true )],
197+ userTopics: [eg.userTopicItem (stream, 'b' , UserTopicVisibilityPolicy .muted)],
198+ unreadMsgs: unreadMsgs);
199+ final finder = find.byWidgetPredicate ((widget) => widget is MutedUnreadBadge );
200+ check (finder.evaluate ().length).equals (1 );
201+ });
202+
203+ testWidgets ('muted unread badge does not show with any unmuted streams' , (tester) async {
204+ final stream = eg.stream ();
205+ final unreadMsgs = eg.unreadMsgs (streams: [
206+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
207+ ]);
208+ await setupStreamListPage (tester,
209+ subscriptions: [eg.subscription (stream, isMuted: false )],
210+ userTopics: [eg.userTopicItem (stream, 'b' , UserTopicVisibilityPolicy .muted)],
211+ unreadMsgs: unreadMsgs);
212+ final finder = find.byWidgetPredicate ((widget) => widget is MutedUnreadBadge );
213+ check (finder.evaluate ().length).equals (0 );
214+ });
215+
216+ testWidgets ('muted unread badge does not show with any unmuted unreads' , (tester) async {
217+ final stream = eg.stream ();
218+ final unreadMsgs = eg.unreadMsgs (streams: [
219+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'a' , unreadMessageIds: [1 , 2 ]),
220+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
221+ ]);
222+ await setupStreamListPage (tester,
223+ subscriptions: [eg.subscription (stream, isMuted: true )],
224+ userTopics: [
225+ eg.userTopicItem (stream, 'b' , UserTopicVisibilityPolicy .muted),
226+ eg.userTopicItem (stream, 'a' , UserTopicVisibilityPolicy .unmuted),
227+ ],
228+ unreadMsgs: unreadMsgs);
229+ final finder = find.byWidgetPredicate ((widget) => widget is MutedUnreadBadge );
230+ check (finder.evaluate ().length).equals (0 );
231+ });
232+
190233 testWidgets ('color propagates to icon and badge' , (tester) async {
191234 final stream = eg.stream ();
192235 final unreadMsgs = eg.unreadMsgs (streams: [
0 commit comments