@@ -174,6 +174,50 @@ void main() {
174174 check (find.byType (UnreadCountBadge ).evaluate ()).length.equals (0 );
175175 });
176176
177+ testWidgets ('muted unread badge shows with muted unreads' , (tester) async {
178+ final stream = eg.stream ();
179+ final unreadMsgs = eg.unreadMsgs (streams: [
180+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'a' , unreadMessageIds: [1 , 2 ]),
181+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
182+ ]);
183+ await setupStreamListPage (tester,
184+ subscriptions: [eg.subscription (stream, isMuted: true )],
185+ userTopics: [UserTopicItem (
186+ streamId: stream.streamId,
187+ topicName: 'b' ,
188+ lastUpdated: 1234567890 ,
189+ visibilityPolicy: UserTopicVisibilityPolicy .muted,
190+ )],
191+ unreadMsgs: unreadMsgs);
192+ final finder = find.byWidgetPredicate ((widget) => widget is MutedUnreadBadge );
193+ check (finder.evaluate ().length).equals (1 );
194+ });
195+
196+ testWidgets ('muted unread badge does not show with any unmuted unreads' , (tester) async {
197+ final stream = eg.stream ();
198+ final unreadMsgs = eg.unreadMsgs (streams: [
199+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'a' , unreadMessageIds: [1 , 2 ]),
200+ UnreadStreamSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
201+ ]);
202+ await setupStreamListPage (tester,
203+ subscriptions: [eg.subscription (stream, isMuted: true )],
204+ userTopics: [UserTopicItem (
205+ streamId: stream.streamId,
206+ topicName: 'b' ,
207+ lastUpdated: 1234567890 ,
208+ visibilityPolicy: UserTopicVisibilityPolicy .muted,
209+ ),
210+ UserTopicItem (
211+ streamId: stream.streamId,
212+ topicName: 'a' ,
213+ lastUpdated: 9876543210 ,
214+ visibilityPolicy: UserTopicVisibilityPolicy .unmuted,
215+ )],
216+ unreadMsgs: unreadMsgs);
217+ final finder = find.byWidgetPredicate ((widget) => widget is MutedUnreadBadge );
218+ check (finder.evaluate ().length).equals (0 );
219+ });
220+
177221 testWidgets ('color propagates to icon and badge' , (tester) async {
178222 final stream = eg.stream ();
179223 final unreadMsgs = eg.unreadMsgs (streams: [
0 commit comments