mirror of
https://github.com/foss42/apidash.git
synced 2025-05-29 04:50:36 +08:00
test: dialog tests
This commit is contained in:
49
test/widgets/dropdown_formdata_test.dart
Normal file
49
test/widgets/dropdown_formdata_test.dart
Normal file
@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:apidash/widgets/widgets.dart';
|
||||
import 'package:apidash/consts.dart';
|
||||
import '../test_consts.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Testing Dropdown for FormData', (tester) async {
|
||||
dynamic changedValue;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
title: 'Dropdown FormData Type testing',
|
||||
theme: kThemeDataLight,
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
DropdownButtonFormData(
|
||||
formDataType: FormDataType.file,
|
||||
onChanged: (value) {
|
||||
changedValue = value!;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byIcon(Icons.unfold_more_rounded), findsOneWidget);
|
||||
expect(find.byType(DropdownButton<FormDataType>), findsOneWidget);
|
||||
expect(
|
||||
(tester.widget(find.byType(DropdownButton<FormDataType>))
|
||||
as DropdownButton)
|
||||
.value,
|
||||
equals(FormDataType.file));
|
||||
|
||||
await tester.tap(find.text('file'));
|
||||
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, FormDataType.text);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user