@@ -136,6 +136,35 @@ void main() {
136136 check (find.byIcon (ZulipIcons .check_circle_checked)).findsNothing ();
137137 });
138138
139+ testWidgets ('shows (you) label for self user in new DM list' , (tester) async {
140+ final self
= eg.
user (fullName
: 'Self User' ,email
: '[email protected] ' );
141+ final other
= eg.
user (fullName
: 'Other User' ,email
: '[email protected] ' );
142+ await setupSheet (tester, selfUser: self, users: [self, other]);
143+ // Self user's name is shown
144+ check (findText (includePlaceholders: false , 'Self User' )).findsOne ();
145+ // "(you)" label is shown for self
146+ final youTextFinder = find.byWidgetPredicate (
147+ (w) => w is Text && (w.data? .contains ('(you)' ) ?? false ));
148+ check (youTextFinder).findsOne ();
149+ // Other user does NOT get "(you)"
150+ check (findText (includePlaceholders: false , 'Other User' )).findsOne ();
151+ });
152+
153+ testWidgets ('does not show (you) label for non-self users' , (tester) async {
154+ final self
= eg.
user (fullName
: 'Self User' ,email
: '[email protected] ' );
155+ final other
= eg.
user (fullName
: 'Other User' ,email
: '[email protected] ' );
156+ await setupSheet (tester, selfUser: self, users: [other]);
157+ await tester.pump ();
158+ // Other user's name is shown
159+ check (findText (includePlaceholders: false , 'Other User' )).findsOne ();
160+ // "(you)" must not appear at all
161+ final otherRow = find.ancestor (
162+ of: findText (includePlaceholders: false , 'Other User' ),matching: find.byType (Row ));
163+ final youInOtherRow = find.descendant (of: otherRow, matching: find.byWidgetPredicate (
164+ (w) => w is Text && (w.data? .contains ('(you)' ) ?? false )));
165+ check (youInOtherRow).findsNothing ();
166+ });
167+
139168 testWidgets ('shows filtered users based on search' , (tester) async {
140169 await setupSheet (tester, users: testUsers);
141170 await tester.enterText (find.byType (TextField ), 'Alice' );
0 commit comments