@@ -15,8 +15,10 @@ void main() {
15
15
],
16
16
home: Builder (
17
17
builder: (BuildContext context) {
18
- expect (FormBuilderValidators .required (context)('something long' ), isNull);
19
- expect (FormBuilderValidators .required (context)(DateTime .now ()), isNull);
18
+ expect (FormBuilderValidators .required (context)('something long' ),
19
+ isNull);
20
+ expect (FormBuilderValidators .required (context)(DateTime .now ()),
21
+ isNull);
20
22
expect (FormBuilderValidators .required (context)('' ), isNotNull);
21
23
expect (FormBuilderValidators .required (context)([]), isNotNull);
22
24
@@ -38,8 +40,10 @@ void main() {
38
40
],
39
41
home: Builder (
40
42
builder: (BuildContext context) {
41
- expect (FormBuilderValidators .maxLength (context, 5 )('something long' ), equals ('Value must have a length less than or equal to 5' ));
42
- expect (FormBuilderValidators .maxLength (context, 5 )('two' ), equals (null ));
43
+ expect (
44
+ FormBuilderValidators .maxLength (context, 5 )('something long' ),
45
+ equals ('Value must have a length less than or equal to 5' ));
46
+ expect (FormBuilderValidators .maxLength (context, 5 )('two' ), isNull);
43
47
// expect(FormBuilderValidators.maxLength(context, 5)(5), equals(null));
44
48
45
49
// The builder function must return a widget.
@@ -60,13 +64,18 @@ void main() {
60
64
],
61
65
home: Builder (
62
66
builder: (BuildContext context) {
63
- expect (FormBuilderValidators .email (context)('john@flutter' ), isNotNull);
64
- expect (
FormBuilderValidators .
email (context)(
'[email protected] ' ), isNull);
65
- expect (
FormBuilderValidators .
email (context)(
' [email protected] ' ), isNull);
66
- expect (
FormBuilderValidators .
email (context)(
'[email protected] ' ), isNull);
67
- expect (
FormBuilderValidators .
email (context)(
' [email protected] ' ), isNull);
67
+ expect (FormBuilderValidators .email (context)('john@flutter' ),
68
+ isNotNull);
69
+ expect (
FormBuilderValidators .
email (context)(
'[email protected] ' ),
70
+ isNull);
71
+ expect (
FormBuilderValidators .
email (context)(
' [email protected] ' ),
72
+ isNull);
73
+ expect (
FormBuilderValidators .
email (context)(
'[email protected] ' ),
74
+ isNull);
75
+ expect (
FormBuilderValidators .
email (context)(
' [email protected] ' ),
76
+ isNull);
68
77
expect (FormBuilderValidators .email (context)(null ), isNull);
69
- expect (FormBuilderValidators .email (context)('' ),isNull);
78
+ expect (FormBuilderValidators .email (context)('' ), isNull);
70
79
71
80
// The builder function must return a widget.
72
81
return Placeholder ();
@@ -87,8 +96,9 @@ void main() {
87
96
home: Builder (
88
97
builder: (BuildContext context) {
89
98
expect (FormBuilderValidators .max (context, 20 )('70' ), isNotNull);
90
- expect (FormBuilderValidators .max (context,30 )(70 ), isNotNull);
91
- expect (FormBuilderValidators .max (context,30 )(20 ), isNull);
99
+ expect (FormBuilderValidators .max (context, 30 )(70 ), isNotNull);
100
+ expect (FormBuilderValidators .max (context, 30 )(20 ), isNull);
101
+ expect (FormBuilderValidators .max (context, 30 )('' ), isNull);
92
102
93
103
// The builder function must return a widget.
94
104
return Placeholder ();
@@ -108,9 +118,10 @@ void main() {
108
118
],
109
119
home: Builder (
110
120
builder: (BuildContext context) {
111
- expect (FormBuilderValidators .min (context,30 )('10' ), isNotNull);
112
- expect (FormBuilderValidators .min (context,30 )(10 ), isNotNull);
113
- expect (FormBuilderValidators .min (context,30 )(70 ), isNull);
121
+ expect (FormBuilderValidators .min (context, 30 )('10' ), isNotNull);
122
+ expect (FormBuilderValidators .min (context, 30 )(10 ), isNotNull);
123
+ expect (FormBuilderValidators .min (context, 30 )(70 ), isNull);
124
+ expect (FormBuilderValidators .min (context, 30 )('' ), isNull);
114
125
115
126
// The builder function must return a widget.
116
127
return Placeholder ();
@@ -131,12 +142,20 @@ void main() {
131
142
home: Builder (
132
143
builder: (BuildContext context) {
133
144
expect (FormBuilderValidators .url (context)(null ), isNull);
134
- expect (FormBuilderValidators .url (context)('https://www.google.com' ), isNull);
135
- expect (FormBuilderValidators .url (context)('www.google.com' ), isNull);
145
+ expect (FormBuilderValidators .url (context)('https://www.google.com' ),
146
+ isNull);
147
+ expect (
148
+ FormBuilderValidators .url (context)('www.google.com' ), isNull);
136
149
expect (FormBuilderValidators .url (context)('google.com' ), isNull);
137
- expect (FormBuilderValidators .url (context)('http://google.com' ), isNull);
150
+ expect (FormBuilderValidators .url (context)('http://google.com' ),
151
+ isNull);
138
152
expect (FormBuilderValidators .url (context)('.com' ), isNotNull);
139
- expect (FormBuilderValidators .url (context, protocols: ['https' , 'http' ], errorText: 'Only HTTP and HTTPS allowed' )('ftp://www.google.com' ), isNotNull);
153
+ expect (
154
+ FormBuilderValidators .url (context,
155
+ protocols: ['https' , 'http' ],
156
+ errorText:
157
+ 'Only HTTP and HTTPS allowed' )('ftp://www.google.com' ),
158
+ isNotNull);
140
159
141
160
// The builder function must return a widget.
142
161
return Placeholder ();
@@ -159,6 +178,7 @@ void main() {
159
178
expect (FormBuilderValidators .IP (context)(null ), isNull);
160
179
expect (FormBuilderValidators .IP (context)('192.168.0.1' ), isNull);
161
180
expect (FormBuilderValidators .IP (context)('256.168.0.1' ), isNotNull);
181
+ expect (FormBuilderValidators .IP (context)('' ), isNull);
162
182
163
183
// The builder function must return a widget.
164
184
return Placeholder ();
0 commit comments