File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -112,4 +112,20 @@ describe('FieldPassword', () => {
112
112
expect ( wrapper . vm . errors . length ) . toBe ( 1 )
113
113
} )
114
114
115
+ it ( 'Should display error, with minimum length 3' , async ( ) => {
116
+ const schema = { ...form . schema }
117
+ const validator = ( value ) => value . length >= 3
118
+ schema . fields [ 0 ] . validator = [ validator ]
119
+
120
+ const formWrapper = mountFormGenerator ( schema , form . model )
121
+ const wrapper = formWrapper . findComponent ( FieldPassword )
122
+ const input = wrapper . find ( 'input[type=password]' )
123
+ await input . setValue ( 'aa' )
124
+ await input . trigger ( 'blur' )
125
+ expect ( wrapper . vm . errors . length ) . toBe ( 1 )
126
+ const errorContainer = formWrapper . find ( '.errors' )
127
+ expect ( errorContainer . exists ( ) ) . toBeTruthy ( )
128
+ expect ( errorContainer . find ( '.error' ) . element . innerHTML ) . toBe ( 'Field is invalid' )
129
+ } )
130
+
115
131
} )
You can’t perform that action at this time.
0 commit comments