fixed animated dialog picker tests

This commit is contained in:
Vadim 2023-10-07 00:11:21 +02:00
parent e15d64b10f
commit fce20c7154
3 changed files with 4 additions and 8 deletions

View file

@ -118,11 +118,7 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
), ),
const SizedBox(width: Dimens.grid16), const SizedBox(width: Dimens.grid16),
TextButton( TextButton(
onPressed: () { onPressed: () => widget.onSelect(_selectedValue),
if (widget.initialValue != _selectedValue) {
widget.onSelect(_selectedValue);
}
},
child: Text(S.of(context).select), child: Text(S.of(context).select),
), ),
], ],

View file

@ -101,7 +101,7 @@ extension WidgetTesterActions on WidgetTester {
); );
expect(cancelButton, findsOneWidget); expect(cancelButton, findsOneWidget);
await tap(cancelButton); await tap(cancelButton);
await pumpAndSettle(); await pumpAndSettle(Dimens.durationML);
} }
Future<void> tapCancelButton() async { Future<void> tapCancelButton() async {
@ -110,6 +110,6 @@ extension WidgetTesterActions on WidgetTester {
); );
expect(cancelButton, findsOneWidget); expect(cancelButton, findsOneWidget);
await tap(cancelButton); await tap(cancelButton);
await pumpAndSettle(); await pumpAndSettle(Dimens.durationML);
} }
} }

View file

@ -41,7 +41,7 @@ void main() {
expect(find.byType(DialogPicker<IsoValue>), findsOneWidget); expect(find.byType(DialogPicker<IsoValue>), findsOneWidget);
await tester.tapListTile(400); await tester.tapListTile(400);
await tester.tapSelectButton(); await tester.tapSelectButton();
verifyNever(() => functions.onChanged(const IsoValue(400, StopType.full))); verify(() => functions.onChanged(const IsoValue(400, StopType.full))).called(1);
}, },
); );
}, },