mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-03 09:19:22 +00:00
fix desktop dialog close button test
This commit is contained in:
parent
7ea54d9095
commit
6394295167
1 changed files with 10 additions and 12 deletions
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.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/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -11,14 +10,13 @@ import '../../sample_data/theme_json.dart';
|
|||
|
||||
void main() {
|
||||
testWidgets("test DesktopDialog button pressed", (widgetTester) async {
|
||||
final key = UniqueKey();
|
||||
|
||||
final navigator = mockingjay.MockNavigator();
|
||||
final navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
await widgetTester.pumpWidget(
|
||||
ProviderScope(
|
||||
overrides: [],
|
||||
child: MaterialApp(
|
||||
navigatorKey: navigatorKey,
|
||||
theme: ThemeData(
|
||||
extensions: [
|
||||
StackColors.fromStackColorTheme(
|
||||
|
@ -28,19 +26,19 @@ void main() {
|
|||
),
|
||||
],
|
||||
),
|
||||
home: mockingjay.MockNavigatorProvider(
|
||||
navigator: navigator,
|
||||
child: DesktopDialogCloseButton(
|
||||
key: key,
|
||||
onPressedOverride: null,
|
||||
)),
|
||||
home: DesktopDialogCloseButton(
|
||||
key: UniqueKey(),
|
||||
onPressedOverride: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await widgetTester.tap(find.byType(AppBarIconButton));
|
||||
final button = find.byType(AppBarIconButton);
|
||||
await widgetTester.tap(button);
|
||||
await widgetTester.pumpAndSettle();
|
||||
|
||||
mockingjay.verify(() => navigator.pop()).called(1);
|
||||
final navigatorState = navigatorKey.currentState;
|
||||
expect(navigatorState?.overlay, isNotNull);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue