@@ -154,6 +154,7 @@ void main() {
154
154
eg.subscription (stream),
155
155
], unreadMsgs: unreadMsgs);
156
156
check (find.byType (UnreadCountBadge ).evaluate ()).length.equals (1 );
157
+ check (find.byType (MutedUnreadBadge ).evaluate ().length).equals (0 );
157
158
});
158
159
159
160
testWidgets ('unread badge counts unmuted only' , (tester) async {
@@ -174,6 +175,7 @@ void main() {
174
175
check (tester.widget <Text >(find.descendant (
175
176
of: find.byType (UnreadCountBadge ), matching: find.byType (Text ))))
176
177
.data.equals ('1' );
178
+ check (find.byType (MutedUnreadBadge ).evaluate ().length).equals (0 );
177
179
});
178
180
179
181
testWidgets ('unread badge does not show with no unreads' , (tester) async {
@@ -183,6 +185,46 @@ void main() {
183
185
eg.subscription (stream),
184
186
], unreadMsgs: unreadMsgs);
185
187
check (find.byType (UnreadCountBadge ).evaluate ()).length.equals (0 );
188
+ check (find.byType (MutedUnreadBadge ).evaluate ().length).equals (0 );
189
+ });
190
+
191
+ testWidgets ('muted unread badge shows when unreads are visible in channel but not inbox' , (tester) async {
192
+ final stream = eg.stream ();
193
+ final unreadMsgs = eg.unreadMsgs (channels: [
194
+ UnreadChannelSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
195
+ ]);
196
+ await setupStreamListPage (tester,
197
+ subscriptions: [eg.subscription (stream, isMuted: true )],
198
+ userTopics: [eg.userTopicItem (stream, 'b' , UserTopicVisibilityPolicy .none)],
199
+ unreadMsgs: unreadMsgs);
200
+
201
+ check (find.byType (MutedUnreadBadge ).evaluate ().length).equals (1 );
202
+ });
203
+
204
+ testWidgets ('muted unread badge does not show when unreads are visible in both channel & inbox' , (tester) async {
205
+ final stream = eg.stream ();
206
+ final unreadMsgs = eg.unreadMsgs (channels: [
207
+ UnreadChannelSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
208
+ ]);
209
+ await setupStreamListPage (tester,
210
+ subscriptions: [eg.subscription (stream, isMuted: false )],
211
+ userTopics: [eg.userTopicItem (stream, 'b' , UserTopicVisibilityPolicy .none)],
212
+ unreadMsgs: unreadMsgs);
213
+
214
+ check (find.byType (MutedUnreadBadge ).evaluate ().length).equals (0 );
215
+ });
216
+
217
+ testWidgets ('muted unread badge does not show when unreads are not visible in channel nor inbox' , (tester) async {
218
+ final stream = eg.stream ();
219
+ final unreadMsgs = eg.unreadMsgs (channels: [
220
+ UnreadChannelSnapshot (streamId: stream.streamId, topic: 'b' , unreadMessageIds: [3 ]),
221
+ ]);
222
+ await setupStreamListPage (tester,
223
+ subscriptions: [eg.subscription (stream, isMuted: true )],
224
+ userTopics: [eg.userTopicItem (stream, 'b' , UserTopicVisibilityPolicy .muted)],
225
+ unreadMsgs: unreadMsgs);
226
+
227
+ check (find.byType (MutedUnreadBadge ).evaluate ().length).equals (0 );
186
228
});
187
229
188
230
testWidgets ('color propagates to icon and badge' , (tester) async {
0 commit comments