@adyen/eslint-plugin-bento 2.6.3 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,424 @@
1
+ import { RuleTester } from 'eslint';
2
+ import vueParser from 'vue-eslint-parser';
3
+ import tsParser from '@typescript-eslint/parser';
4
+ import deprecationComponentsValueProp from './deprecation-components-value-prop';
5
+
6
+ const ruleTester = new RuleTester({
7
+ languageOptions: {
8
+ ecmaVersion: 'latest',
9
+ sourceType: 'module',
10
+ parser: vueParser,
11
+ parserOptions: {
12
+ parser: tsParser,
13
+ },
14
+ },
15
+ });
16
+
17
+ describe('@adyen/bento/deprecation-components-value-prop', () => {
18
+ ruleTester.run('deprecation-components-value-prop', deprecationComponentsValueProp, {
19
+ valid: [
20
+ {
21
+ name: 'Valid usage for bento-date-picker',
22
+ filename: 'test.vue',
23
+ code: `
24
+ <template>
25
+ <bento-date-picker model-value="val" />
26
+ </template>
27
+ `,
28
+ },
29
+ {
30
+ name: 'Valid usage for bento-date-range-picker',
31
+ filename: 'test.vue',
32
+ code: `
33
+ <template>
34
+ <bento-date-range-picker model-value="val" />
35
+ </template>
36
+ `,
37
+ },
38
+ {
39
+ name: 'Valid usage for bento-dropdown',
40
+ filename: 'test.vue',
41
+ code: `
42
+ <template>
43
+ <bento-dropdown model-value="val" />
44
+ </template>
45
+ `,
46
+ },
47
+ {
48
+ name: 'Valid usage for bento-dropdown-avatar',
49
+ filename: 'test.vue',
50
+ code: `
51
+ <template>
52
+ <bento-dropdown-avatar model-value="val" />
53
+ </template>
54
+ `,
55
+ },
56
+ {
57
+ name: 'Valid usage for bento-dropdown-country',
58
+ filename: 'test.vue',
59
+ code: `
60
+ <template>
61
+ <bento-dropdown-country model-value="val" />
62
+ </template>
63
+ `,
64
+ },
65
+ {
66
+ name: 'Valid usage for bento-dropdown-currency',
67
+ filename: 'test.vue',
68
+ code: `
69
+ <template>
70
+ <bento-dropdown-currency model-value="val" />
71
+ </template>
72
+ `,
73
+ },
74
+ {
75
+ name: 'Valid usage for bento-dropdown-payment-method',
76
+ filename: 'test.vue',
77
+ code: `
78
+ <template>
79
+ <bento-dropdown-payment-method model-value="val" />
80
+ </template>
81
+ `,
82
+ },
83
+ {
84
+ name: 'Valid usage for bento-dropdown-tag',
85
+ filename: 'test.vue',
86
+ code: `
87
+ <template>
88
+ <bento-dropdown-tag model-value="val" />
89
+ </template>
90
+ `,
91
+ },
92
+ {
93
+ name: 'Valid usage for bento-file-uploader',
94
+ filename: 'test.vue',
95
+ code: `
96
+ <template>
97
+ <bento-file-uploader model-value="val" />
98
+ </template>
99
+ `,
100
+ },
101
+ {
102
+ name: 'Valid usage for bento-input-field',
103
+ filename: 'test.vue',
104
+ code: `
105
+ <template>
106
+ <bento-input-field model-value="val" />
107
+ </template>
108
+ `,
109
+ },
110
+ {
111
+ name: 'Valid usage for bento-input-field-password',
112
+ filename: 'test.vue',
113
+ code: `
114
+ <template>
115
+ <bento-input-field-password model-value="val" />
116
+ </template>
117
+ `,
118
+ },
119
+ {
120
+ name: 'Valid usage for bento-input-field-phone-number',
121
+ filename: 'test.vue',
122
+ code: `
123
+ <template>
124
+ <bento-input-field-phone-number model-value="val" />
125
+ </template>
126
+ `,
127
+ },
128
+ {
129
+ name: 'Valid usage for bento-checkbox-group',
130
+ filename: 'test.vue',
131
+ code: `
132
+ <template>
133
+ <bento-checkbox-group model-value="val" />
134
+ </template>
135
+ `,
136
+ },
137
+ {
138
+ name: 'Valid usage for bento-radio-group',
139
+ filename: 'test.vue',
140
+ code: `
141
+ <template>
142
+ <bento-radio-group model-value="val" />
143
+ </template>
144
+ `,
145
+ },
146
+ {
147
+ name: 'Valid usage for bento-selection-card-group',
148
+ filename: 'test.vue',
149
+ code: `
150
+ <template>
151
+ <bento-selection-card-group model-value="val" />
152
+ </template>
153
+ `,
154
+ },
155
+ {
156
+ name: 'Valid usage for bento-textarea',
157
+ filename: 'test.vue',
158
+ code: `
159
+ <template>
160
+ <bento-textarea model-value="val" />
161
+ </template>
162
+ `,
163
+ },
164
+ ],
165
+ invalid: [
166
+ // bento-date-picker: Static
167
+ {
168
+ name: 'Invalid: Static prop on bento-date-picker',
169
+ filename: 'test.vue',
170
+ code: `<template><bento-date-picker value="val" /></template>`,
171
+ output: `<template><bento-date-picker model-value="val" /></template>`,
172
+ errors: [{ messageId: 'deprecation' }],
173
+ },
174
+ // bento-date-picker: Shorthand
175
+ {
176
+ name: 'Invalid: Dynamic prop on bento-date-picker',
177
+ filename: 'test.vue',
178
+ code: `<template><bento-date-picker :value="val" /></template>`,
179
+ output: `<template><bento-date-picker :model-value="val" /></template>`,
180
+ errors: [{ messageId: 'deprecation' }],
181
+ },
182
+ // bento-date-range-picker: Static
183
+ {
184
+ name: 'Invalid: Static prop on bento-date-range-picker',
185
+ filename: 'test.vue',
186
+ code: `<template><bento-date-range-picker value="val" /></template>`,
187
+ output: `<template><bento-date-range-picker model-value="val" /></template>`,
188
+ errors: [{ messageId: 'deprecation' }],
189
+ },
190
+ // bento-date-range-picker: Shorthand
191
+ {
192
+ name: 'Invalid: Dynamic prop on bento-date-range-picker',
193
+ filename: 'test.vue',
194
+ code: `<template><bento-date-range-picker :value="val" /></template>`,
195
+ output: `<template><bento-date-range-picker :model-value="val" /></template>`,
196
+ errors: [{ messageId: 'deprecation' }],
197
+ },
198
+ // bento-dropdown: Static
199
+ {
200
+ name: 'Invalid: Static prop on bento-dropdown',
201
+ filename: 'test.vue',
202
+ code: `<template><bento-dropdown value="val" /></template>`,
203
+ output: `<template><bento-dropdown model-value="val" /></template>`,
204
+ errors: [{ messageId: 'deprecation' }],
205
+ },
206
+ // bento-dropdown: Shorthand
207
+ {
208
+ name: 'Invalid: Dynamic prop on bento-dropdown',
209
+ filename: 'test.vue',
210
+ code: `<template><bento-dropdown :value="val" /></template>`,
211
+ output: `<template><bento-dropdown :model-value="val" /></template>`,
212
+ errors: [{ messageId: 'deprecation' }],
213
+ },
214
+ // bento-dropdown-avatar: Static
215
+ {
216
+ name: 'Invalid: Static prop on bento-dropdown-avatar',
217
+ filename: 'test.vue',
218
+ code: `<template><bento-dropdown-avatar value="val" /></template>`,
219
+ output: `<template><bento-dropdown-avatar model-value="val" /></template>`,
220
+ errors: [{ messageId: 'deprecation' }],
221
+ },
222
+ // bento-dropdown-avatar: Shorthand
223
+ {
224
+ name: 'Invalid: Dynamic prop on bento-dropdown-avatar',
225
+ filename: 'test.vue',
226
+ code: `<template><bento-dropdown-avatar :value="val" /></template>`,
227
+ output: `<template><bento-dropdown-avatar :model-value="val" /></template>`,
228
+ errors: [{ messageId: 'deprecation' }],
229
+ },
230
+ // bento-dropdown-country: Static
231
+ {
232
+ name: 'Invalid: Static prop on bento-dropdown-country',
233
+ filename: 'test.vue',
234
+ code: `<template><bento-dropdown-country value="val" /></template>`,
235
+ output: `<template><bento-dropdown-country model-value="val" /></template>`,
236
+ errors: [{ messageId: 'deprecation' }],
237
+ },
238
+ // bento-dropdown-country: Shorthand
239
+ {
240
+ name: 'Invalid: Dynamic prop on bento-dropdown-country',
241
+ filename: 'test.vue',
242
+ code: `<template><bento-dropdown-country :value="val" /></template>`,
243
+ output: `<template><bento-dropdown-country :model-value="val" /></template>`,
244
+ errors: [{ messageId: 'deprecation' }],
245
+ },
246
+ // bento-dropdown-currency: Static
247
+ {
248
+ name: 'Invalid: Static prop on bento-dropdown-currency',
249
+ filename: 'test.vue',
250
+ code: `<template><bento-dropdown-currency value="val" /></template>`,
251
+ output: `<template><bento-dropdown-currency model-value="val" /></template>`,
252
+ errors: [{ messageId: 'deprecation' }],
253
+ },
254
+ // bento-dropdown-currency: Shorthand
255
+ {
256
+ name: 'Invalid: Dynamic prop on bento-dropdown-currency',
257
+ filename: 'test.vue',
258
+ code: `<template><bento-dropdown-currency :value="val" /></template>`,
259
+ output: `<template><bento-dropdown-currency :model-value="val" /></template>`,
260
+ errors: [{ messageId: 'deprecation' }],
261
+ },
262
+ // bento-dropdown-payment-method: Static
263
+ {
264
+ name: 'Invalid: Static prop on bento-dropdown-payment-method',
265
+ filename: 'test.vue',
266
+ code: `<template><bento-dropdown-payment-method value="val" /></template>`,
267
+ output: `<template><bento-dropdown-payment-method model-value="val" /></template>`,
268
+ errors: [{ messageId: 'deprecation' }],
269
+ },
270
+ // bento-dropdown-payment-method: Shorthand
271
+ {
272
+ name: 'Invalid: Dynamic prop on bento-dropdown-payment-method',
273
+ filename: 'test.vue',
274
+ code: `<template><bento-dropdown-payment-method :value="val" /></template>`,
275
+ output: `<template><bento-dropdown-payment-method :model-value="val" /></template>`,
276
+ errors: [{ messageId: 'deprecation' }],
277
+ },
278
+ // bento-dropdown-tag: Static
279
+ {
280
+ name: 'Invalid: Static prop on bento-dropdown-tag',
281
+ filename: 'test.vue',
282
+ code: `<template><bento-dropdown-tag value="val" /></template>`,
283
+ output: `<template><bento-dropdown-tag model-value="val" /></template>`,
284
+ errors: [{ messageId: 'deprecation' }],
285
+ },
286
+ // bento-dropdown-tag: Shorthand
287
+ {
288
+ name: 'Invalid: Dynamic prop on bento-dropdown-tag',
289
+ filename: 'test.vue',
290
+ code: `<template><bento-dropdown-tag :value="val" /></template>`,
291
+ output: `<template><bento-dropdown-tag :model-value="val" /></template>`,
292
+ errors: [{ messageId: 'deprecation' }],
293
+ },
294
+ // bento-file-uploader: Static
295
+ {
296
+ name: 'Invalid: Static prop on bento-file-uploader',
297
+ filename: 'test.vue',
298
+ code: `<template><bento-file-uploader value="val" /></template>`,
299
+ output: `<template><bento-file-uploader model-value="val" /></template>`,
300
+ errors: [{ messageId: 'deprecation' }],
301
+ },
302
+ // bento-file-uploader: Shorthand
303
+ {
304
+ name: 'Invalid: Dynamic prop on bento-file-uploader',
305
+ filename: 'test.vue',
306
+ code: `<template><bento-file-uploader :value="val" /></template>`,
307
+ output: `<template><bento-file-uploader :model-value="val" /></template>`,
308
+ errors: [{ messageId: 'deprecation' }],
309
+ },
310
+ // bento-input-field: Static
311
+ {
312
+ name: 'Invalid: Static prop on bento-input-field',
313
+ filename: 'test.vue',
314
+ code: `<template><bento-input-field value="val" /></template>`,
315
+ output: `<template><bento-input-field model-value="val" /></template>`,
316
+ errors: [{ messageId: 'deprecation' }],
317
+ },
318
+ // bento-input-field: Shorthand
319
+ {
320
+ name: 'Invalid: Dynamic prop on bento-input-field',
321
+ filename: 'test.vue',
322
+ code: `<template><bento-input-field :value="val" /></template>`,
323
+ output: `<template><bento-input-field :model-value="val" /></template>`,
324
+ errors: [{ messageId: 'deprecation' }],
325
+ },
326
+ // bento-input-field-password: Static
327
+ {
328
+ name: 'Invalid: Static prop on bento-input-field-password',
329
+ filename: 'test.vue',
330
+ code: `<template><bento-input-field-password value="val" /></template>`,
331
+ output: `<template><bento-input-field-password model-value="val" /></template>`,
332
+ errors: [{ messageId: 'deprecation' }],
333
+ },
334
+ // bento-input-field-password: Shorthand
335
+ {
336
+ name: 'Invalid: Dynamic prop on bento-input-field-password',
337
+ filename: 'test.vue',
338
+ code: `<template><bento-input-field-password :value="val" /></template>`,
339
+ output: `<template><bento-input-field-password :model-value="val" /></template>`,
340
+ errors: [{ messageId: 'deprecation' }],
341
+ },
342
+ // bento-input-field-phone-number: Static
343
+ {
344
+ name: 'Invalid: Static prop on bento-input-field-phone-number',
345
+ filename: 'test.vue',
346
+ code: `<template><bento-input-field-phone-number value="val" /></template>`,
347
+ output: `<template><bento-input-field-phone-number model-value="val" /></template>`,
348
+ errors: [{ messageId: 'deprecation' }],
349
+ },
350
+ // bento-input-field-phone-number: Shorthand
351
+ {
352
+ name: 'Invalid: Dynamic prop on bento-input-field-phone-number',
353
+ filename: 'test.vue',
354
+ code: `<template><bento-input-field-phone-number :value="val" /></template>`,
355
+ output: `<template><bento-input-field-phone-number :model-value="val" /></template>`,
356
+ errors: [{ messageId: 'deprecation' }],
357
+ },
358
+ // bento-checkbox-group: Static
359
+ {
360
+ name: 'Invalid: Static prop on bento-checkbox-group',
361
+ filename: 'test.vue',
362
+ code: `<template><bento-checkbox-group value="val" /></template>`,
363
+ output: `<template><bento-checkbox-group model-value="val" /></template>`,
364
+ errors: [{ messageId: 'deprecation' }],
365
+ },
366
+ // bento-checkbox-group: Shorthand
367
+ {
368
+ name: 'Invalid: Dynamic prop on bento-checkbox-group',
369
+ filename: 'test.vue',
370
+ code: `<template><bento-checkbox-group :value="val" /></template>`,
371
+ output: `<template><bento-checkbox-group :model-value="val" /></template>`,
372
+ errors: [{ messageId: 'deprecation' }],
373
+ },
374
+ // bento-radio-group: Static
375
+ {
376
+ name: 'Invalid: Static prop on bento-radio-group',
377
+ filename: 'test.vue',
378
+ code: `<template><bento-radio-group value="val" /></template>`,
379
+ output: `<template><bento-radio-group model-value="val" /></template>`,
380
+ errors: [{ messageId: 'deprecation' }],
381
+ },
382
+ // bento-radio-group: Shorthand
383
+ {
384
+ name: 'Invalid: Dynamic prop on bento-radio-group',
385
+ filename: 'test.vue',
386
+ code: `<template><bento-radio-group :value="val" /></template>`,
387
+ output: `<template><bento-radio-group :model-value="val" /></template>`,
388
+ errors: [{ messageId: 'deprecation' }],
389
+ },
390
+ // bento-selection-card-group: Static
391
+ {
392
+ name: 'Invalid: Static prop on bento-selection-card-group',
393
+ filename: 'test.vue',
394
+ code: `<template><bento-selection-card-group value="val" /></template>`,
395
+ output: `<template><bento-selection-card-group model-value="val" /></template>`,
396
+ errors: [{ messageId: 'deprecation' }],
397
+ },
398
+ // bento-selection-card-group: Shorthand
399
+ {
400
+ name: 'Invalid: Dynamic prop on bento-selection-card-group',
401
+ filename: 'test.vue',
402
+ code: `<template><bento-selection-card-group :value="val" /></template>`,
403
+ output: `<template><bento-selection-card-group :model-value="val" /></template>`,
404
+ errors: [{ messageId: 'deprecation' }],
405
+ },
406
+ // bento-textarea: Static
407
+ {
408
+ name: 'Invalid: Static prop on bento-textarea',
409
+ filename: 'test.vue',
410
+ code: `<template><bento-textarea value="val" /></template>`,
411
+ output: `<template><bento-textarea model-value="val" /></template>`,
412
+ errors: [{ messageId: 'deprecation' }],
413
+ },
414
+ // bento-textarea: Shorthand
415
+ {
416
+ name: 'Invalid: Dynamic prop on bento-textarea',
417
+ filename: 'test.vue',
418
+ code: `<template><bento-textarea :value="val" /></template>`,
419
+ output: `<template><bento-textarea :model-value="val" /></template>`,
420
+ errors: [{ messageId: 'deprecation' }],
421
+ },
422
+ ],
423
+ });
424
+ });