stack_wallet/test/widget_tests/animated_text_test.dart

45 lines
1.2 KiB
Dart
Raw Normal View History

2022-10-10 10:30:35 +00:00
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
2023-05-12 20:02:04 +00:00
import 'package:stackwallet/models/isar/stack_theme.dart';
import 'package:stackwallet/themes/stack_colors.dart';
2022-10-10 10:30:35 +00:00
import 'package:stackwallet/widgets/animated_text.dart';
2023-05-12 20:02:04 +00:00
import '../sample_data/theme_json.dart';
2022-10-10 10:30:35 +00:00
void main() {
testWidgets("Widget displays first word in strings list",
(widgetTester) async {
const animatedText = AnimatedText(
stringsToLoopThrough: [
"Calculating",
"Calculating.",
"Calculating..",
"Calculating...",
],
style: TextStyle(
color: null,
fontWeight: FontWeight.w500,
fontSize: 14,
));
await widgetTester.pumpWidget(
MaterialApp(
theme: ThemeData(
extensions: [
2023-05-08 17:59:00 +00:00
StackColors.fromStackColorTheme(
StackTheme.fromJson(
2023-05-12 20:02:04 +00:00
json: lightThemeJsonMap,
2023-05-08 17:59:00 +00:00
),
),
2022-10-10 10:30:35 +00:00
],
),
home: const Material(
child: animatedText,
),
),
);
expect(find.text("Calculating"), findsOneWidget);
2022-10-13 18:40:19 +00:00
expect(find.byWidget(animatedText), findsOneWidget);
2022-10-10 10:30:35 +00:00
});
}