mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 19:39:22 +00:00
fix stack dialog test
This commit is contained in:
parent
6394295167
commit
9cd452fd74
1 changed files with 18 additions and 17 deletions
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:mockingjay/mockingjay.dart' as mockingjay;
|
|
||||||
import 'package:stackwallet/models/isar/stack_theme.dart';
|
import 'package:stackwallet/models/isar/stack_theme.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
|
@ -63,11 +62,13 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets("Test StackDialogOk", (widgetTester) async {
|
testWidgets("Test StackDialogOk", (widgetTester) async {
|
||||||
final navigator = mockingjay.MockNavigator();
|
final navigatorKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
await widgetTester.pumpWidget(ProviderScope(
|
await widgetTester.pumpWidget(
|
||||||
|
ProviderScope(
|
||||||
overrides: [],
|
overrides: [],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
navigatorKey: navigatorKey,
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
extensions: [
|
extensions: [
|
||||||
StackColors.fromStackColorTheme(
|
StackColors.fromStackColorTheme(
|
||||||
|
@ -77,23 +78,23 @@ void main() {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
home: mockingjay.MockNavigatorProvider(
|
home: StackOkDialog(
|
||||||
navigator: navigator,
|
|
||||||
child: const StackOkDialog(
|
|
||||||
title: "Some random title",
|
title: "Some random title",
|
||||||
message: "Some message",
|
message: "Some message",
|
||||||
leftButton: TextButton(onPressed: null, child: Text("I am left")),
|
leftButton: TextButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: const Text("I am left"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final button = find.text('I am left');
|
||||||
|
await widgetTester.tap(button);
|
||||||
await widgetTester.pumpAndSettle();
|
await widgetTester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.byType(StackOkDialog), findsOneWidget);
|
final navigatorState = navigatorKey.currentState;
|
||||||
expect(find.text("Some random title"), findsOneWidget);
|
expect(navigatorState?.overlay, isNotNull);
|
||||||
expect(find.text("Some message"), findsOneWidget);
|
|
||||||
expect(find.byType(TextButton), findsNWidgets(2));
|
|
||||||
|
|
||||||
await widgetTester.tap(find.text("I am left"));
|
|
||||||
await widgetTester.pumpAndSettle();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue