Импорт (/imports, /instruments/pending) и фаза 4 (/goals, /income, /rebalance, /tax, аналитика-хаб с benchmarks_card) — по docs/ai/import-contract.md и docs/ai/phase4-contract.md. file_picker для загрузки отчёта.
45 lines
1.6 KiB
Dart
45 lines
1.6 KiB
Dart
import 'package:fintracker_app/features/shell/app_shell.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
Widget wrap(double width, {String location = '/'}) {
|
|
return MediaQuery(
|
|
data: MediaQueryData(size: Size(width, 800)),
|
|
child: MaterialApp(
|
|
home: AppShell(location: location, child: Container()),
|
|
),
|
|
);
|
|
}
|
|
|
|
testWidgets('shows a NavigationRail on a wide surface', (tester) async {
|
|
await tester.pumpWidget(wrap(1280));
|
|
expect(find.byType(NavigationRail), findsOneWidget);
|
|
expect(find.byType(NavigationBar), findsNothing);
|
|
});
|
|
|
|
testWidgets('shows a bottom NavigationBar on a narrow surface', (tester) async {
|
|
await tester.pumpWidget(wrap(400));
|
|
expect(find.byType(NavigationBar), findsOneWidget);
|
|
expect(find.byType(NavigationRail), findsNothing);
|
|
});
|
|
|
|
testWidgets('the resolve screen keeps Импорт selected', (tester) async {
|
|
await tester.pumpWidget(wrap(1280, location: '/instruments/pending'));
|
|
final rail = tester.widget<NavigationRail>(find.byType(NavigationRail));
|
|
expect(
|
|
(rail.destinations[rail.selectedIndex!].label as Text).data,
|
|
'Импорт',
|
|
);
|
|
});
|
|
|
|
testWidgets('a nested route keeps its own section selected', (tester) async {
|
|
await tester.pumpWidget(wrap(1280, location: '/portfolio/instrument/311'));
|
|
final rail = tester.widget<NavigationRail>(find.byType(NavigationRail));
|
|
expect(
|
|
(rail.destinations[rail.selectedIndex!].label as Text).data,
|
|
'Портфель',
|
|
);
|
|
});
|
|
}
|