A whole bunch of changes
This commit is contained in:
parent
901ec678a3
commit
956231048e
122 changed files with 5442 additions and 914 deletions
57
test/report_screen_test.dart
Normal file
57
test/report_screen_test.dart
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:fuel_tax_tracker/screens/report_screen.dart';
|
||||
import 'package:fuel_tax_tracker/services/app_state.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows both toggles, off by default, with the cross-reference hint only when both are on',
|
||||
(tester) async {
|
||||
final appState = AppState()..isLoading = false;
|
||||
|
||||
await tester.pumpWidget(
|
||||
ChangeNotifierProvider.value(
|
||||
value: appState,
|
||||
child: const MaterialApp(home: ReportScreen()),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Include Receipt Images'), findsOneWidget);
|
||||
expect(find.text('Include Receipt Line Items'), findsOneWidget);
|
||||
expect(
|
||||
tester.widgetList<SwitchListTile>(find.byType(SwitchListTile)).map((s) => s.value),
|
||||
[false, false],
|
||||
);
|
||||
expect(find.textContaining('matching number'), findsNothing);
|
||||
|
||||
await tester.tap(find.text('Include Receipt Images'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('matching number'), findsNothing, reason: 'only one toggle is on');
|
||||
|
||||
await tester.tap(find.text('Include Receipt Line Items'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('matching number'), findsOneWidget, reason: 'both toggles now on');
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'shows a link to the state refund claim form, regardless of whether a range is picked',
|
||||
(tester) async {
|
||||
final appState = AppState()..isLoading = false;
|
||||
|
||||
await tester.pumpWidget(
|
||||
ChangeNotifierProvider.value(
|
||||
value: appState,
|
||||
child: const MaterialApp(home: ReportScreen()),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Need the refund claim form?'), findsOneWidget);
|
||||
await tester.scrollUntilVisible(
|
||||
find.text('Get the Motor Fuel Refund Claim form'),
|
||||
200,
|
||||
scrollable: find.byType(Scrollable),
|
||||
);
|
||||
expect(find.text('Get the Motor Fuel Refund Claim form'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue