diff --git a/test/widgets/dropdowns_test.dart b/test/widgets/dropdowns_test.dart index 14b172e0..d6922bfa 100644 --- a/test/widgets/dropdowns_test.dart +++ b/test/widgets/dropdowns_test.dart @@ -45,4 +45,46 @@ void main() { expect(changedValue, HTTPVerb.put); }); + + testWidgets('Testing Dropdown for Content Type', (tester) async { + dynamic changedValue; + await tester.pumpWidget( + MaterialApp( + title: 'Dropdown Content Type testing', + theme: kThemeDataLight, + home: Scaffold( + body: Center( + child: Column( + children: [ + DropdownButtonContentType( + contentType: ContentType.json, + onChanged: (value) { + changedValue = value!; + }, + ), + ], + ), + ), + ), + ), + ); + + expect(find.byIcon(Icons.unfold_more_rounded), findsOneWidget); + expect(find.byType(DropdownButton), findsOneWidget); + expect( + (tester.widget(find.byType(DropdownButton)) + as DropdownButton) + .value, + equals(ContentType.json)); + + await tester.tap(find.text('json')); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + + await tester.tap(find.text('text').last); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); + + expect(changedValue, ContentType.text); + }); }