@webitel/ui-sdk 26.8.75 → 26.8.76

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 (156) hide show
  1. package/dist/{clients-BmeOR90W.js → clients-oFIeYM2J.js} +66 -79
  2. package/dist/{components-C-ri6OSQ.js → components-BG2hOYak.js} +11 -11
  3. package/dist/{enums-BvonmHq2.js → enums-B_9ZBu01.js} +2 -2
  4. package/dist/ui-sdk.css +1 -1
  5. package/dist/ui-sdk.js +3 -3
  6. package/dist/ui-sdk.umd.cjs +574 -574
  7. package/dist/{useValidation-0JwQGpLM.js → useValidation-CEed9cxY.js} +1 -1
  8. package/dist/{utils-CzBdLnFt.js → utils-BZHq8qMH.js} +1 -1
  9. package/dist/wt-action-bar-D74sgDCk.js +94 -0
  10. package/dist/{wt-button-D-nFhi1f.js → wt-button-CVjzcwNg.js} +2 -2
  11. package/dist/{wt-chat-emoji-CLhgb02d.js → wt-chat-emoji-CP1IO0Z_.js} +4 -4
  12. package/dist/{wt-datepicker-DCa23hYx.js → wt-datepicker-BgjjbOMX.js} +2 -2
  13. package/dist/{wt-display-chip-items-B7QLz9QM.js → wt-display-chip-items-BcuWCOui.js} +2 -2
  14. package/dist/{wt-dual-panel-D-LChluY.js → wt-dual-panel-Cs_Yzfxt.js} +1 -1
  15. package/dist/{wt-expansion-card-CToBA1fy.js → wt-expansion-card-BT586Mul.js} +1 -1
  16. package/dist/{wt-expansion-panel-af2t3VrM.js → wt-expansion-panel-kZmHSvPU.js} +1 -1
  17. package/dist/{wt-icon-WyFAGc4t.js → wt-icon-CAn_j3EL.js} +1 -1
  18. package/dist/{wt-icon-action-DYBTs3Mf.js → wt-icon-action-DJzm0kEk.js} +1 -1
  19. package/dist/{wt-icon-btn-BfhuUt8-.js → wt-icon-btn-BL0OfOZM.js} +1 -1
  20. package/dist/{wt-notifications-bar-CvKwuTEg.js → wt-notifications-bar-DZUTZhZy.js} +2 -2
  21. package/dist/{wt-player-B2etfN5v.js → wt-player-DbQuCEZb.js} +3 -3
  22. package/dist/{wt-screen-recordings-action-CepB2pqh.js → wt-screen-recordings-action-CVHZAWjl.js} +1 -1
  23. package/dist/{wt-search-bar-B4YkhgIB.js → wt-search-bar-DosqJLXT.js} +1 -1
  24. package/dist/{wt-send-message-popup-BhZ7K_Vs.js → wt-send-message-popup-B59bhE16.js} +2 -2
  25. package/dist/{wt-status-select-ELI7j73g.js → wt-status-select-Dnv9tj7o.js} +1 -1
  26. package/dist/{wt-timepicker-C3v9Cp2e.js → wt-timepicker-B4MOaSEZ.js} +2 -2
  27. package/dist/{wt-toast-DxQBRGm2.js → wt-toast-DJJg7o3S.js} +2 -2
  28. package/dist/{wt-tree-table-C5sxm-Eb.js → wt-tree-table-D-Jzijlk.js} +1 -1
  29. package/dist/{wt-type-extension-value-input-gQGgxMcJ.js → wt-type-extension-value-input-BEfx2uDx.js} +3 -3
  30. package/dist/{wt-vidstack-player-B37Mdf0u.js → wt-vidstack-player-efSk6APE.js} +4 -4
  31. package/package.json +1 -1
  32. package/src/components/transitions/__tests__/ExpandTransition.spec.js +15 -0
  33. package/src/components/transitions/__tests__/WtReplaceTransition.spec.js +66 -0
  34. package/src/components/transitions/__tests__/WtTransition.spec.js +35 -0
  35. package/src/components/wt-action-bar/WtActionBarActionsOrder.js +1 -1
  36. package/src/components/wt-action-bar/__tests__/WtActionBar.spec.js +121 -0
  37. package/src/components/wt-action-bar/wt-action-bar.vue +57 -33
  38. package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +65 -4
  39. package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +81 -2
  40. package/src/components/wt-avatar/__tests__/WtAvatar.spec.js +111 -0
  41. package/src/components/wt-badge/__tests__/WtBadge.spec.js +80 -0
  42. package/src/components/wt-badge-new/__tests__/WtBadge.spec.js +61 -0
  43. package/src/components/wt-breadcrumb/__tests__/WtBreadcrumb.spec.js +117 -0
  44. package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +37 -5
  45. package/src/components/wt-call-media-metric/__tests__/WtCallMediaMetric.spec.js +84 -0
  46. package/src/components/wt-card/__tests__/WtCard.spec.js +20 -0
  47. package/src/components/wt-checkbox/__tests__/WtCheckbox.spec.js +63 -0
  48. package/src/components/wt-chip/__tests__/WtChip.spec.js +32 -0
  49. package/src/components/wt-confirm-dialog/__tests__/WtConfirmDialog.spec.js +92 -0
  50. package/src/components/wt-context-menu/__tests__/WtContextMenu.spec.js +146 -1
  51. package/src/components/wt-copy-action/__tests__/WtCopyAction.spec.js +57 -0
  52. package/src/components/wt-datepicker/__tests__/WtDatepicker.spec.js +53 -0
  53. package/src/components/wt-datetime-text/__tests__/WtDatetimeText.spec.js +49 -0
  54. package/src/components/wt-divider/__tests__/WtDivider.spec.js +30 -0
  55. package/src/components/wt-dual-panel/__tests__/WtDualPanel.spec.js +120 -0
  56. package/src/components/wt-dummy/__tests__/WtDummy.spec.js +63 -1
  57. package/src/components/wt-empty/__tests__/WtEmpty.spec.js +84 -0
  58. package/src/components/wt-error-page/__tests__/WtErrorPage.spec.js +60 -0
  59. package/src/components/wt-expansion-card/__tests__/WtExpansionCard.spec.js +63 -0
  60. package/src/components/wt-expansion-panel/__tests__/WtExpansionPanel.spec.js +48 -9
  61. package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +81 -10
  62. package/src/components/wt-hint/__tests__/WtHint.spec.js +44 -1
  63. package/src/components/wt-icon/__tests__/WtIcon.spec.js +29 -0
  64. package/src/components/wt-icon-action/__tests__/WtIconAction.spec.js +79 -0
  65. package/src/components/wt-icon-action/wt-icon-action.vue +1 -1
  66. package/src/components/wt-icon-btn/__tests__/WtIconBtn.spec.js +46 -0
  67. package/src/components/wt-image/__tests__/WtImage.spec.js +83 -0
  68. package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +23 -0
  69. package/src/components/wt-input-number/__tests__/WtInputNumber.spec.js +77 -0
  70. package/src/components/wt-input-text/__tests__/WtInputText.spec.js +85 -0
  71. package/src/components/wt-intersection-observer/__tests__/WtIntersectionObserver.spec.js +24 -3
  72. package/src/components/wt-item-link/__tests__/WtItemLink.spec.js +93 -1
  73. package/src/components/wt-label/__tests__/WtLabel.spec.js +49 -1
  74. package/src/components/wt-load-bar/__tests__/WtLoadBar.spec.js +49 -0
  75. package/src/components/wt-loader/__tests__/WtLoader.spec.js +26 -1
  76. package/src/components/wt-logo/__tests__/WtLogo.spec.js +55 -0
  77. package/src/components/wt-menubar/__tests__/WtMenubar.spec.js +30 -0
  78. package/src/components/wt-message/__tests__/WtMessage.spec.js +46 -0
  79. package/src/components/wt-multi-select/__tests__/WtMultiSelect.spec.js +106 -0
  80. package/src/components/wt-page-header/__tests__/WtPageHeader.spec.js +111 -0
  81. package/src/components/wt-password/__tests__/WtPassword.spec.js +107 -0
  82. package/src/components/wt-popover/__tests__/WtPopover.spec.js +73 -0
  83. package/src/components/wt-progress-bar/__tests__/WtProgressBar.spec.js +34 -0
  84. package/src/components/wt-radio/__tests__/WtRadio.spec.js +45 -0
  85. package/src/components/wt-rounded-action/__tests__/WtRoundedAction.spec.js +48 -0
  86. package/src/components/wt-search-bar/__tests__/WtSearchBar.spec.js +74 -13
  87. package/src/components/wt-single-select/__tests__/WtSingleSelect.spec.js +117 -0
  88. package/src/components/wt-slider/__tests__/WtSlider.spec.js +100 -0
  89. package/src/components/wt-stepper/__tests__/WtStepper.spec.js +105 -0
  90. package/src/components/wt-switcher/__tests__/WtSwitcher.spec.js +47 -0
  91. package/src/components/wt-table/__tests__/WtTable.spec.js +237 -0
  92. package/src/components/wt-table-actions/__tests__/WtTableActions.spec.js +153 -1
  93. package/src/components/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +147 -0
  94. package/src/components/wt-tabs/__tests__/WtTabs.spec.js +55 -0
  95. package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +49 -0
  96. package/src/components/wt-time-input/__tests__/WtTimeInput.spec.js +29 -0
  97. package/src/components/wt-tree/__tests__/WtTree.spec.js +126 -2
  98. package/src/components/wt-tree-line/__tests__/WtTreeLine.spec.js +205 -0
  99. package/src/components/wt-tree-table/__tests__/WtTreeTable.spec.js +155 -0
  100. package/src/components/wt-tree-table-row/__tests__/WtTreeTableRow.spec.js +176 -0
  101. package/src/components/wt-vidstack-player/__tests__/WtVidstackPlayer.spec.js +82 -0
  102. package/src/enums/IconAction/{IconAction.enum.js → IconAction.ts} +4 -2
  103. package/src/enums/index.ts +1 -1
  104. package/src/modules/ObjectPermissions/components/_internal/permissions-tab-content.vue +1 -1
  105. package/types/.tsbuildinfo +1 -1
  106. package/types/components/wt-action-bar/wt-action-bar.vue.d.ts +349 -105
  107. package/types/components/wt-datetime-text/__tests__/WtDatetimeText.spec.d.ts +1 -0
  108. package/types/components/wt-divider/__tests__/WtDivider.spec.d.ts +1 -0
  109. package/types/components/wt-dual-panel/__tests__/WtDualPanel.spec.d.ts +1 -0
  110. package/types/components/wt-empty/__tests__/WtEmpty.spec.d.ts +1 -0
  111. package/types/components/wt-error-page/__tests__/WtErrorPage.spec.d.ts +1 -0
  112. package/types/components/wt-expansion-card/__tests__/WtExpansionCard.spec.d.ts +1 -0
  113. package/types/components/wt-image/__tests__/WtImage.spec.d.ts +1 -0
  114. package/types/components/wt-input-number/__tests__/WtInputNumber.spec.d.ts +1 -0
  115. package/types/components/wt-input-text/__tests__/WtInputText.spec.d.ts +1 -0
  116. package/types/components/wt-logo/__tests__/WtLogo.spec.d.ts +1 -0
  117. package/types/components/wt-menubar/__tests__/WtMenubar.spec.d.ts +1 -0
  118. package/types/components/wt-message/__tests__/WtMessage.spec.d.ts +1 -0
  119. package/types/components/wt-multi-select/__tests__/WtMultiSelect.spec.d.ts +1 -0
  120. package/types/components/wt-page-header/__tests__/WtPageHeader.spec.d.ts +1 -0
  121. package/types/components/wt-password/__tests__/WtPassword.spec.d.ts +1 -0
  122. package/types/components/wt-popover/__tests__/WtPopover.spec.d.ts +1 -0
  123. package/types/components/wt-single-select/__tests__/WtSingleSelect.spec.d.ts +1 -0
  124. package/types/components/wt-slider/__tests__/WtSlider.spec.d.ts +1 -0
  125. package/types/components/wt-stepper/__tests__/WtStepper.spec.d.ts +1 -0
  126. package/types/components/wt-table/__tests__/WtTable.spec.d.ts +1 -0
  127. package/types/components/wt-tree-line/__tests__/WtTreeLine.spec.d.ts +1 -0
  128. package/types/components/wt-tree-table/__tests__/WtTreeTable.spec.d.ts +1 -0
  129. package/types/components/wt-tree-table-row/__tests__/WtTreeTableRow.spec.d.ts +1 -0
  130. package/types/components/wt-vidstack-player/__tests__/WtVidstackPlayer.spec.d.ts +1 -0
  131. package/types/enums/IconAction/IconAction.d.ts +31 -0
  132. package/types/enums/index.d.ts +1 -1
  133. package/dist/wt-action-bar-D4wDtBqb.js +0 -87
  134. package/src/components/wt-action-bar/__tests__/wt-action-bar.spec.js +0 -10
  135. package/src/components/wt-avatar/__tests__/wt-avatar.spec.js +0 -10
  136. package/src/components/wt-badge/__tests__/wt-badge.spec.js +0 -10
  137. package/src/components/wt-breadcrumb/__tests__/wt-breadcrumb.spec.js +0 -14
  138. package/src/components/wt-dual-panel/__tests__/WtDualPanel.js +0 -62
  139. package/src/components/wt-empty/__tests__/wt-empty.spec.js +0 -10
  140. package/src/components/wt-error-page/__tests__/wt-error-page.spec.js +0 -30
  141. package/src/components/wt-image/__tests__/wt-image.spec.js +0 -10
  142. package/src/components/wt-logo/__tests__/wt-logo.spec.js +0 -10
  143. package/src/components/wt-page-header/__tests__/wt-page-header.spec.js +0 -10
  144. package/src/components/wt-stepper/__tests__/WtStepper.spec.vue.js +0 -19
  145. package/types/enums/IconAction/IconAction.enum.d.ts +0 -30
  146. /package/types/components/{wt-action-bar/__tests__/wt-action-bar.spec.d.ts → transitions/__tests__/WtReplaceTransition.spec.d.ts} +0 -0
  147. /package/types/components/{wt-avatar/__tests__/wt-avatar.spec.d.ts → transitions/__tests__/WtTransition.spec.d.ts} +0 -0
  148. /package/types/components/{wt-badge/__tests__/wt-badge.spec.d.ts → wt-action-bar/__tests__/WtActionBar.spec.d.ts} +0 -0
  149. /package/types/components/{wt-breadcrumb/__tests__/wt-breadcrumb.spec.d.ts → wt-avatar/__tests__/WtAvatar.spec.d.ts} +0 -0
  150. /package/types/components/{wt-empty/__tests__/wt-empty.spec.d.ts → wt-badge/__tests__/WtBadge.spec.d.ts} +0 -0
  151. /package/types/components/{wt-dual-panel/__tests__/WtDualPanel.d.ts → wt-badge-new/__tests__/WtBadge.spec.d.ts} +0 -0
  152. /package/types/components/{wt-error-page/__tests__/wt-error-page.spec.d.ts → wt-breadcrumb/__tests__/WtBreadcrumb.spec.d.ts} +0 -0
  153. /package/types/components/{wt-image/__tests__/wt-image.spec.d.ts → wt-call-media-metric/__tests__/WtCallMediaMetric.spec.d.ts} +0 -0
  154. /package/types/components/{wt-logo/__tests__/wt-logo.spec.d.ts → wt-card/__tests__/WtCard.spec.d.ts} +0 -0
  155. /package/types/components/{wt-page-header/__tests__/wt-page-header.spec.d.ts → wt-confirm-dialog/__tests__/WtConfirmDialog.spec.d.ts} +0 -0
  156. /package/types/components/{wt-stepper/__tests__/WtStepper.spec.vue.d.ts → wt-copy-action/__tests__/WtCopyAction.spec.d.ts} +0 -0
