@@ -207,4 +207,52 @@ describe('BetterInputTag.vue', () => {
207
207
expect ( BetterInputTagISODateOnly . tags . length ) . toEqual ( 1 )
208
208
} )
209
209
} )
210
+
211
+ describe ( 'validate length of tag' , ( ) => {
212
+ const BetterInputTagMinMaxOnly = new ClonedComponent ( {
213
+ propsData : { length : { min : 1 , max : 5 } }
214
+ } ) . $mount ( )
215
+
216
+ it ( 'should only tags with length >= 1 and <= 5 characters' , ( ) => {
217
+ BetterInputTagMinMaxOnly . addNew ( 'foo' )
218
+ BetterInputTagMinMaxOnly . addNew ( '123' )
219
+ BetterInputTagMinMaxOnly . addNew ( 'mati@tucci.me' )
220
+ BetterInputTagMinMaxOnly . addNew ( 'https://tucci.me' )
221
+ BetterInputTagMinMaxOnly . addNew ( '2002-04-03' )
222
+
223
+ expect ( BetterInputTagMinMaxOnly . tags . length ) . toEqual ( 2 )
224
+ } )
225
+ } )
226
+
227
+ describe ( 'validate length of tag' , ( ) => {
228
+ const BetterInputTagMinOnly = new ClonedComponent ( {
229
+ propsData : { length : { min : 1 } }
230
+ } ) . $mount ( )
231
+
232
+ it ( 'should only tags with length >= to 1 characters' , ( ) => {
233
+ BetterInputTagMinOnly . addNew ( 'foo' )
234
+ BetterInputTagMinOnly . addNew ( '123' )
235
+ BetterInputTagMinOnly . addNew ( 'mati@tucci.me' )
236
+ BetterInputTagMinOnly . addNew ( 'https://tucci.me' )
237
+ BetterInputTagMinOnly . addNew ( '2002-04-03' )
238
+
239
+ expect ( BetterInputTagMinOnly . tags . length ) . toEqual ( 5 )
240
+ } )
241
+ } )
242
+
243
+ describe ( 'validate length of tag' , ( ) => {
244
+ const BetterInputTagMaxOnly = new ClonedComponent ( {
245
+ propsData : { length : { max : 7 } }
246
+ } ) . $mount ( )
247
+
248
+ it ( 'should only tags with length <= 5 characters' , ( ) => {
249
+ BetterInputTagMaxOnly . addNew ( 'foo' )
250
+ BetterInputTagMaxOnly . addNew ( '123' )
251
+ BetterInputTagMaxOnly . addNew ( 'mati@tucci.me' )
252
+ BetterInputTagMaxOnly . addNew ( 'https://tucci.me' )
253
+ BetterInputTagMaxOnly . addNew ( '2002-04-03' )
254
+
255
+ expect ( BetterInputTagMaxOnly . tags . length ) . toEqual ( 2 )
256
+ } )
257
+ } )
210
258
} )
0 commit comments