Skip to content

Commit f1ec852

Browse files
committed
Add test case for selectedIdEditStateProvider after rename button is tapped
1 parent a057281 commit f1ec852

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/providers/ui_providers_test.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,35 @@ void main() {
230230
final container = ProviderScope.containerOf(collectionPane);
231231
expect(container.read(selectedIdEditStateProvider), null);
232232
});
233+
234+
testWidgets(
235+
'selectedIdEditStateProvider should not be null after rename button has been tapped',
236+
(tester) async {
237+
await tester.pumpWidget(
238+
const ProviderScope(
239+
child: MaterialApp(
240+
home: CollectionPane(),
241+
),
242+
),
243+
);
244+
245+
// Tap on the three dots to open the request card menu
246+
await tester.tap(find.byType(RequestList));
247+
await tester.pump();
248+
await tester.tap(find.byType(RequestItem));
249+
await tester.pump();
250+
await tester.tap(find.byIcon(Icons.more_vert).first);
251+
await tester.pumpAndSettle();
252+
253+
// Tap on the "Rename" option in the menu
254+
await tester.tap(find.text('Rename'));
255+
await tester.pumpAndSettle();
256+
257+
// Verify that the selectedIdEditStateProvider is not null
258+
final collectionPane = tester.element(find.byType(CollectionPane));
259+
final container = ProviderScope.containerOf(collectionPane);
260+
expect(container.read(selectedIdEditStateProvider), isNotNull);
261+
expect((container.read(selectedIdEditStateProvider)).runtimeType, String);
262+
});
233263
});
234264
}

0 commit comments

Comments
 (0)