d94bd5fdf7
Prima era esercitato solo dall'integration test su emulatore: - converter_page: ricerca, stati vuoti, selezione, calcolo, swap, reset - shopping_list_page: aggiunta, contatore, sezione completati, dialog svuota - meal_planner_page: 7 card, giorno espanso, genera lista, dialog svuota, stato del pulsante Condividi - qr_share_sheet: QR per piano valido, errore oltre il limite, chiusura - app (BitePlanApp): navigazione fra i tab, bottom sheet informazioni - guide_page e info_bottom_sheet: contenuti e navigazione alla guida - empty_state: icona, titolo, sottotitolo opzionale - coverage_helper: importa tutta lib/ così lcov include anche i file non toccati da alcun test Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
35 lines
1.1 KiB
Dart
35 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:biteplan/shared/widgets/empty_state.dart';
|
|
import '../../helpers/pump_app.dart';
|
|
|
|
void main() {
|
|
group('EmptyState', () {
|
|
testWidgets('mostra icona e titolo', (tester) async {
|
|
await tester.pumpApp(const Scaffold(
|
|
body: EmptyState(icon: Icons.search, title: 'Nessun elemento'),
|
|
));
|
|
expect(find.byIcon(Icons.search), findsOneWidget);
|
|
expect(find.text('Nessun elemento'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('mostra il sottotitolo quando presente', (tester) async {
|
|
await tester.pumpApp(const Scaffold(
|
|
body: EmptyState(
|
|
icon: Icons.search,
|
|
title: 'Titolo',
|
|
subtitle: 'Sottotitolo di prova',
|
|
),
|
|
));
|
|
expect(find.text('Sottotitolo di prova'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('nessun sottotitolo quando assente', (tester) async {
|
|
await tester.pumpApp(const Scaffold(
|
|
body: EmptyState(icon: Icons.search, title: 'Titolo'),
|
|
));
|
|
expect(find.byType(Text), findsOneWidget);
|
|
});
|
|
});
|
|
}
|