File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ Future<void> testValidations(
33
33
}
34
34
35
35
void main () {
36
+ const customErrorMessage = 'Custom error message' ;
37
+
36
38
testWidgets (
37
39
'FormBuilderValidators.required' ,
38
40
(WidgetTester tester) => testValidations (tester, (context) {
@@ -1220,6 +1222,15 @@ void main() {
1220
1222
// Fail
1221
1223
expect (validator ('123' ), isNotNull);
1222
1224
expect (validator ('' ), isNotNull);
1225
+
1226
+ final validatorWithError = FormBuilderValidators .defaultValue <String >(
1227
+ 'default' ,
1228
+ FormBuilderValidators .alphabetical (errorText: customErrorMessage),
1229
+ );
1230
+ // Pass
1231
+ expect (validatorWithError ('123' ), customErrorMessage);
1232
+ // Fail
1233
+ expect (validatorWithError ('123' ), isNotNull);
1223
1234
}),
1224
1235
);
1225
1236
}
You can’t perform that action at this time.
0 commit comments