@@ -140,6 +140,52 @@ void main() {
140
140
// TODO test that tapping a conversation row opens the message list
141
141
// for the conversation
142
142
143
+ group ('muting' , () { // aka topic visibility
144
+ testWidgets ('baseline' , (tester) async {
145
+ final stream = eg.stream ();
146
+ final subscription = eg.subscription (stream);
147
+ await setupPage (tester,
148
+ streams: [stream],
149
+ subscriptions: [subscription],
150
+ unreadMessages: [eg.streamMessage (stream: stream, topic: 'lunch' )]);
151
+ check (tester.widgetList (find.text ('lunch' ))).length.equals (1 );
152
+ });
153
+
154
+ testWidgets ('muted topic' , (tester) async {
155
+ final stream = eg.stream ();
156
+ final subscription = eg.subscription (stream);
157
+ await setupPage (tester,
158
+ streams: [stream],
159
+ subscriptions: [subscription],
160
+ unreadMessages: [eg.streamMessage (stream: stream, topic: 'lunch' )]);
161
+ store.addUserTopic (stream, 'lunch' , UserTopicVisibilityPolicy .muted);
162
+ await tester.pump ();
163
+ check (tester.widgetList (find.text ('lunch' ))).length.equals (0 );
164
+ });
165
+
166
+ testWidgets ('muted stream' , (tester) async {
167
+ final stream = eg.stream ();
168
+ final subscription = eg.subscription (stream, isMuted: true );
169
+ await setupPage (tester,
170
+ streams: [stream],
171
+ subscriptions: [subscription],
172
+ unreadMessages: [eg.streamMessage (stream: stream, topic: 'lunch' )]);
173
+ check (tester.widgetList (find.text ('lunch' ))).length.equals (0 );
174
+ });
175
+
176
+ testWidgets ('unmuted topic in muted stream' , (tester) async {
177
+ final stream = eg.stream ();
178
+ final subscription = eg.subscription (stream, isMuted: true );
179
+ await setupPage (tester,
180
+ streams: [stream],
181
+ subscriptions: [subscription],
182
+ unreadMessages: [eg.streamMessage (stream: stream, topic: 'lunch' )]);
183
+ store.addUserTopic (stream, 'lunch' , UserTopicVisibilityPolicy .unmuted);
184
+ await tester.pump ();
185
+ check (tester.widgetList (find.text ('lunch' ))).length.equals (1 );
186
+ });
187
+ });
188
+
143
189
group ('collapsing' , () {
144
190
Icon findHeaderCollapseIcon (WidgetTester tester, Widget headerRow) {
145
191
return tester.widget (
0 commit comments