@@ -0,0 +1,73 @@
1
+ import { flushPromises, mount } from '@vue/test-utils';
2
+
3
+ import WtPopover from '../wt-popover.vue';
4
+
5
+ global.ResizeObserver = vi.fn().mockImplementation(() => ({
6
+ observe: vi.fn(),
7
+ unobserve: vi.fn(),
8
+ disconnect: vi.fn(),
9
+ }));
10
+
11
+ describe('WtPopover', () => {
12
+ it('renders a component', () => {
13
+ const wrapper = mount(WtPopover);
14
+ expect(wrapper.exists()).toBe(true);
15
+ });
16
+
17
+ it('renders the activator slot content', () => {
18
+ const wrapper = mount(WtPopover, {
19
+ slots: {
20
+ activator: '<button class="opener">open</button>',
21
+ },
22
+ });
23
+ expect(wrapper.find('.opener').exists()).toBe(true);
24
+ });
25
+
26
+ it('opens the panel when show() is called via the activator slot', async () => {
27
+ const wrapper = mount(WtPopover, {
28
+ attachTo: document.body,
29
+ slots: {
30
+ activator: `<template #activator="{ show }"><button class="opener" @click="show">open</button></template>`,
31
+ default: 'Popover content',
32
+ },
33
+ });
34
+ await flushPromises();
35
+
36
+ expect(document.body.textContent).not.toContain('Popover content');
37
+
38
+ await wrapper.find('.opener').trigger('click');
39
+ await flushPromises();
40
+
41
+ expect(document.body.textContent).toContain('Popover content');
42
+
43
+ wrapper.unmount();
44
+ });
45
+
46
+ it('does not open when disabled is true', async () => {
47
+ const wrapper = mount(WtPopover, {
48
+ attachTo: document.body,
49
+ props: {
50
+ disabled: true,
51
+ },
52
+ slots: {
53
+ activator: `<template #activator="{ show }"><button class="opener" @click="show">open</button></template>`,
54
+ default: 'Popover content',
55
+ },
56
+ });
57
+ await flushPromises();
58
+
59
+ await wrapper.find('.opener').trigger('click');
60
+ await flushPromises();
61
+
62
+ expect(document.body.textContent).not.toContain('Popover content');
63
+
64
+ wrapper.unmount();
65
+ });
66
+
67
+ it('exposes show, hide and toggle methods', () => {
68
+ const wrapper = mount(WtPopover);
69
+ expect(typeof wrapper.vm.show).toBe('function');
70
+ expect(typeof wrapper.vm.hide).toBe('function');
71
+ expect(typeof wrapper.vm.toggle).toBe('function');
72
+ });
73
+ });
@@ -25,4 +25,38 @@ describe('WtProgressBar', () => {
25
25
  });
26
26
  expect(wrapper.vm.isOverflow).toBe(false);
27
27
  });
28
+
29
+ it('clamps progress width to 100% when value exceeds max', () => {
30
+ const wrapper = shallowMount(WtProgressBar, {
31
+ props: {
32
+ value: 150,
33
+ max: 100,
34
+ },
35
+ });
36
+ expect(wrapper.find('.wt-progress-bar__progress').attributes('style')).toBe(
37
+ 'width: 100%;',
38
+ );
39
+ expect(wrapper.classes()).toContain('wt-progress-bar--overflow');
40
+ });
41
+
42
+ it('computes progress width as a percentage when not overflowing', () => {
43
+ const wrapper = shallowMount(WtProgressBar, {
44
+ props: {
45
+ value: 25,
46
+ max: 50,
47
+ },
48
+ });
49
+ expect(wrapper.find('.wt-progress-bar__progress').attributes('style')).toBe(
50
+ 'width: 50%;',
51
+ );
52
+ });
53
+
54
+ it('applies the color modifier class', () => {
55
+ const wrapper = shallowMount(WtProgressBar, {
56
+ props: {
57
+ color: 'error',
58
+ },
59
+ });
60
+ expect(wrapper.classes()).toContain('wt-progress-bar--error');
61
+ });
28
62
  });
@@ -53,4 +53,49 @@ describe('WtRadio', () => {
53
53
  value,
54
54
  ]);
55
55
  });
56
+
57
+ it('checks the radio input when value matches selected', () => {
58
+ const wrapper = mount(WtRadio, {
59
+ stubs: {
60
+ WtLabel,
61
+ WtIcon,
62
+ },
63
+ props: {
64
+ selected: 'v',
65
+ value: 'v',
66
+ },
67
+ });
68
+ expect(wrapper.find('input[type="radio"]').element.checked).toBe(true);
69
+ });
70
+
71
+ it('does not render a label when no label prop or slot is passed', () => {
72
+ const wrapper = mount(WtRadio, {
73
+ stubs: {
74
+ WtLabel,
75
+ WtIcon,
76
+ },
77
+ props: {
78
+ selected: '',
79
+ value: 'v',
80
+ },
81
+ });
82
+ expect(wrapper.findComponent(WtLabel).exists()).toBe(false);
83
+ });
84
+
85
+ it('disables the underlying radio when disabled prop is true', () => {
86
+ const wrapper = mount(WtRadio, {
87
+ stubs: {
88
+ WtLabel,
89
+ WtIcon,
90
+ },
91
+ props: {
92
+ selected: '',
93
+ value: 'v',
94
+ disabled: true,
95
+ },
96
+ });
97
+ expect(
98
+ wrapper.find('input[type="radio"]').attributes('disabled'),
99
+ ).toBeDefined();
100
+ });
56
101
  });
@@ -109,4 +109,52 @@ describe('WtRoundedAction', () => {
109
109
  ).toBe(true);
110
110
  vi.useRealTimers();
111
111
  });
112
+
113
+ it('uses "default" icon color for the default secondary color', () => {
114
+ const wrapper = shallowMount(WtRoundedAction, {
115
+ props: {
116
+ icon: 'call',
117
+ },
118
+ });
119
+ expect(
120
+ wrapper
121
+ .findComponent({
122
+ name: 'wt-icon',
123
+ })
124
+ .props('color'),
125
+ ).toBe('default');
126
+ });
127
+
128
+ it('uses "disabled" icon color when disabled, overriding the color prop', () => {
129
+ const wrapper = shallowMount(WtRoundedAction, {
130
+ props: {
131
+ icon: 'call',
132
+ color: 'primary',
133
+ disabled: true,
134
+ },
135
+ });
136
+ expect(
137
+ wrapper
138
+ .findComponent({
139
+ name: 'wt-icon',
140
+ })
141
+ .props('color'),
142
+ ).toBe('disabled');
143
+ });
144
+
145
+ it('passes through non-secondary colors to the icon', () => {
146
+ const wrapper = shallowMount(WtRoundedAction, {
147
+ props: {
148
+ icon: 'call',
149
+ color: 'error',
150
+ },
151
+ });
152
+ expect(
153
+ wrapper
154
+ .findComponent({
155
+ name: 'wt-icon',
156
+ })
157
+ .props('color'),
158
+ ).toBe('error');
159
+ });
112
160
  });
@@ -1,4 +1,4 @@
1
- import { shallowMount } from '@vue/test-utils';
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
2
  import { ref } from 'vue';
3
3
 
4
4
  import { useValidation } from '../../../mixins/validationMixin/useValidation';
@@ -12,6 +12,14 @@ useValidation.mockImplementation(() => ({
12
12
  }));
13
13
 
14
14
  describe('WtSearchBar', () => {
15
+ beforeEach(() => {
16
+ vi.useFakeTimers();
17
+ });
18
+
19
+ afterEach(() => {
20
+ vi.useRealTimers();
21
+ });
22
+
15
23
  it('renders a component', () => {
16
24
  const wrapper = shallowMount(WtSearchBar, {
17
25
  stubs: {
@@ -22,24 +30,77 @@ describe('WtSearchBar', () => {
22
30
  expect(wrapper.classes('wt-search-bar')).toBe(true);
23
31
  });
24
32
 
25
- it('debounces search event when debounce prop is true', async () => {
26
- const props = {
27
- value: '',
28
- debounce: true,
29
- debounceDelay: 100,
30
- };
33
+ it('emits input immediately and search after the debounce delay', () => {
34
+ const wrapper = shallowMount(WtSearchBar, {
35
+ stubs: {
36
+ WtIcon: true,
37
+ WtIconBtn: true,
38
+ },
39
+ });
40
+ const input = wrapper.findComponent({
41
+ name: 'wt-input-text',
42
+ });
43
+ input.vm.$emit('update:model-value', 'val');
44
+
45
+ expect(wrapper.emitted().input[0]).toEqual([
46
+ 'val',
47
+ ]);
48
+ expect(wrapper.emitted().search).toBeFalsy();
49
+
50
+ vi.advanceTimersByTime(1000);
51
+ expect(wrapper.emitted().search[0]).toEqual([
52
+ 'val',
53
+ ]);
54
+ });
55
+
56
+ it('does not render the suffix controls without a value, hint or searchMode', () => {
31
57
  const wrapper = shallowMount(WtSearchBar, {
32
58
  stubs: {
33
59
  WtIcon: true,
34
60
  WtIconBtn: true,
35
61
  },
36
- props,
37
62
  });
38
- props.value = 'val';
39
- wrapper.setProps(props);
63
+ expect(wrapper.find('.wt-search-bar__icon-controls').exists()).toBe(false);
64
+ });
65
+
66
+ it('renders a reset button that clears the value when a value is present', async () => {
67
+ const wrapper = mount(WtSearchBar, {
68
+ props: {
69
+ value: 'something',
70
+ },
71
+ });
72
+ const resetBtn = wrapper.find('.wt-search-bar__reset-icon-btn');
73
+ expect(resetBtn.exists()).toBe(true);
74
+
75
+ await resetBtn.trigger('click');
76
+ expect(wrapper.emitted().input.at(-1)).toEqual([
77
+ '',
78
+ ]);
79
+ });
80
+
81
+ it('emits search on Enter keyup once the debounce delay elapses', async () => {
82
+ const wrapper = mount(WtSearchBar, {
83
+ props: {
84
+ value: 'enter-value',
85
+ },
86
+ });
87
+ const nativeInput = wrapper.find('input');
88
+ nativeInput.element.value = 'enter-value';
89
+ await nativeInput.trigger('keyup', {
90
+ key: 'Enter',
91
+ });
92
+
40
93
  expect(wrapper.emitted().search).toBeFalsy();
41
- await setTimeout(() => {
42
- expect(wrapper.emitted().search[0].length).toBe(1);
43
- }, 1000);
94
+
95
+ vi.advanceTimersByTime(1000);
96
+ expect(wrapper.emitted().search[0]).toEqual([
97
+ 'enter-value',
98
+ ]);
99
+ });
100
+
101
+ it('emits focus when the underlying input is focused', async () => {
102
+ const wrapper = mount(WtSearchBar);
103
+ await wrapper.find('input').trigger('focus');
104
+ expect(wrapper.emitted().focus).toBeTruthy();
44
105
  });
45
106
  });
@@ -0,0 +1,117 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtSingleSelect from '../wt-single-select.vue';
4
+
5
+ global.ResizeObserver = vi.fn().mockImplementation(() => ({
6
+ observe: vi.fn(),
7
+ unobserve: vi.fn(),
8
+ disconnect: vi.fn(),
9
+ }));
10
+
11
+ describe('WtSingleSelect', () => {
12
+ it('renders a component', () => {
13
+ const wrapper = shallowMount(WtSingleSelect);
14
+ expect(wrapper.classes()).toContain('wt-single-select');
15
+ });
16
+
17
+ it('does not render a label when no label prop or slot is passed', () => {
18
+ const wrapper = shallowMount(WtSingleSelect);
19
+ expect(
20
+ wrapper
21
+ .findComponent({
22
+ name: 'wt-label',
23
+ })
24
+ .exists(),
25
+ ).toBe(false);
26
+ });
27
+
28
+ it('renders the label text when passed', () => {
29
+ const wrapper = mount(WtSingleSelect, {
30
+ props: {
31
+ label: 'Choose one',
32
+ },
33
+ });
34
+ expect(wrapper.find('.wt-select__label').text()).toBe('Choose one');
35
+ });
36
+
37
+ it('appends an asterisk to the label when required', () => {
38
+ const wrapper = mount(WtSingleSelect, {
39
+ props: {
40
+ label: 'Choose one',
41
+ required: true,
42
+ },
43
+ });
44
+ expect(wrapper.find('.wt-select__label').text()).toBe('Choose one*');
45
+ });
46
+
47
+ it('applies the has-value modifier class once a value is selected', () => {
48
+ const wrapper = shallowMount(WtSingleSelect, {
49
+ props: {
50
+ modelValue: 'a',
51
+ },
52
+ });
53
+ expect(wrapper.classes()).toContain('wt-single-select--has-value');
54
+ });
55
+
56
+ it('does not apply the has-value modifier class without a value', () => {
57
+ const wrapper = shallowMount(WtSingleSelect);
58
+ expect(wrapper.classes()).not.toContain('wt-single-select--has-value');
59
+ });
60
+
61
+ it('normalizes an empty object model to an empty string', () => {
62
+ const wrapper = mount(WtSingleSelect, {
63
+ props: {
64
+ modelValue: {},
65
+ },
66
+ });
67
+ expect(wrapper.classes()).not.toContain('wt-single-select--has-value');
68
+ });
69
+
70
+ it('passes disabled and options down to the underlying select', () => {
71
+ const options = [
72
+ {
73
+ label: 'One',
74
+ value: 1,
75
+ },
76
+ {
77
+ label: 'Two',
78
+ value: 2,
79
+ },
80
+ ];
81
+ const wrapper = shallowMount(WtSingleSelect, {
82
+ props: {
83
+ disabled: true,
84
+ options,
85
+ },
86
+ });
87
+ const select = wrapper.findComponent({
88
+ name: 'Select',
89
+ });
90
+ expect(select.attributes('disabled')).toBe('true');
91
+ });
92
+
93
+ it('maps size prop to the PrimeVue size scale', () => {
94
+ const wrapper = shallowMount(WtSingleSelect, {
95
+ props: {
96
+ size: 'sm',
97
+ },
98
+ });
99
+ expect(
100
+ wrapper
101
+ .findComponent({
102
+ name: 'Select',
103
+ })
104
+ .attributes('size'),
105
+ ).toBe('small');
106
+ });
107
+
108
+ it('emits hide when the dropdown hides', async () => {
109
+ const wrapper = shallowMount(WtSingleSelect);
110
+ await wrapper
111
+ .findComponent({
112
+ name: 'Select',
113
+ })
114
+ .vm.$emit('hide');
115
+ expect(wrapper.emitted().hide).toBeTruthy();
116
+ });
117
+ });
@@ -0,0 +1,100 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import WtSlider from '../wt-slider.vue';
4
+
5
+ describe('WtSlider', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtSlider);
8
+ expect(
9
+ wrapper
10
+ .findComponent({
11
+ name: 'Slider',
12
+ })
13
+ .exists(),
14
+ ).toBe(true);
15
+ });
16
+
17
+ it('applies default min/max/step to the underlying slider', () => {
18
+ const wrapper = shallowMount(WtSlider);
19
+ const slider = wrapper.findComponent({
20
+ name: 'Slider',
21
+ });
22
+ expect(slider.attributes('min')).toBe('0');
23
+ expect(slider.attributes('max')).toBe('100');
24
+ expect(slider.attributes('step')).toBe('1');
25
+ });
26
+
27
+ it('passes custom min/max/step/disabled down', () => {
28
+ const wrapper = shallowMount(WtSlider, {
29
+ props: {
30
+ min: 10,
31
+ max: 20,
32
+ step: 5,
33
+ disabled: true,
34
+ },
35
+ });
36
+ const slider = wrapper.findComponent({
37
+ name: 'Slider',
38
+ });
39
+ expect(slider.attributes('min')).toBe('10');
40
+ expect(slider.attributes('max')).toBe('20');
41
+ expect(slider.attributes('step')).toBe('5');
42
+ expect(slider.attributes('disabled')).toBe('true');
43
+ });
44
+
45
+ it('defaults to horizontal orientation', () => {
46
+ const wrapper = shallowMount(WtSlider);
47
+ expect(
48
+ wrapper
49
+ .findComponent({
50
+ name: 'Slider',
51
+ })
52
+ .attributes('orientation'),
53
+ ).toBe('horizontal');
54
+ });
55
+
56
+ it('uses vertical orientation and applies height style when vertical is true', () => {
57
+ const wrapper = shallowMount(WtSlider, {
58
+ props: {
59
+ vertical: true,
60
+ height: 200,
61
+ },
62
+ });
63
+ const slider = wrapper.findComponent({
64
+ name: 'Slider',
65
+ });
66
+ expect(slider.attributes('orientation')).toBe('vertical');
67
+ expect(slider.attributes('style')).toContain('height: 200px');
68
+ });
69
+
70
+ it('applies width style when horizontal and width is provided', () => {
71
+ const wrapper = shallowMount(WtSlider, {
72
+ props: {
73
+ width: 300,
74
+ },
75
+ });
76
+ expect(
77
+ wrapper
78
+ .findComponent({
79
+ name: 'Slider',
80
+ })
81
+ .attributes('style'),
82
+ ).toContain('width: 300px');
83
+ });
84
+
85
+ it('emits update:modelValue when the slider value changes', async () => {
86
+ const wrapper = shallowMount(WtSlider, {
87
+ props: {
88
+ modelValue: 5,
89
+ },
90
+ });
91
+ await wrapper
92
+ .findComponent({
93
+ name: 'Slider',
94
+ })
95
+ .vm.$emit('update:modelValue', 42);
96
+ expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
97
+ 42,
98
+ ]);
99
+ });
100
+ });
@@ -0,0 +1,105 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtStepper from '../wt-stepper.vue';
4
+
5
+ const steps = [
6
+ {
7
+ name: 'step 1',
8
+ description: 'description 1',
9
+ },
10
+ {
11
+ name: 'step 2',
12
+ description: 'description 2',
13
+ },
14
+ {
15
+ name: 'step 3',
16
+ description: 'description 3',
17
+ },
18
+ ];
19
+
20
+ describe('WtStepper', () => {
21
+ it('renders a component', () => {
22
+ const wrapper = shallowMount(WtStepper, {
23
+ props: {
24
+ steps,
25
+ },
26
+ });
27
+ expect(wrapper.isVisible()).toBe(true);
28
+ });
29
+
30
+ it('renders a chip for each step', () => {
31
+ const wrapper = mount(WtStepper, {
32
+ props: {
33
+ steps,
34
+ },
35
+ });
36
+ const chips = wrapper.findAllComponents({
37
+ name: 'wt-chip',
38
+ });
39
+ expect(chips.length).toBe(steps.length);
40
+ expect(chips[0].text()).toBe('step 1');
41
+ });
42
+
43
+ it('marks steps before the active step as completed', () => {
44
+ const wrapper = shallowMount(WtStepper, {
45
+ props: {
46
+ steps,
47
+ activeStep: 2,
48
+ },
49
+ });
50
+ const chips = wrapper.findAllComponents({
51
+ name: 'wt-chip',
52
+ });
53
+ expect(chips[0].attributes('color')).toBe('primary');
54
+ expect(chips[1].attributes('color')).toBe('primary');
55
+ expect(chips[2].attributes('color')).toBe('secondary');
56
+ });
57
+
58
+ it('renders a divider between steps but not before the first one', () => {
59
+ const wrapper = shallowMount(WtStepper, {
60
+ props: {
61
+ steps,
62
+ },
63
+ });
64
+ expect(wrapper.findAll('.wt-stepper-steps__divider').length).toBe(
65
+ steps.length - 1,
66
+ );
67
+ });
68
+
69
+ it('renders the description of the active step by default', () => {
70
+ const wrapper = mount(WtStepper, {
71
+ props: {
72
+ steps,
73
+ activeStep: 2,
74
+ },
75
+ });
76
+ expect(wrapper.find('.wt-stepper-description').text()).toBe(
77
+ 'description 2',
78
+ );
79
+ });
80
+
81
+ it('renders custom content via the description slot', () => {
82
+ const wrapper = shallowMount(WtStepper, {
83
+ props: {
84
+ steps,
85
+ },
86
+ slots: {
87
+ description: 'Custom description',
88
+ },
89
+ });
90
+ expect(wrapper.text()).toContain('Custom description');
91
+ expect(wrapper.find('.wt-stepper-description').exists()).toBe(false);
92
+ });
93
+
94
+ it('renders content via the main slot', () => {
95
+ const wrapper = shallowMount(WtStepper, {
96
+ props: {
97
+ steps,
98
+ },
99
+ slots: {
100
+ main: 'Main content',
101
+ },
102
+ });
103
+ expect(wrapper.text()).toContain('Main content');
104
+ });
105
+ });
@@ -39,4 +39,51 @@ describe('WtSwitcher', () => {
39
39
  });
40
40
  expect(wrapper.classes('wt-switcher--label-left')).toBe(true);
41
41
  });
