cpd_2022_zi/test/widget_tests/widget_entry_detail_test.dart

44 lines
1.2 KiB
Dart
Raw Permalink Normal View History

2023-03-06 21:04:35 +01:00
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:smoke_cess_app/widgets/entry_detail_widget.dart';
void main() {
initializeDateFormatting('de');
2023-03-06 22:54:09 +01:00
group('EntryDetail', () {
testWidgets('should use ExpansionTile if Comments is set',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: EntryDetail(
date: DateTime.now(),
entryComment: 'A comment',
entryData: 'Test',
iconData: Icons.plus_one,
),
)),
);
2023-03-06 21:04:35 +01:00
2023-03-06 22:54:09 +01:00
expect(find.byType(ExpansionTile), findsOneWidget);
});
2023-03-06 21:04:35 +01:00
2023-03-06 22:54:09 +01:00
testWidgets('should use ListTile if Comments is null',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: EntryDetail(
date: DateTime.now(),
entryComment: 'A comment',
entryData: 'Test',
iconData: Icons.plus_one,
),
)),
);
2023-03-06 21:04:35 +01:00
2023-03-06 22:54:09 +01:00
expect(find.byType(ListTile), findsOneWidget);
});
2023-03-06 21:04:35 +01:00
});
}