2022-10-17 10:15:32 +00:00
|
|
|
import 'package:emojis/emoji.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
2022-11-25 23:49:47 +00:00
|
|
|
import 'package:mockingjay/mockingjay.dart' as mockingjay;
|
2023-05-12 20:02:04 +00:00
|
|
|
import 'package:stackwallet/models/isar/stack_theme.dart';
|
2023-05-09 21:57:40 +00:00
|
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
2022-10-17 10:15:32 +00:00
|
|
|
import 'package:stackwallet/widgets/emoji_select_sheet.dart';
|
|
|
|
|
2023-05-12 20:02:04 +00:00
|
|
|
import '../sample_data/theme_json.dart';
|
|
|
|
|
2022-10-17 10:15:32 +00:00
|
|
|
void main() {
|
|
|
|
testWidgets("Widget displays correctly", (tester) async {
|
|
|
|
const emojiSelectSheet = EmojiSelectSheet();
|
|
|
|
|
|
|
|
await tester.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-17 10:15:32 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
home: const Material(
|
|
|
|
child: emojiSelectSheet,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(find.byWidget(emojiSelectSheet), findsOneWidget);
|
|
|
|
expect(find.text("Select emoji"), findsOneWidget);
|
|
|
|
});
|
|
|
|
|
2024-01-26 22:25:01 +00:00
|
|
|
// testWidgets("Emoji tapped test", (tester) async {
|
|
|
|
// const emojiSelectSheet = EmojiSelectSheet();
|
|
|
|
//
|
|
|
|
// final navigator = mockingjay.MockNavigator();
|
|
|
|
//
|
|
|
|
// await tester.pumpWidget(
|
|
|
|
// ProviderScope(
|
|
|
|
// overrides: [],
|
|
|
|
// child: MaterialApp(
|
|
|
|
// theme: ThemeData(
|
|
|
|
// extensions: [
|
|
|
|
// StackColors.fromStackColorTheme(
|
|
|
|
// StackTheme.fromJson(
|
|
|
|
// json: lightThemeJsonMap,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// home: mockingjay.MockNavigatorProvider(
|
|
|
|
// navigator: navigator,
|
|
|
|
// child: Column(
|
|
|
|
// children: const [
|
|
|
|
// Expanded(child: emojiSelectSheet),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
//
|
|
|
|
// final gestureDetector = find.byType(GestureDetector).at(5);
|
|
|
|
// expect(gestureDetector, findsOneWidget);
|
|
|
|
//
|
|
|
|
// final emoji = Emoji.byChar("😅");
|
|
|
|
//
|
|
|
|
// await tester.tap(gestureDetector);
|
|
|
|
// await tester.pumpAndSettle();
|
|
|
|
// mockingjay.verify(() => navigator.pop(emoji)).called(1);
|
|
|
|
// });
|
2022-10-17 10:15:32 +00:00
|
|
|
}
|