@@ -50,87 +50,98 @@ void main() {
5050 );
5151 });
5252
53- testWidgets ('replaces the status line with a changeable presence pill' , (
54- tester,
55- ) async {
56- final presenceNotifier = _FakePresenceNotifier ('away' );
57- await tester.pumpWidget (
58- WidgetHelpers .testable (
59- overrides: [
60- profileProvider.overrideWith (_FakeProfileNotifier .new ),
61- presenceProvider.overrideWith (() => presenceNotifier),
62- userStatusProvider.overrideWith (
63- () => _FakeUserStatusNotifier (
64- const UserStatus (text: 'Focusing' , emoji: '🎯' , updatedAt: 1 ),
53+ testWidgets (
54+ 'keeps text-only status visible beside a changeable presence pill' ,
55+ (tester) async {
56+ final presenceNotifier = _FakePresenceNotifier ('away' );
57+ await tester.pumpWidget (
58+ WidgetHelpers .testable (
59+ overrides: [
60+ profileProvider.overrideWith (_FakeProfileNotifier .new ),
61+ presenceProvider.overrideWith (() => presenceNotifier),
62+ userStatusProvider.overrideWith (
63+ () => _FakeUserStatusNotifier (
64+ const UserStatus (text: 'Focusing' , emoji: '' , updatedAt: 1 ),
65+ ),
6566 ),
66- ),
67- customEmojiListProvider.overrideWithValue (const []),
68- ],
69- child: const SettingsProfileHeader (),
70- ),
71- );
72- await tester.pumpAndSettle ();
73-
74- expect (find.text ('Focusing' ), findsNothing);
75- expect (
76- find.byKey (const ValueKey ('settings-presence-label' )),
77- findsOneWidget,
78- );
79- expect (find.text ('Away' ), findsOneWidget);
80- expect (
81- tester
82- .widget <Text >(find.byKey (const ValueKey ('settings-presence-label' )))
83- .style
84- ? .fontSize,
85- filterChipTextStyle.fontSize,
86- );
87- expect (
88- tester
89- .getSize (find.byKey (const ValueKey ('settings-presence-target' )))
90- .height,
91- 48 ,
92- );
93- expect (
94- tester
95- .getSize (find.byKey (const ValueKey ('settings-presence-pill' )))
96- .height,
97- greaterThanOrEqualTo (31 ),
98- );
99-
100- final presenceTarget = find.byKey (
101- const ValueKey ('settings-presence-target' ),
102- );
103- final targetRect = tester.getRect (presenceTarget);
104- await tester.tapAt (Offset (targetRect.center.dx, targetRect.bottom - 1 ));
105- await tester.pump ();
106-
107- final scale = tester.widget <ScaleTransition >(
108- find.byKey (const ValueKey ('activity-popover-scale' )),
109- );
110- expect (scale.alignment, Alignment .topCenter);
111- expect (
112- find.byKey (const ValueKey ('settings-presence-popover' )),
113- findsOneWidget,
114- );
115- await tester.pumpAndSettle ();
116-
117- expect (
118- find.byKey (const ValueKey ('settings-presence-online' )),
119- findsOneWidget,
120- );
121- expect (
122- find.byKey (const ValueKey ('settings-presence-away' )),
123- findsOneWidget,
124- );
125- expect (
126- find.byKey (const ValueKey ('settings-presence-offline' )),
127- findsOneWidget,
128- );
129-
130- await tester.tap (find.byKey (const ValueKey ('settings-presence-offline' )));
131- await tester.pumpAndSettle ();
132- expect (presenceNotifier.selected, ['offline' ]);
133- });
67+ customEmojiListProvider.overrideWithValue (const []),
68+ ],
69+ child: const SettingsProfileHeader (),
70+ ),
71+ );
72+ await tester.pumpAndSettle ();
73+
74+ expect (find.text ('Focusing' ), findsOneWidget);
75+ await tester.tap (find.text ('Focusing' ));
76+ await tester.pumpAndSettle ();
77+ expect (find.text ('Set a status' ), findsOneWidget);
78+ expect (
79+ tester.widget <TextField >(find.byType (TextField )).controller? .text,
80+ 'Focusing' ,
81+ );
82+ await tester.binding.handlePopRoute ();
83+ await tester.pumpAndSettle ();
84+
85+ expect (
86+ find.byKey (const ValueKey ('settings-presence-label' )),
87+ findsOneWidget,
88+ );
89+ expect (find.text ('Away' ), findsOneWidget);
90+ expect (
91+ tester
92+ .widget <Text >(find.byKey (const ValueKey ('settings-presence-label' )))
93+ .style
94+ ? .fontSize,
95+ filterChipTextStyle.fontSize,
96+ );
97+ expect (
98+ tester
99+ .getSize (find.byKey (const ValueKey ('settings-presence-target' )))
100+ .height,
101+ 48 ,
102+ );
103+ expect (
104+ tester
105+ .getSize (find.byKey (const ValueKey ('settings-presence-pill' )))
106+ .height,
107+ greaterThanOrEqualTo (31 ),
108+ );
109+
110+ final presenceTarget = find.byKey (
111+ const ValueKey ('settings-presence-target' ),
112+ );
113+ final targetRect = tester.getRect (presenceTarget);
114+ await tester.tapAt (Offset (targetRect.center.dx, targetRect.bottom - 1 ));
115+ await tester.pump ();
116+
117+ final scale = tester.widget <ScaleTransition >(
118+ find.byKey (const ValueKey ('activity-popover-scale' )),
119+ );
120+ expect (scale.alignment, Alignment .topCenter);
121+ expect (
122+ find.byKey (const ValueKey ('settings-presence-popover' )),
123+ findsOneWidget,
124+ );
125+ await tester.pumpAndSettle ();
126+
127+ expect (
128+ find.byKey (const ValueKey ('settings-presence-online' )),
129+ findsOneWidget,
130+ );
131+ expect (
132+ find.byKey (const ValueKey ('settings-presence-away' )),
133+ findsOneWidget,
134+ );
135+ expect (
136+ find.byKey (const ValueKey ('settings-presence-offline' )),
137+ findsOneWidget,
138+ );
139+
140+ await tester.tap (find.byKey (const ValueKey ('settings-presence-offline' )));
141+ await tester.pumpAndSettle ();
142+ expect (presenceNotifier.selected, ['offline' ]);
143+ },
144+ );
134145}
135146
136147class _FakeProfileNotifier extends ProfileNotifier {
0 commit comments