-
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.
Browse files
Browse the repository at this point in the history
…#8545) Co-authored-by: andrastimar <[email protected]>
- Loading branch information
1 parent
9991b7a
commit 518cdce
Showing
4 changed files
with
71 additions
and
1 deletion.
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
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
53 changes: 53 additions & 0 deletions
53
packages/flutterfire_ui/test/auth/widgets/email_form_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,53 @@ | ||
import 'package:firebase_auth_mocks/firebase_auth_mocks.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:flutterfire_ui/auth.dart'; | ||
import 'package:flutterfire_ui/src/auth/widgets/internal/loading_button.dart'; | ||
import 'package:flutterfire_ui/src/auth/widgets/internal/universal_button.dart'; | ||
|
||
import '../../test_utils.dart'; | ||
|
||
void main() { | ||
group('EmailForm', () { | ||
late Widget widget; | ||
|
||
setUp(() { | ||
widget = TestMaterialApp( | ||
child: EmailForm( | ||
auth: MockFirebaseAuth(), | ||
action: AuthAction.signIn, | ||
), | ||
); | ||
}); | ||
|
||
testWidgets('Has a Sign in button of outlined variant', (tester) async { | ||
await tester.pumpWidget(widget); | ||
expect( | ||
find.descendant( | ||
of: find.byWidgetPredicate( | ||
(widget) => | ||
widget is LoadingButton && | ||
widget.variant == ButtonVariant.outlined, | ||
), | ||
matching: find.text('Sign in'), | ||
), | ||
findsOneWidget, | ||
); | ||
}); | ||
|
||
testWidgets('Has a Forgot password button of text variant', (tester) async { | ||
await tester.pumpWidget(widget); | ||
expect( | ||
find.descendant( | ||
of: find.byWidgetPredicate( | ||
(widget) => | ||
widget is UniversalButton && | ||
widget.variant == ButtonVariant.text, | ||
), | ||
matching: find.text('Forgot password?'), | ||
), | ||
findsOneWidget, | ||
); | ||
}); | ||
}); | ||
} |
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,16 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class TestMaterialApp extends StatelessWidget { | ||
final Widget child; | ||
|
||
const TestMaterialApp({Key? key, required this.child}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
body: child, | ||
), | ||
); | ||
} | ||
} |