// Makes sure the Form widget won't autovalidate the form fields
// Makes sure the Form widget won't auto-validate the form fields
// after rebuilds if there is not user interaction.
awaittester.pumpWidget(builder());
awaittester.pumpWidget(builder());
...
...
@@ -733,38 +733,6 @@ void main() {
expect(find.text(errorText('')!),findsOneWidget);
});
testWidgets('autovalidate parameter is still used if true',(WidgetTestertester)async{
lateFormFieldState<String>formFieldState;
String?errorText(String?value)=>'$value/error';
Widgetbuilder(){
returnMaterialApp(
home:MediaQuery(
data:constMediaQueryData(),
child:Directionality(
textDirection:TextDirection.ltr,
child:Center(
child:Material(
child:FormField<String>(
initialValue:'foo',
autovalidate:true,
builder:(FormFieldState<String>state){
formFieldState=state;
returnContainer();
},
validator:errorText,
),
),
),
),
),
);
}
awaittester.pumpWidget(builder());
expect(formFieldState.hasError,isTrue);
});
testWidgets('Form.reset() resets form fields, and auto validation will only happen on the next user interaction if autovalidateMode is onUserInteraction',(WidgetTestertester)async{