@@ -260,5 +260,44 @@ void main() {
260
260
expect (container.read (selectedIdEditStateProvider), isNotNull);
261
261
expect ((container.read (selectedIdEditStateProvider)).runtimeType, String );
262
262
});
263
+
264
+ testWidgets (
265
+ 'It should be set back to null when user taps outside name editor' ,
266
+ (tester) async {
267
+ await tester.pumpWidget (
268
+ const ProviderScope (
269
+ child: MaterialApp (
270
+ home: CollectionPane (),
271
+ ),
272
+ ),
273
+ );
274
+
275
+ // Grab the CollectionPane widget and its ProviderContainer
276
+ final collectionPane = tester.element (find.byType (CollectionPane ));
277
+ final container = ProviderScope .containerOf (collectionPane);
278
+
279
+ // Tap on the three dots to open the request card menu
280
+ await tester.tap (find.byType (RequestList ));
281
+ await tester.pump ();
282
+ await tester.tap (find.byType (RequestItem ));
283
+ await tester.pump ();
284
+ await tester.tap (find.byIcon (Icons .more_vert).first);
285
+ await tester.pumpAndSettle ();
286
+
287
+ // Tap on the "Rename" option in the menu
288
+ await tester.tap (find.text ('Rename' ));
289
+ await tester.pumpAndSettle ();
290
+
291
+ // Verify that the selectedIdEditStateProvider is not null
292
+ expect (container.read (selectedIdEditStateProvider), isNotNull);
293
+ expect ((container.read (selectedIdEditStateProvider)).runtimeType, String );
294
+
295
+ // Tap on the screen to simulate tapping outside the name editor
296
+ await tester.tap (find.byType (CollectionPane ));
297
+ await tester.pumpAndSettle ();
298
+
299
+ // Verify that the selectedIdEditStateProvider is null
300
+ expect (container.read (selectedIdEditStateProvider), null );
301
+ });
263
302
});
264
303
}
0 commit comments