cpd_2022_zi/test/widget_tests/widget_entry_detail_test.dart

44 lines
1.2 KiB
Dart

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');
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,
),
)),
);
expect(find.byType(ExpansionTile), findsOneWidget);
});
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,
),
)),
);
expect(find.byType(ListTile), findsOneWidget);
});
});
}