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