@@ -60,6 +60,38 @@ void main() {
6060
6161 expect (formFieldKey.currentState? .value, '$validCodePhone $validPhone ' );
6262 });
63+ testWidgets ('should found the correct country' , (tester) async {
64+ final formFieldKey = GlobalKey <FormBuilderFieldState >();
65+ const fieldName = 'phone' ;
66+ const validPhone = '8599999999' ;
67+ const validCodePhone = '+55' ;
68+ final testWidget = FormBuilderPhoneField (
69+ name: fieldName,
70+ key: formFieldKey,
71+ );
72+ await tester.pumpWidget (buildTestableFieldWidget (testWidget));
73+
74+ formFieldKey.currentState? .didChange ('$validCodePhone $validPhone ' );
75+ await tester.pumpAndSettle ();
76+
77+ expect (formFieldKey.currentState? .value, '$validCodePhone $validPhone ' );
78+ });
79+ testWidgets ('should not found the correct country' , (tester) async {
80+ final formFieldKey = GlobalKey <FormBuilderFieldState >();
81+ const fieldName = 'phone' ;
82+ const validPhone = '8599999999' ;
83+ const invalidCodePhone = '+999' ;
84+ final testWidget = FormBuilderPhoneField (
85+ name: fieldName,
86+ key: formFieldKey,
87+ );
88+ await tester.pumpWidget (buildTestableFieldWidget (testWidget));
89+
90+ formFieldKey.currentState? .didChange ('$invalidCodePhone $validPhone ' );
91+ await tester.pumpAndSettle ();
92+
93+ expect (formFieldKey.currentState? .value, '$invalidCodePhone $validPhone ' );
94+ });
6395 });
6496 group ('by FormKey -' , () {
6597 testWidgets ('should reset value when call reset' , (tester) async {
0 commit comments