From fce20c7154fd80e6ebeea26784ed2ad77841ff63 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Sat, 7 Oct 2023 00:11:21 +0200 Subject: [PATCH] fixed animated dialog picker tests --- .../components/dialog_picker/widget_picker_dialog.dart | 6 +----- .../readings_container/shared/animated_dialog_test.dart | 4 ++-- .../readings_container/shared/dialog_picker_test.dart | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart b/lib/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart index 9fdb8fa..3c253b1 100644 --- a/lib/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart +++ b/lib/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart @@ -118,11 +118,7 @@ class _DialogPickerState extends State> { ), const SizedBox(width: Dimens.grid16), TextButton( - onPressed: () { - if (widget.initialValue != _selectedValue) { - widget.onSelect(_selectedValue); - } - }, + onPressed: () => widget.onSelect(_selectedValue), child: Text(S.of(context).select), ), ], diff --git a/test/screens/metering/components/shared/readings_container/shared/animated_dialog_test.dart b/test/screens/metering/components/shared/readings_container/shared/animated_dialog_test.dart index b303a03..86d2b73 100644 --- a/test/screens/metering/components/shared/readings_container/shared/animated_dialog_test.dart +++ b/test/screens/metering/components/shared/readings_container/shared/animated_dialog_test.dart @@ -101,7 +101,7 @@ extension WidgetTesterActions on WidgetTester { ); expect(cancelButton, findsOneWidget); await tap(cancelButton); - await pumpAndSettle(); + await pumpAndSettle(Dimens.durationML); } Future tapCancelButton() async { @@ -110,6 +110,6 @@ extension WidgetTesterActions on WidgetTester { ); expect(cancelButton, findsOneWidget); await tap(cancelButton); - await pumpAndSettle(); + await pumpAndSettle(Dimens.durationML); } } diff --git a/test/screens/metering/components/shared/readings_container/shared/dialog_picker_test.dart b/test/screens/metering/components/shared/readings_container/shared/dialog_picker_test.dart index 56a05d8..88c9961 100644 --- a/test/screens/metering/components/shared/readings_container/shared/dialog_picker_test.dart +++ b/test/screens/metering/components/shared/readings_container/shared/dialog_picker_test.dart @@ -41,7 +41,7 @@ void main() { expect(find.byType(DialogPicker), findsOneWidget); await tester.tapListTile(400); await tester.tapSelectButton(); - verifyNever(() => functions.onChanged(const IsoValue(400, StopType.full))); + verify(() => functions.onChanged(const IsoValue(400, StopType.full))).called(1); }, ); },