Skip to content

Commit

Permalink
Add WoltModalSheet.modalBarrierColor tests (#304)
Browse files Browse the repository at this point in the history
* Add `WoltModalSheet.modalBarrierColor` tests

* Fix format
  • Loading branch information
TahaTesser authored Aug 15, 2024
1 parent cca4790 commit 2c6c245
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/wolt_modal_sheet_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ void main() {
Widget Function(Widget)? modalDecorator,
bool? barrierDismissible,
List<WoltModalSheetPage> Function(BuildContext)? pageListBuilder,
Color? modalBarrierColor,
}) {
return MaterialApp(
home: Scaffold(body: Center(
Expand All @@ -22,6 +23,7 @@ void main() {
pageContentDecorator: pageContentDecorator,
modalDecorator: modalDecorator,
barrierDismissible: barrierDismissible,
modalBarrierColor: modalBarrierColor,
pageListBuilder: pageListBuilder ??
(context) {
return <WoltModalSheetPage>[
Expand Down Expand Up @@ -318,4 +320,27 @@ void main() {
expect(modal.isAtLastPage, isTrue);
});
});

testWidgets('WoltModalSheet.modalBarrierColor defaults', (tester) async {
Color barrierColor = Colors.black54;
await tester.pumpWidget(buildSheetWithShow());

await tester.tap(find.text('Open sheet'));
await tester.pumpAndSettle();

final ColoredBox coloredBox = tester.widget(find.byType(ColoredBox));
expect(coloredBox.color, barrierColor);
});

testWidgets('Custom WoltModalSheet.modalBarrierColor', (tester) async {
Color barrierColor = const Color(0xFFFF0000);
await tester
.pumpWidget(buildSheetWithShow(modalBarrierColor: barrierColor));

await tester.tap(find.text('Open sheet'));
await tester.pumpAndSettle();

final ColoredBox coloredBox = tester.widget(find.byType(ColoredBox));
expect(coloredBox.color, barrierColor);
});
}

0 comments on commit 2c6c245

Please sign in to comment.