-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui_auth): fix reauthenticate dialog overflow (#9734)
- Loading branch information
Showing
3 changed files
with
112 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
packages/firebase_ui_auth/example/test_driver/layout_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'package:drive/drive.dart'; | ||
import 'package:firebase_auth/firebase_auth.dart' | ||
hide EmailAuthProvider, PhoneAuthProvider; | ||
import 'package:firebase_ui_auth/firebase_ui_auth.dart'; | ||
import 'package:firebase_ui_oauth_apple/firebase_ui_oauth_apple.dart'; | ||
import 'package:firebase_ui_oauth_google/firebase_ui_oauth_google.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:mockito/mockito.dart'; | ||
|
||
void main() { | ||
group( | ||
'Reauthenticate dialog', | ||
() { | ||
testWidgets("doesn't have an overflow when keyboard is visible", | ||
(tester) async { | ||
await tester.pumpWidget( | ||
MaterialApp( | ||
home: Scaffold( | ||
body: ReauthenticateDialog( | ||
providers: [ | ||
EmailAuthProvider(), | ||
PhoneAuthProvider(), | ||
GoogleProvider(clientId: 'mock'), | ||
AppleProvider(), | ||
], | ||
auth: MockAuth(), | ||
), | ||
), | ||
), | ||
); | ||
|
||
// Triggers keyboard to appear | ||
await tester.tap(find.byType(TextFormField).first); | ||
|
||
// Waits for keyboard to appear | ||
await tester.pumpAndSettle(); | ||
|
||
// No need for an expect. | ||
// Test will fail if there is an overflow. | ||
// This is a built-in flutter functionality | ||
}); | ||
}, | ||
); | ||
} | ||
|
||
class MockUser extends Mock implements User { | ||
@override | ||
List<UserInfo> get providerData => [ | ||
UserInfo({'providerId': 'password'}), | ||
UserInfo({'providerId': 'google.com'}), | ||
UserInfo({'providerId': 'apple.com'}), | ||
UserInfo({'providerId': 'phone'}) | ||
]; | ||
} | ||
|
||
class MockAuth extends Mock implements FirebaseAuth { | ||
@override | ||
User? get currentUser => MockUser(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters