@htlkg/components 0.0.1

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.
Files changed (79) hide show
  1. package/dist/composables/index.js +388 -0
  2. package/dist/composables/index.js.map +1 -0
  3. package/package.json +41 -0
  4. package/src/composables/index.ts +6 -0
  5. package/src/composables/useForm.test.ts +229 -0
  6. package/src/composables/useForm.ts +130 -0
  7. package/src/composables/useFormValidation.test.ts +189 -0
  8. package/src/composables/useFormValidation.ts +83 -0
  9. package/src/composables/useModal.property.test.ts +164 -0
  10. package/src/composables/useModal.ts +43 -0
  11. package/src/composables/useNotifications.test.ts +166 -0
  12. package/src/composables/useNotifications.ts +81 -0
  13. package/src/composables/useTable.property.test.ts +198 -0
  14. package/src/composables/useTable.ts +134 -0
  15. package/src/composables/useTabs.property.test.ts +247 -0
  16. package/src/composables/useTabs.ts +101 -0
  17. package/src/data/Chart.demo.vue +340 -0
  18. package/src/data/Chart.md +525 -0
  19. package/src/data/Chart.vue +133 -0
  20. package/src/data/DataList.md +80 -0
  21. package/src/data/DataList.test.ts +69 -0
  22. package/src/data/DataList.vue +46 -0
  23. package/src/data/SearchableSelect.md +107 -0
  24. package/src/data/SearchableSelect.vue +124 -0
  25. package/src/data/Table.demo.vue +296 -0
  26. package/src/data/Table.md +588 -0
  27. package/src/data/Table.property.test.ts +548 -0
  28. package/src/data/Table.test.ts +562 -0
  29. package/src/data/Table.unit.test.ts +544 -0
  30. package/src/data/Table.vue +321 -0
  31. package/src/data/index.ts +5 -0
  32. package/src/domain/BrandCard.md +81 -0
  33. package/src/domain/BrandCard.vue +63 -0
  34. package/src/domain/BrandSelector.md +84 -0
  35. package/src/domain/BrandSelector.vue +65 -0
  36. package/src/domain/ProductBadge.md +60 -0
  37. package/src/domain/ProductBadge.vue +47 -0
  38. package/src/domain/UserAvatar.md +84 -0
  39. package/src/domain/UserAvatar.vue +60 -0
  40. package/src/domain/domain-components.property.test.ts +449 -0
  41. package/src/domain/index.ts +4 -0
  42. package/src/forms/DateRange.demo.vue +273 -0
  43. package/src/forms/DateRange.md +337 -0
  44. package/src/forms/DateRange.vue +110 -0
  45. package/src/forms/JsonSchemaForm.demo.vue +549 -0
  46. package/src/forms/JsonSchemaForm.md +112 -0
  47. package/src/forms/JsonSchemaForm.property.test.ts +817 -0
  48. package/src/forms/JsonSchemaForm.test.ts +601 -0
  49. package/src/forms/JsonSchemaForm.unit.test.ts +801 -0
  50. package/src/forms/JsonSchemaForm.vue +615 -0
  51. package/src/forms/index.ts +3 -0
  52. package/src/index.ts +17 -0
  53. package/src/navigation/Breadcrumbs.demo.vue +142 -0
  54. package/src/navigation/Breadcrumbs.md +102 -0
  55. package/src/navigation/Breadcrumbs.test.ts +69 -0
  56. package/src/navigation/Breadcrumbs.vue +58 -0
  57. package/src/navigation/Stepper.demo.vue +337 -0
  58. package/src/navigation/Stepper.md +174 -0
  59. package/src/navigation/Stepper.vue +146 -0
  60. package/src/navigation/Tabs.demo.vue +293 -0
  61. package/src/navigation/Tabs.md +163 -0
  62. package/src/navigation/Tabs.test.ts +176 -0
  63. package/src/navigation/Tabs.vue +104 -0
  64. package/src/navigation/index.ts +5 -0
  65. package/src/overlays/Alert.demo.vue +377 -0
  66. package/src/overlays/Alert.md +248 -0
  67. package/src/overlays/Alert.test.ts +166 -0
  68. package/src/overlays/Alert.vue +70 -0
  69. package/src/overlays/Drawer.md +140 -0
  70. package/src/overlays/Drawer.test.ts +92 -0
  71. package/src/overlays/Drawer.vue +76 -0
  72. package/src/overlays/Modal.demo.vue +149 -0
  73. package/src/overlays/Modal.md +385 -0
  74. package/src/overlays/Modal.test.ts +128 -0
  75. package/src/overlays/Modal.vue +86 -0
  76. package/src/overlays/Notification.md +150 -0
  77. package/src/overlays/Notification.test.ts +96 -0
  78. package/src/overlays/Notification.vue +58 -0
  79. package/src/overlays/index.ts +4 -0