42
+
43
+ it('does not render a label when no label prop or slot is passed', () => {
44
+ const wrapper = shallowMount(WtSwitcher, {
45
+ props: {
46
+ modelValue: false,
47
+ },
48
+ });
49
+ expect(
50
+ wrapper
51
+ .findComponent({
52
+ name: 'wt-label',
53
+ })
54
+ .exists(),
55
+ ).toBe(false);
56
+ });
57
+
58
+ it('emits update:modelValue with the inverted value when toggled', async () => {
59
+ const wrapper = shallowMount(WtSwitcher, {
60
+ props: {
61
+ modelValue: false,
62
+ },
63
+ });
64
+ await wrapper
65
+ .findComponent({
66
+ name: 'ToggleSwitch',
67
+ })
68
+ .vm.$emit('update:modelValue', true);
69
+ expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
70
+ true,
71
+ ]);
72
+ });
73
+
74
+ it('passes disabled down to the underlying switch', () => {
75
+ const wrapper = shallowMount(WtSwitcher, {
76
+ props: {
77
+ modelValue: false,
78
+ disabled: true,
79
+ },
80
+ });
81
+ expect(
82
+ wrapper
83
+ .findComponent({
84
+ name: 'ToggleSwitch',
85
+ })
86
+ .attributes('disabled'),
87
+ ).toBe('true');
88
+ });
42
89
  });