diff --git a/packages/firebase_ui_auth/lib/src/navigation/authentication.dart b/packages/firebase_ui_auth/lib/src/navigation/authentication.dart index 8303b7b9..70f723b5 100644 --- a/packages/firebase_ui_auth/lib/src/navigation/authentication.dart +++ b/packages/firebase_ui_auth/lib/src/navigation/authentication.dart @@ -65,7 +65,7 @@ Future showDifferentMethodSignInDialog({ await showGeneralDialog( context: context, barrierDismissible: true, - barrierLabel: l.cancelLabel, + barrierLabel: l.cancelButtonLabel, pageBuilder: (context, _, __) => DifferentMethodSignInDialog( availableProviders: availableProviders, providers: providers, diff --git a/packages/firebase_ui_auth/lib/src/widgets/reauthenticate_dialog.dart b/packages/firebase_ui_auth/lib/src/widgets/reauthenticate_dialog.dart index c6871c85..7280b238 100644 --- a/packages/firebase_ui_auth/lib/src/widgets/reauthenticate_dialog.dart +++ b/packages/firebase_ui_auth/lib/src/widgets/reauthenticate_dialog.dart @@ -87,7 +87,7 @@ class ReauthenticateDialog extends StatelessWidget { top: verticalPadding.top, ), child: UniversalButton( - text: l.cancelLabel, + text: l.cancelButtonLabel, variant: ButtonVariant.text, onPressed: () => Navigator.of(context).pop(), ), diff --git a/packages/firebase_ui_auth/test/test_utils.dart b/packages/firebase_ui_auth/test/test_utils.dart index 283c9d7e..15aad549 100644 --- a/packages/firebase_ui_auth/test/test_utils.dart +++ b/packages/firebase_ui_auth/test/test_utils.dart @@ -25,7 +25,19 @@ class TestMaterialApp extends StatelessWidget { class MockCredential extends Mock implements UserCredential {} +class MockUserInfo extends Mock implements UserInfo { + @override + final String providerId; + + MockUserInfo({required this.providerId}); +} + class MockUser extends Mock implements User { + @override + final List providerData; + + MockUser({this.providerData = const []}); + @override Future linkWithCredential(AuthCredential? credential) async { return super.noSuchMethod( diff --git a/packages/firebase_ui_auth/test/widgets/dialogs_test.dart b/packages/firebase_ui_auth/test/widgets/dialogs_test.dart new file mode 100644 index 00000000..5186d71c --- /dev/null +++ b/packages/firebase_ui_auth/test/widgets/dialogs_test.dart @@ -0,0 +1,53 @@ +// Copyright 2023, the Chromium project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:firebase_ui_auth/firebase_ui_auth.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import '../test_utils.dart'; + +void main() { + final auth = MockAuth(); + auth.user = MockUser(providerData: [ + MockUserInfo(providerId: 'email'), + MockUserInfo(providerId: 'phone'), + ]); + + group('$ReauthenticateDialog', () { + testWidgets('has capitalized Cancel label', (tester) async { + await tester.pumpWidget( + TestMaterialApp( + child: ReauthenticateDialog( + auth: auth, + providers: [ + EmailAuthProvider(), + PhoneAuthProvider(), + ], + ), + ), + ); + + expect(find.text('Cancel'), findsOneWidget); + }); + }); + + group('$DifferentMethodSignInDialog', () { + testWidgets('has capitalized Cancel label', (tester) async { + await tester.pumpWidget( + TestMaterialApp( + child: DifferentMethodSignInDialog( + auth: auth, + availableProviders: const ['email', 'phone'], + providers: [ + EmailAuthProvider(), + PhoneAuthProvider(), + ], + ), + ), + ); + + expect(find.text('Cancel'), findsOneWidget); + }); + }); +} diff --git a/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart b/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart index a04f76fb..e0ea4fab 100644 --- a/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart +++ b/packages/firebase_ui_oauth/lib/src/oauth_provider_button_base.dart @@ -345,7 +345,7 @@ class _OAuthProviderButtonBaseState extends State @override void onError(Object error) { - setState(() { + safeSetState(() { isLoading = false; }); diff --git a/tests/integration_test/firebase_ui_auth/layout_test.dart b/tests/integration_test/firebase_ui_auth/layout_test.dart index a8edaba6..8532d852 100644 --- a/tests/integration_test/firebase_ui_auth/layout_test.dart +++ b/tests/integration_test/firebase_ui_auth/layout_test.dart @@ -42,7 +42,7 @@ void main() { // Test will fail if there is an overflow. // This is a built-in flutter functionality - await tester.tap(find.text('cancel')); + await tester.tap(find.text('Cancel')); await tester.pumpAndSettle(); }, );