Skip to content

Commit

Permalink
Fix tests for date chips
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanSarwar45 committed Dec 16, 2023
1 parent 321ccc3 commit 2b8582a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/common/widgets/fields/date_picker_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class DateChip extends StatelessWidget {
Widget build(BuildContext context) {
ColorScheme colorScheme = Theme.of(context).colorScheme;
return CardContainer(
key: const Key("DateChip"),
color: colorScheme.primary,
margin: const EdgeInsets.all(0),
child: Padding(
Expand Down
6 changes: 3 additions & 3 deletions test/common/widgets/fields/date_picker_field_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ void main() {
testWidgets('with 1 date', (tester) async {
final value = [DateTime(2021, 1, 1)];
await _renderWidget(tester, value: value);
final valueFinder = find.byType(DateChip);
final valueFinder = find.byKey(const Key("DateChip"));
expect(valueFinder, findsOneWidget);
});
testWidgets('with 2 dates', (tester) async {
final value = [DateTime(2021, 1, 1), DateTime(2021, 1, 2)];
await _renderWidget(tester, value: value);
final valueFinder = find.byType(DateChip);
final valueFinder = find.byKey(const Key("DateChip"));
expect(valueFinder, findsNWidgets(2));
});
testWidgets('with 10 dates', (tester) async {
final value = List.generate(10, (index) => DateTime(2021, 1, 1));
await _renderWidget(tester, value: value);
final valueFinder = find.byType(DateChip);
final valueFinder = find.byKey(const Key("DateChip"));
expect(valueFinder, findsNWidgets(10));
});
});
Expand Down

0 comments on commit 2b8582a

Please sign in to comment.