File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -459,7 +459,12 @@ class PairingPage extends HookConsumerWidget {
459459 child: Material (
460460 color: Colors .transparent,
461461 child: TextButton (
462- onPressed: () => ref.read (pairingProvider.notifier).reset (),
462+ onPressed: () {
463+ ref.read (pairingProvider.notifier).reset ();
464+ if (identityRecoveryOnly) {
465+ Navigator .of (context).pop ();
466+ }
467+ },
463468 child: const Text ('Cancel' ),
464469 ),
465470 ),
Original file line number Diff line number Diff line change @@ -505,6 +505,38 @@ void main() {
505505 expect (find.text ('Use pairing code' ), findsNothing);
506506 });
507507
508+ testWidgets ('connection Cancel closes the identity recovery route' , (
509+ tester,
510+ ) async {
511+ final navigator = GlobalKey <NavigatorState >();
512+ await tester.pumpWidget (
513+ ProviderScope (
514+ overrides: [
515+ pairingProvider.overrideWith (() => _ConnectingPairingNotifier ()),
516+ ],
517+ child: MaterialApp (
518+ navigatorKey: navigator,
519+ theme: AppTheme .light (),
520+ home: const Scaffold (body: Text ('Settings' )),
521+ ),
522+ ),
523+ );
524+ navigator.currentState! .push (
525+ MaterialPageRoute <void >(
526+ builder: (_) => const PairingPage (
527+ addingCommunity: true ,
528+ identityRecoveryOnly: true ,
529+ ),
530+ ),
531+ );
532+ await tester.pump ();
533+ await tester.pump (const Duration (milliseconds: 400 ));
534+ await tester.tap (find.widgetWithText (TextButton , 'Cancel' ));
535+ await tester.pumpAndSettle ();
536+ expect (find.byType (PairingPage ), findsNothing);
537+ expect (find.text ('Settings' ), findsOneWidget);
538+ });
539+
508540 testWidgets ('recovery entry rejects ordinary nostrpair codes' , (
509541 tester,
510542 ) async {
You can’t perform that action at this time.
0 commit comments