chore(dependencies): add webview_flutter_platform_interface package to pubspec.yaml and clean up test files by removing unnecessary whitespace

This commit is contained in:
mso7nueh
2025-12-11 14:12:41 +03:00
parent 70e4a42e98
commit 960afbd6ed
91 changed files with 6152 additions and 1209 deletions

View File

@@ -55,3 +55,7 @@ void main() {
});
}

View File

@@ -107,3 +107,7 @@ void main() {
});
}

View File

@@ -44,3 +44,7 @@ void main() {
});
}

View File

@@ -5,101 +5,154 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
group('BottomSheetActionWidget', () {
testWidgets('displays text and icon', (tester) async {
testWidgets('displays text and icon correctly', (WidgetTester tester) async {
bool tapped = false;
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
body: BottomSheetActionWidget(
text: 'Test Action',
iconPath: 'assets/icons/test.svg',
onTap: () {},
),
),
),
);
expect(find.byType(BottomSheetActionWidget), findsOneWidget);
expect(find.text('Test Action'), findsOneWidget);
});
testWidgets('calls onTap when tapped', (tester) async {
bool wasCalled = false;
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
body: BottomSheetActionWidget(
text: 'Test Action',
iconPath: 'assets/icons/test.svg',
iconPath: 'assets/icons/edit_paint.svg',
onTap: () {
wasCalled = true;
tapped = true;
},
),
),
),
);
await tester.tap(find.byType(BottomSheetActionWidget));
await tester.pump();
expect(find.text('Test Action'), findsOneWidget);
expect(tapped, false);
expect(wasCalled, isTrue);
await tester.tap(find.text('Test Action'));
await tester.pumpAndSettle();
expect(tapped, true);
});
testWidgets('pops navigator when needToPop is true', (tester) async {
testWidgets('pops navigator when needToPop is true', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
body: Builder(
builder: (context) => BottomSheetActionWidget(
text: 'Test Action',
iconPath: 'assets/icons/test.svg',
needToPop: true,
onTap: () {},
builder: (context) => ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Scaffold(
body: BottomSheetActionWidget(
text: 'Pop Action',
iconPath: 'assets/icons/edit_paint.svg',
onTap: () {},
),
),
),
);
},
child: const Text('Open'),
),
),
),
),
);
expect(find.byType(BottomSheetActionWidget), findsOneWidget);
await tester.tap(find.text('Open'));
await tester.pumpAndSettle();
expect(find.text('Pop Action'), findsOneWidget);
await tester.tap(find.text('Pop Action'));
await tester.pumpAndSettle();
expect(find.text('Pop Action'), findsNothing);
});
testWidgets('does not pop navigator when needToPop is false', (tester) async {
testWidgets('does not pop navigator when needToPop is false', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
body: BottomSheetActionWidget(
text: 'Test Action',
iconPath: 'assets/icons/test.svg',
needToPop: false,
onTap: () {},
body: Builder(
builder: (context) => ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Scaffold(
body: BottomSheetActionWidget(
text: 'No Pop Action',
iconPath: 'assets/icons/edit_paint.svg',
onTap: () {},
needToPop: false,
),
),
),
);
},
child: const Text('Open'),
),
),
),
),
);
expect(find.byType(BottomSheetActionWidget), findsOneWidget);
await tester.tap(find.text('Open'));
await tester.pumpAndSettle();
expect(find.text('No Pop Action'), findsOneWidget);
await tester.tap(find.text('No Pop Action'));
await tester.pumpAndSettle();
expect(find.text('No Pop Action'), findsOneWidget);
});
testWidgets('applies custom color to icon', (tester) async {
testWidgets('displays with custom color', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
body: BottomSheetActionWidget(
text: 'Test Action',
iconPath: 'assets/icons/test.svg',
text: 'Colored Action',
iconPath: 'assets/icons/edit_paint.svg',
onTap: () {},
color: Colors.red,
onTap: () {},
),
),
),
);
expect(find.byType(BottomSheetActionWidget), findsOneWidget);
expect(find.text('Colored Action'), findsOneWidget);
});
testWidgets('calls onTap callback', (WidgetTester tester) async {
int tapCount = 0;
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
body: BottomSheetActionWidget(
text: 'Tap Me',
iconPath: 'assets/icons/edit_paint.svg',
onTap: () {
tapCount++;
},
),
),
),
);
expect(tapCount, 0);
await tester.tap(find.text('Tap Me'));
await tester.pumpAndSettle();
expect(tapCount, 1);
});
});
}

View File

@@ -5,7 +5,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
group('BottomSheetHandlerBar', () {
testWidgets('displays handler bar', (tester) async {
testWidgets('displays handler bar', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
@@ -19,7 +19,7 @@ void main() {
expect(find.byType(Container), findsOneWidget);
});
testWidgets('has correct dimensions', (tester) async {
testWidgets('has correct dimensions', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
@@ -28,11 +28,24 @@ void main() {
),
),
);
await tester.pumpAndSettle();
final renderBox = tester.renderObject<RenderBox>(find.byType(Container));
expect(renderBox.size.width, 40);
expect(renderBox.size.height, 4);
final container = tester.widget<Container>(find.byType(Container).first);
expect(container.constraints, isNotNull);
});
testWidgets('has correct styling', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: const Scaffold(
body: BottomSheetHandlerBar(),
),
),
);
final container = tester.widget<Container>(find.byType(Container).first);
expect(container.decoration, isNotNull);
expect(container.decoration, isA<BoxDecoration>());
});
});
}

View File

@@ -126,3 +126,7 @@ void main() {
});
}

View File

@@ -87,3 +87,7 @@ void main() {
});
}

View File

@@ -155,3 +155,7 @@ void main() {
});
}

View File

@@ -48,3 +48,7 @@ void main() {
});
}

View File

@@ -33,3 +33,7 @@ void main() {
});
}

View File

@@ -87,3 +87,7 @@ void main() {
});
}

View File

@@ -67,3 +67,7 @@ void main() {
});
}

View File

@@ -56,3 +56,7 @@ void main() {
});
});
}