mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
Added tests for DropdownButtonContentType
This commit is contained in:
@ -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<ContentType>), findsOneWidget);
|
||||
expect(
|
||||
(tester.widget(find.byType(DropdownButton<ContentType>))
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user