@@ -0,0 +1,544 @@
1
+ import { describe, it, expect, beforeEach } from 'vitest';
2
+ import { mount } from '@vue/test-utils';
3
+ import Table from './Table.vue';
4
+
5
+ /**
6
+ * Unit tests for Table component
7
+ * Tests individual functions and methods in isolation
8
+ */
9
+ describe('Table unit tests', () => {
10
+ const mockColumns = [
11
+ { name: 'ID', value: 'id' },
12
+ { name: 'Name', value: 'name' },
13
+ { name: 'Email', value: 'email' }
14
+ ];
15
+
16
+ const mockItems = [
17
+ { id: 1, name: 'John Doe', email: 'john@example.com' },
18
+ { id: 2, name: 'Jane Smith', email: 'jane@example.com' },
19
+ { id: 3, name: 'Bob Johnson', email: 'bob@example.com' }
20
+ ];
21
+
22
+ const globalStubs = {
23
+ uiTable: true,
24
+ uiPagination: true,
25
+ uiDropdown: true,
26
+ uiSmartFilterMultipleV2: true,
27
+ uiNoResults: true
28
+ };
29
+
30
+ describe('tableHeader computed', () => {
31
+ it('should convert columns to uiTable header format', () => {
32
+ const wrapper = mount(Table, {
33
+ props: { items: mockItems, columns: mockColumns },
34
+ global: { stubs: globalStubs }
35
+ });
36
+
37
+ const vm = wrapper.vm as any;
38
+ expect(vm.tableHeader).toHaveLength(3);
39
+ expect(vm.tableHeader[0]).toEqual({ name: 'ID', value: 'id', tooltip: undefined });
40
+ expect(vm.tableHeader[1]).toEqual({ name: 'Name', value: 'name', tooltip: undefined });
41
+ });
42
+
43
+ it('should include tooltips when provided', () => {
44
+ const columnsWithTooltips = [
45
+ { name: 'ID', value: 'id', tooltip: 'Unique identifier' },
46
+ { name: 'Name', value: 'name', tooltip: 'User full name' }
47
+ ];
48
+
49
+ const wrapper = mount(Table, {
50
+ props: { items: mockItems, columns: columnsWithTooltips },
51
+ global: { stubs: globalStubs }
52
+ });
53
+
54
+ const vm = wrapper.vm as any;
55
+ expect(vm.tableHeader[0].tooltip).toBe('Unique identifier');
56
+ expect(vm.tableHeader[1].tooltip).toBe('User full name');
57
+ });
58
+ });
59
+
60
+ describe('tableItems computed', () => {
61
+ it('should convert items to uiTable format', () => {
62
+ const wrapper = mount(Table, {
63
+ props: { items: mockItems, columns: mockColumns },
64
+ global: { stubs: globalStubs }
65
+ });
66
+
67
+ const vm = wrapper.vm as any;
68
+ expect(vm.tableItems).toHaveLength(3);
69
+ expect(vm.tableItems[0].id).toBe(1);
70
+ expect(vm.tableItems[0].row).toHaveLength(3);
71
+ });
72
+
73
+ it('should handle items without id by using index', () => {
74
+ const itemsWithoutId = [
75
+ { name: 'John', email: 'john@test.com' },
76
+ { name: 'Jane', email: 'jane@test.com' }
77
+ ];
78
+
79
+ const wrapper = mount(Table, {
80
+ props: { items: itemsWithoutId, columns: mockColumns },
81
+ global: { stubs: globalStubs }
82
+ });
83
+
84
+ const vm = wrapper.vm as any;
85
+ expect(vm.tableItems[0].id).toBe(0);
86
+ expect(vm.tableItems[1].id).toBe(1);
87
+ });
88
+
89
+ it('should handle disabled items', () => {
90
+ const itemsWithDisabled = [
91
+ { id: 1, name: 'John', email: 'john@test.com', disabled: true },
92
+ { id: 2, name: 'Jane', email: 'jane@test.com', disabled: false }
93
+ ];
94
+
95
+ const wrapper = mount(Table, {
96
+ props: { items: itemsWithDisabled, columns: mockColumns },
97
+ global: { stubs: globalStubs }
98
+ });
99
+
100
+ const vm = wrapper.vm as any;
101
+ expect(vm.tableItems[0].disabled).toBe(true);
102
+ expect(vm.tableItems[1].disabled).toBe(false);
103
+ });
104
+
105
+ it('should handle null and undefined values', () => {
106
+ const itemsWithNulls = [
107
+ { id: 1, name: null, email: undefined }
108
+ ];
109
+
110
+ const wrapper = mount(Table, {
111
+ props: { items: itemsWithNulls, columns: mockColumns },
112
+ global: { stubs: globalStubs }
113
+ });
114
+
115
+ const vm = wrapper.vm as any;
116
+ expect(vm.tableItems[0].row[1]).toBe('');
117
+ expect(vm.tableItems[0].row[2]).toBe('');
118
+ });
119
+ });
120
+
121
+ describe('pageItemsOptions computed', () => {
122
+ it('should return page size options', () => {
123
+ const wrapper = mount(Table, {
124
+ props: { items: mockItems, columns: mockColumns, itemsPerPage: 25 },
125
+ global: { stubs: globalStubs }
126
+ });
127
+
128
+ const vm = wrapper.vm as any;
129
+ expect(vm.pageItemsOptions).toHaveLength(4);
130
+ expect(vm.pageItemsOptions[0].name).toBe('10');
131
+ expect(vm.pageItemsOptions[1].active).toBe(true); // 25 is active
132
+ });
133
+
134
+ it('should mark correct option as active', () => {
135
+ const wrapper = mount(Table, {
136
+ props: { items: mockItems, columns: mockColumns, itemsPerPage: 50 },
137
+ global: { stubs: globalStubs }
138
+ });
139
+
140
+ const vm = wrapper.vm as any;
141
+ const activeOption = vm.pageItemsOptions.find((opt: any) => opt.active);
142
+ expect(activeOption.value).toBe('50');
143
+ });
144
+ });
145
+
146
+ describe('showInitialNoResults computed', () => {
147
+ it('should return true when no items and not loading', () => {
148
+ const wrapper = mount(Table, {
149
+ props: { items: [], columns: mockColumns, loading: false },
150
+ global: { stubs: globalStubs }
151
+ });
152
+
153
+ const vm = wrapper.vm as any;
154
+ expect(vm.showInitialNoResults).toBe(true);
155
+ });
156
+
157
+ it('should return false when loading', () => {
158
+ const wrapper = mount(Table, {
159
+ props: { items: [], columns: mockColumns, loading: true },
160
+ global: { stubs: globalStubs }
161
+ });
162
+
163
+ const vm = wrapper.vm as any;
164
+ expect(vm.showInitialNoResults).toBe(false);
165
+ });
166
+
167
+ it('should return false when items exist', () => {
168
+ const wrapper = mount(Table, {
169
+ props: { items: mockItems, columns: mockColumns, loading: false },
170
+ global: { stubs: globalStubs }
171
+ });
172
+
173
+ const vm = wrapper.vm as any;
174
+ expect(vm.showInitialNoResults).toBe(false);
175
+ });
176
+
177
+ it('should return false when user has searched', () => {
178
+ const wrapper = mount(Table, {
179
+ props: { items: [], columns: mockColumns, loading: false },
180
+ global: { stubs: globalStubs }
181
+ });
182
+
183
+ const vm = wrapper.vm as any;
184
+ vm.hasUserSearched = true;
185
+ expect(vm.showInitialNoResults).toBe(false);
186
+ });
187
+ });
188
+
189
+ describe('showSearchNoResults computed', () => {
190
+ it('should return true when no items after search', () => {
191
+ const wrapper = mount(Table, {
192
+ props: { items: [], columns: mockColumns, loading: false },
193
+ global: { stubs: globalStubs }
194
+ });
195
+
196
+ const vm = wrapper.vm as any;
197
+ vm.hasUserSearched = true;
198
+ expect(vm.showSearchNoResults).toBe(true);
199
+ });
200
+
201
+ it('should return false when not searched', () => {
202
+ const wrapper = mount(Table, {
203
+ props: { items: [], columns: mockColumns, loading: false },
204
+ global: { stubs: globalStubs }
205
+ });
206
+
207
+ const vm = wrapper.vm as any;
208
+ expect(vm.showSearchNoResults).toBe(false);
209
+ });
210
+ });
211
+
212
+ describe('showTable computed', () => {
213
+ it('should return true when loading', () => {
214
+ const wrapper = mount(Table, {
215
+ props: { items: [], columns: mockColumns, loading: true },
216
+ global: { stubs: globalStubs }
217
+ });
218
+
219
+ const vm = wrapper.vm as any;
220
+ expect(vm.showTable).toBe(true);
221
+ });
222
+
223
+ it('should return true when items exist', () => {
224
+ const wrapper = mount(Table, {
225
+ props: { items: mockItems, columns: mockColumns, loading: false },
226
+ global: { stubs: globalStubs }
227
+ });
228
+
229
+ const vm = wrapper.vm as any;
230
+ expect(vm.showTable).toBe(true);
231
+ });
232
+
233
+ it('should return false when no items and not loading', () => {
234
+ const wrapper = mount(Table, {
235
+ props: { items: [], columns: mockColumns, loading: false },
236
+ global: { stubs: globalStubs }
237
+ });
238
+
239
+ const vm = wrapper.vm as any;
240
+ expect(vm.showTable).toBe(false);
241
+ });
242
+ });
243
+
244
+ describe('handleOrderBy()', () => {
245
+ it('should emit order events', () => {
246
+ const wrapper = mount(Table, {
247
+ props: { items: mockItems, columns: mockColumns },
248
+ global: { stubs: globalStubs }
249
+ });
250
+
251
+ const vm = wrapper.vm as any;
252
+ vm.handleOrderBy({ value: 'name', orderDirection: 'desc' });
253
+
254
+ expect(wrapper.emitted('update:orderedBy')).toBeDefined();
255
+ expect(wrapper.emitted('update:orderedBy')?.[0]).toEqual(['name']);
256
+ expect(wrapper.emitted('update:orderDirection')).toBeDefined();
257
+ expect(wrapper.emitted('update:orderDirection')?.[0]).toEqual(['desc']);
258
+ expect(wrapper.emitted('order-changed')).toBeDefined();
259
+ expect(wrapper.emitted('order-changed')?.[0]).toEqual(['name', 'desc']);
260
+ });
261
+
262
+ it('should reset selected items', () => {
263
+ const wrapper = mount(Table, {
264
+ props: { items: mockItems, columns: mockColumns },
265
+ global: { stubs: globalStubs }
266
+ });
267
+
268
+ const vm = wrapper.vm as any;
269
+ vm.resetSelected = false;
270
+ vm.handleOrderBy({ value: 'name', orderDirection: 'asc' });
271
+
272
+ expect(vm.resetSelected).toBe(true);
273
+ });
274
+ });
275
+
276
+ describe('handleChangePage()', () => {
277
+ it('should emit page change events', () => {
278
+ const wrapper = mount(Table, {
279
+ props: { items: mockItems, columns: mockColumns, currentPage: 1 },
280
+ global: { stubs: globalStubs }
281
+ });
282
+
283
+ const vm = wrapper.vm as any;
284
+ vm.handleChangePage(2);
285
+
286
+ expect(wrapper.emitted('update:currentPage')).toBeDefined();
287
+ expect(wrapper.emitted('update:currentPage')?.[0]).toEqual([2]);
288
+ expect(wrapper.emitted('page-changed')).toBeDefined();
289
+ expect(wrapper.emitted('page-changed')?.[0]).toEqual([2]);
290
+ });
291
+
292
+ it('should reset selected items', () => {
293
+ const wrapper = mount(Table, {
294
+ props: { items: mockItems, columns: mockColumns },
295
+ global: { stubs: globalStubs }
296
+ });
297
+
298
+ const vm = wrapper.vm as any;
299
+ vm.resetSelected = false;
300
+ vm.handleChangePage(3);
301
+
302
+ expect(vm.resetSelected).toBe(true);
303
+ });
304
+ });
305
+
306
+ describe('handleChangePageSize()', () => {
307
+ it('should emit page size change events', () => {
308
+ const wrapper = mount(Table, {
309
+ props: { items: mockItems, columns: mockColumns, itemsPerPage: 10 },
310
+ global: { stubs: globalStubs }
311
+ });
312
+
313
+ const vm = wrapper.vm as any;
314
+ vm.handleChangePageSize({ value: '25' });
315
+
316
+ expect(wrapper.emitted('update:itemsPerPage')).toBeDefined();
317
+ expect(wrapper.emitted('update:itemsPerPage')?.[0]).toEqual([25]);
318
+ expect(wrapper.emitted('items-per-page-changed')).toBeDefined();
319
+ expect(wrapper.emitted('items-per-page-changed')?.[0]).toEqual([25]);
320
+ });
321
+
322
+ it('should reset to page 1', () => {
323
+ const wrapper = mount(Table, {
324
+ props: { items: mockItems, columns: mockColumns, currentPage: 3 },
325
+ global: { stubs: globalStubs }
326
+ });
327
+
328
+ const vm = wrapper.vm as any;
329
+ vm.handleChangePageSize({ value: '50' });
330
+
331
+ expect(wrapper.emitted('update:currentPage')).toBeDefined();
332
+ expect(wrapper.emitted('update:currentPage')?.[0]).toEqual([1]);
333
+ });
334
+ });
335
+
336
+ describe('handleColumnsVisibilityChanged()', () => {
337
+ it('should add column to hidden list', () => {
338
+ const wrapper = mount(Table, {
339
+ props: { items: mockItems, columns: mockColumns },
340
+ global: { stubs: globalStubs }
341
+ });
342
+
343
+ const vm = wrapper.vm as any;
344
+ vm.handleColumnsVisibilityChanged({ index: 1, hidden: true });
345
+
346
+ expect(vm.hiddenColumns).toContain(1);
347
+ });
348
+
349
+ it('should remove column from hidden list', () => {
350
+ const wrapper = mount(Table, {
351
+ props: { items: mockItems, columns: mockColumns },
352
+ global: { stubs: globalStubs }
353
+ });
354
+
355
+ const vm = wrapper.vm as any;
356
+ vm.hiddenColumns = [1, 2];
357
+ vm.handleColumnsVisibilityChanged({ index: 1, hidden: false });
358
+
359
+ expect(vm.hiddenColumns).not.toContain(1);
360
+ expect(vm.hiddenColumns).toContain(2);
361
+ });
362
+
363
+ it('should not duplicate hidden columns', () => {
364
+ const wrapper = mount(Table, {
365
+ props: { items: mockItems, columns: mockColumns },
366
+ global: { stubs: globalStubs }
367
+ });
368
+
369
+ const vm = wrapper.vm as any;
370
+ vm.handleColumnsVisibilityChanged({ index: 1, hidden: true });
371
+ vm.handleColumnsVisibilityChanged({ index: 1, hidden: true });
372
+
373
+ expect(vm.hiddenColumns.filter((i: number) => i === 1)).toHaveLength(1);
374
+ });
375
+ });
376
+
377
+ describe('clearSelection()', () => {
378
+ it('should clear selected items', () => {
379
+ const wrapper = mount(Table, {
380
+ props: { items: mockItems, columns: mockColumns },
381
+ global: { stubs: globalStubs }
382
+ });
383
+
384
+ const vm = wrapper.vm as any;
385
+ vm.selectedItemIds = new Set([1, 2, 3]);
386
+ vm.clearSelection();
387
+
388
+ expect(vm.selectedItemIds.size).toBe(0);
389
+ expect(vm.resetSelected).toBe(true);
390
+ });
391
+
392
+ it('should emit update:selected with empty array', () => {
393
+ const wrapper = mount(Table, {
394
+ props: { items: mockItems, columns: mockColumns },
395
+ global: { stubs: globalStubs }
396
+ });
397
+
398
+ const vm = wrapper.vm as any;
399
+ vm.selectedItemIds = new Set([1, 2]);
400
+ vm.clearSelection();
401
+
402
+ expect(wrapper.emitted('update:selected')).toBeDefined();
403
+ const lastEmit = wrapper.emitted('update:selected')?.slice(-1)[0];
404
+ expect(lastEmit?.[0]).toEqual([]);
405
+ });
406
+ });
407
+
408
+ describe('getHiddenColumns()', () => {
409
+ it('should return hidden columns array', () => {
410
+ const wrapper = mount(Table, {
411
+ props: { items: mockItems, columns: mockColumns },
412
+ global: { stubs: globalStubs }
413
+ });
414
+
415
+ const vm = wrapper.vm as any;
416
+ vm.hiddenColumns = [0, 2];
417
+
418
+ expect(vm.getHiddenColumns()).toEqual([0, 2]);
419
+ });
420
+
421
+ it('should return empty array when no hidden columns', () => {
422
+ const wrapper = mount(Table, {
423
+ props: { items: mockItems, columns: mockColumns },
424
+ global: { stubs: globalStubs }
425
+ });
426
+
427
+ const vm = wrapper.vm as any;
428
+ expect(vm.getHiddenColumns()).toEqual([]);
429
+ });
430
+ });
431
+
432
+ describe('getSelectedItems()', () => {
433
+ it('should return array of selected item IDs', () => {
434
+ const wrapper = mount(Table, {
435
+ props: { items: mockItems, columns: mockColumns },
436
+ global: { stubs: globalStubs }
437
+ });
438
+
439
+ const vm = wrapper.vm as any;
440
+ vm.selectedItemIds = new Set([1, 3]);
441
+
442
+ const selected = vm.getSelectedItems();
443
+ expect(selected).toContain(1);
444
+ expect(selected).toContain(3);
445
+ expect(selected).toHaveLength(2);
446
+ });
447
+
448
+ it('should return empty array when nothing selected', () => {
449
+ const wrapper = mount(Table, {
450
+ props: { items: mockItems, columns: mockColumns },
451
+ global: { stubs: globalStubs }
452
+ });
453
+
454
+ const vm = wrapper.vm as any;
455
+ expect(vm.getSelectedItems()).toEqual([]);
456
+ });
457
+ });
458
+
459
+ describe('handleSmartFiltersSent()', () => {
460
+ it('should set hasUserSearched to true', () => {
461
+ const wrapper = mount(Table, {
462
+ props: { items: mockItems, columns: mockColumns },
463
+ global: { stubs: globalStubs }
464
+ });
465
+
466
+ const vm = wrapper.vm as any;
467
+ vm.handleSmartFiltersSent({ name: 'John' });
468
+
469
+ expect(vm.hasUserSearched).toBe(true);
470
+ });
471
+
472
+ it('should emit filter events', () => {
473
+ const wrapper = mount(Table, {
474
+ props: { items: mockItems, columns: mockColumns },
475
+ global: { stubs: globalStubs }
476
+ });
477
+
478
+ const vm = wrapper.vm as any;
479
+ const filters = { name: 'John', email: 'test' };
480
+ vm.handleSmartFiltersSent(filters);
481
+
482
+ expect(wrapper.emitted('smart-filters-sent')).toBeDefined();
483
+ expect(wrapper.emitted('smart-filters-sent')?.[0]).toEqual([filters]);
484
+ expect(wrapper.emitted('multiple-filters-applied')).toBeDefined();
485
+ expect(wrapper.emitted('multiple-filters-applied')?.[0]).toEqual([filters]);
486
+ });
487
+ });
488
+
489
+ describe('handleSelectAllItems()', () => {
490
+ it('should select all items', () => {
491
+ const wrapper = mount(Table, {
492
+ props: { items: mockItems, columns: mockColumns },
493
+ global: { stubs: globalStubs }
494
+ });
495
+
496
+ const vm = wrapper.vm as any;
497
+ vm.handleSelectAllItems();
498
+
499
+ expect(vm.selectedItemIds.size).toBe(3);
500
+ expect(vm.selectedItemIds.has(1)).toBe(true);
501
+ expect(vm.selectedItemIds.has(2)).toBe(true);
502
+ expect(vm.selectedItemIds.has(3)).toBe(true);
503
+ });
504
+
505
+ it('should emit select-all-items event', () => {
506
+ const wrapper = mount(Table, {
507
+ props: { items: mockItems, columns: mockColumns },
508
+ global: { stubs: globalStubs }
509
+ });
510
+
511
+ const vm = wrapper.vm as any;
512
+ vm.handleSelectAllItems();
513
+
514
+ expect(wrapper.emitted('select-all-items')).toBeDefined();
515
+ });
516
+ });
517
+
518
+ describe('handleDeselectAllItems()', () => {
519
+ it('should deselect all items', () => {
520
+ const wrapper = mount(Table, {
521
+ props: { items: mockItems, columns: mockColumns },
522
+ global: { stubs: globalStubs }
523
+ });
524
+
525
+ const vm = wrapper.vm as any;
526
+ vm.selectedItemIds = new Set([1, 2, 3]);
527
+ vm.handleDeselectAllItems();
528
+
529
+ expect(vm.selectedItemIds.size).toBe(0);
530
+ });
531
+
532
+ it('should emit deselect-all-items event', () => {
533
+ const wrapper = mount(Table, {
534
+ props: { items: mockItems, columns: mockColumns },
535
+ global: { stubs: globalStubs }
536
+ });
537
+
538
+ const vm = wrapper.vm as any;
539
+ vm.handleDeselectAllItems();
540
+
541
+ expect(wrapper.emitted('deselect-all-items')).toBeDefined();
542
+ });
543
+ });
544
+ });