@@ -116,24 +116,19 @@ void main() {
116
116
});
117
117
118
118
group ('user filtering' , () {
119
- final mutedUser = eg.user (fullName: 'Someone Muted' );
120
119
final testUsers = [
121
120
eg.user (fullName: 'Alice Anderson' ),
122
121
eg.user (fullName: 'Bob Brown' ),
123
122
eg.user (fullName: 'Charlie Carter' ),
124
- mutedUser,
125
123
];
126
124
127
- testWidgets ('shows all non-muted users initially' , (tester) async {
128
- await setupSheet (tester, users: testUsers, mutedUserIds : [mutedUser.userId] );
125
+ testWidgets ('shows full list initially' , (tester) async {
126
+ await setupSheet (tester, users: testUsers);
129
127
check (findText (includePlaceholders: false , 'Alice Anderson' )).findsOne ();
130
128
check (findText (includePlaceholders: false , 'Bob Brown' )).findsOne ();
131
129
check (findText (includePlaceholders: false , 'Charlie Carter' )).findsOne ();
132
-
133
130
check (find.byIcon (ZulipIcons .check_circle_unchecked)).findsExactly (3 );
134
131
check (find.byIcon (ZulipIcons .check_circle_checked)).findsNothing ();
135
- check (findText (includePlaceholders: false , 'Someone Muted' )).findsNothing ();
136
- check (findText (includePlaceholders: false , 'Muted user' )).findsNothing ();
137
132
});
138
133
139
134
testWidgets ('shows filtered users based on search' , (tester) async {
@@ -145,6 +140,27 @@ void main() {
145
140
check (findText (includePlaceholders: false , 'Bob Brown' )).findsNothing ();
146
141
});
147
142
143
+ testWidgets ('muted users excluded' , (tester) async {
144
+ // Omit muted users both before there's a query…
145
+ final mutedUser = eg.user (fullName: 'Someone Muted' );
146
+ await setupSheet (tester,
147
+ users: [...testUsers, mutedUser], mutedUserIds: [mutedUser.userId]);
148
+ check (findText (includePlaceholders: false , 'Someone Muted' )).findsNothing ();
149
+ check (findText (includePlaceholders: false , 'Muted user' )).findsNothing ();
150
+ check (findText (includePlaceholders: false , 'Alice Anderson' )).findsOne ();
151
+ check (find.byIcon (ZulipIcons .check_circle_unchecked)).findsExactly (3 );
152
+
153
+ // … and after a query. One which matches both the user's actual name and
154
+ // the replacement text "Muted user", for good measure.
155
+ await tester.enterText (find.byType (TextField ), 'e' );
156
+ await tester.pump ();
157
+ check (findText (includePlaceholders: false , 'Someone Muted' )).findsNothing ();
158
+ check (findText (includePlaceholders: false , 'Muted user' )).findsNothing ();
159
+ check (findText (includePlaceholders: false , 'Alice Anderson' )).findsOne ();
160
+ check (findText (includePlaceholders: false , 'Charlie Carter' )).findsOne ();
161
+ check (find.byIcon (ZulipIcons .check_circle_unchecked)).findsExactly (2 );
162
+ });
163
+
148
164
// TODO test sorting by recent-DMs
149
165
// TODO test that scroll position resets on query change
150
166
0 commit comments