widget_test.dart 909 B

1234567891011121314151617181920212223242526272829303132
  1. import 'package:cardash_launcher/core/theme/app_theme.dart';
  2. import 'package:cardash_launcher/features/home/widgets/shortcut_tile.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_test/flutter_test.dart';
  5. void main() {
  6. testWidgets('an unassigned shortcut invites the user to pick an app', (
  7. tester,
  8. ) async {
  9. await tester.pumpWidget(
  10. MaterialApp(
  11. theme: AppTheme.light(),
  12. home: Scaffold(
  13. body: Center(
  14. child: ShortcutTile(
  15. title: 'Navigation',
  16. subtitle: 'Select app',
  17. iconAsset: 'assets/icons/navigation.svg',
  18. size: 150,
  19. assigned: false,
  20. onTap: () {},
  21. ),
  22. ),
  23. ),
  24. ),
  25. );
  26. await tester.pump();
  27. expect(find.text('Navigation'), findsOneWidget);
  28. expect(find.text('Select app'), findsOneWidget);
  29. });
  30. }