@webitel/ui-sdk 26.8.75 → 26.8.77

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 (174) hide show
  1. package/dist/{clients-BmeOR90W.js → clients-B8-WDK4d.js} +66 -79
  2. package/dist/{components-C-ri6OSQ.js → components-fKLMXHe_.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 +610 -612
  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-BwPz__rU.js} +2 -2
  11. package/dist/{wt-chat-emoji-CLhgb02d.js → wt-chat-emoji-DcVCe4jW.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-D-v25BUi.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-action-DYBTs3Mf.js → wt-icon-action-DJzm0kEk.js} +1 -1
  18. package/dist/{wt-icon-btn-BfhuUt8-.js → wt-icon-btn-BzraLc-w.js} +1 -1
  19. package/dist/{wt-icon-WyFAGc4t.js → wt-icon-iRDqWkjp.js} +19 -19
  20. package/dist/{wt-notifications-bar-CvKwuTEg.js → wt-notifications-bar-ZIMKBDqL.js} +2 -2
  21. package/dist/{wt-player-B2etfN5v.js → wt-player-CFrKSilF.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-BpgjqxvU.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-BcgNZFCD.js} +2 -2
  28. package/dist/{wt-tree-table-C5sxm-Eb.js → wt-tree-table-xXbBeLUc.js} +1 -1
  29. package/dist/{wt-type-extension-value-input-gQGgxMcJ.js → wt-type-extension-value-input-D86gV8RI.js} +3 -3
  30. package/dist/{wt-vidstack-player-B37Mdf0u.js → wt-vidstack-player-BzyyVEji.js} +4 -4
  31. package/package.json +1 -1
  32. package/src/assets/icons/sprite/call--filled.svg +1 -1
  33. package/src/assets/icons/sprite/call-add-to--filled.svg +2 -2
  34. package/src/assets/icons/sprite/call-add-to.svg +2 -3
  35. package/src/assets/icons/sprite/call-disconnect--filled.svg +2 -2
  36. package/src/assets/icons/sprite/call-disconnect.svg +2 -2
  37. package/src/assets/icons/sprite/call-end--filled.svg +2 -1
  38. package/src/assets/icons/sprite/call-end.svg +2 -2
  39. package/src/assets/icons/sprite/call-inbound--filled.svg +2 -3
  40. package/src/assets/icons/sprite/call-inbound.svg +2 -2
  41. package/src/assets/icons/sprite/call-missed--filled.svg +2 -2
  42. package/src/assets/icons/sprite/call-missed.svg +2 -2
  43. package/src/assets/icons/sprite/call-outbound--filled.svg +2 -2
  44. package/src/assets/icons/sprite/call-outbound.svg +2 -2
  45. package/src/assets/icons/sprite/call-ringing--filled.svg +3 -4
  46. package/src/assets/icons/sprite/call-ringing.svg +3 -2
  47. package/src/assets/icons/sprite/call-transfer--filled.svg +2 -2
  48. package/src/assets/icons/sprite/call-transfer.svg +2 -2
  49. package/src/assets/icons/sprite/call.svg +1 -2
  50. package/src/components/transitions/__tests__/ExpandTransition.spec.js +15 -0
  51. package/src/components/transitions/__tests__/WtReplaceTransition.spec.js +66 -0
  52. package/src/components/transitions/__tests__/WtTransition.spec.js +35 -0
  53. package/src/components/wt-action-bar/WtActionBarActionsOrder.js +1 -1
  54. package/src/components/wt-action-bar/__tests__/WtActionBar.spec.js +121 -0
  55. package/src/components/wt-action-bar/wt-action-bar.vue +57 -33
  56. package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +65 -4
  57. package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +81 -2
  58. package/src/components/wt-avatar/__tests__/WtAvatar.spec.js +111 -0
  59. package/src/components/wt-badge/__tests__/WtBadge.spec.js +80 -0
  60. package/src/components/wt-badge-new/__tests__/WtBadge.spec.js +61 -0
  61. package/src/components/wt-breadcrumb/__tests__/WtBreadcrumb.spec.js +117 -0
  62. package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +37 -5
  63. package/src/components/wt-call-media-metric/__tests__/WtCallMediaMetric.spec.js +84 -0
  64. package/src/components/wt-card/__tests__/WtCard.spec.js +20 -0
  65. package/src/components/wt-checkbox/__tests__/WtCheckbox.spec.js +63 -0
  66. package/src/components/wt-chip/__tests__/WtChip.spec.js +32 -0
  67. package/src/components/wt-confirm-dialog/__tests__/WtConfirmDialog.spec.js +92 -0
  68. package/src/components/wt-context-menu/__tests__/WtContextMenu.spec.js +146 -1
  69. package/src/components/wt-copy-action/__tests__/WtCopyAction.spec.js +57 -0
  70. package/src/components/wt-datepicker/__tests__/WtDatepicker.spec.js +53 -0
  71. package/src/components/wt-datetime-text/__tests__/WtDatetimeText.spec.js +49 -0
  72. package/src/components/wt-divider/__tests__/WtDivider.spec.js +30 -0
  73. package/src/components/wt-dual-panel/__tests__/WtDualPanel.spec.js +120 -0
  74. package/src/components/wt-dummy/__tests__/WtDummy.spec.js +63 -1
  75. package/src/components/wt-empty/__tests__/WtEmpty.spec.js +84 -0
  76. package/src/components/wt-error-page/__tests__/WtErrorPage.spec.js +60 -0
  77. package/src/components/wt-expansion-card/__tests__/WtExpansionCard.spec.js +63 -0
  78. package/src/components/wt-expansion-panel/__tests__/WtExpansionPanel.spec.js +48 -9
  79. package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +81 -10
  80. package/src/components/wt-hint/__tests__/WtHint.spec.js +44 -1
  81. package/src/components/wt-icon/__tests__/WtIcon.spec.js +29 -0
  82. package/src/components/wt-icon-action/__tests__/WtIconAction.spec.js +79 -0
  83. package/src/components/wt-icon-action/wt-icon-action.vue +1 -1
  84. package/src/components/wt-icon-btn/__tests__/WtIconBtn.spec.js +46 -0
  85. package/src/components/wt-image/__tests__/WtImage.spec.js +83 -0
  86. package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +23 -0
  87. package/src/components/wt-input-number/__tests__/WtInputNumber.spec.js +77 -0
  88. package/src/components/wt-input-text/__tests__/WtInputText.spec.js +85 -0
  89. package/src/components/wt-intersection-observer/__tests__/WtIntersectionObserver.spec.js +24 -3
  90. package/src/components/wt-item-link/__tests__/WtItemLink.spec.js +93 -1
  91. package/src/components/wt-label/__tests__/WtLabel.spec.js +49 -1
  92. package/src/components/wt-load-bar/__tests__/WtLoadBar.spec.js +49 -0
  93. package/src/components/wt-loader/__tests__/WtLoader.spec.js +26 -1
  94. package/src/components/wt-logo/__tests__/WtLogo.spec.js +55 -0
  95. package/src/components/wt-menubar/__tests__/WtMenubar.spec.js +30 -0
  96. package/src/components/wt-message/__tests__/WtMessage.spec.js +46 -0
  97. package/src/components/wt-multi-select/__tests__/WtMultiSelect.spec.js +106 -0
  98. package/src/components/wt-page-header/__tests__/WtPageHeader.spec.js +111 -0
  99. package/src/components/wt-password/__tests__/WtPassword.spec.js +107 -0
  100. package/src/components/wt-popover/__tests__/WtPopover.spec.js +73 -0
  101. package/src/components/wt-progress-bar/__tests__/WtProgressBar.spec.js +34 -0
  102. package/src/components/wt-radio/__tests__/WtRadio.spec.js +45 -0
  103. package/src/components/wt-rounded-action/__tests__/WtRoundedAction.spec.js +48 -0
  104. package/src/components/wt-search-bar/__tests__/WtSearchBar.spec.js +74 -13
  105. package/src/components/wt-single-select/__tests__/WtSingleSelect.spec.js +117 -0
  106. package/src/components/wt-slider/__tests__/WtSlider.spec.js +100 -0
  107. package/src/components/wt-stepper/__tests__/WtStepper.spec.js +105 -0
  108. package/src/components/wt-switcher/__tests__/WtSwitcher.spec.js +47 -0
  109. package/src/components/wt-table/__tests__/WtTable.spec.js +237 -0
  110. package/src/components/wt-table-actions/__tests__/WtTableActions.spec.js +153 -1
  111. package/src/components/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +147 -0
  112. package/src/components/wt-tabs/__tests__/WtTabs.spec.js +55 -0
  113. package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +49 -0
  114. package/src/components/wt-time-input/__tests__/WtTimeInput.spec.js +29 -0
  115. package/src/components/wt-tree/__tests__/WtTree.spec.js +126 -2
  116. package/src/components/wt-tree-line/__tests__/WtTreeLine.spec.js +205 -0
  117. package/src/components/wt-tree-table/__tests__/WtTreeTable.spec.js +155 -0
  118. package/src/components/wt-tree-table-row/__tests__/WtTreeTableRow.spec.js +176 -0
  119. package/src/components/wt-vidstack-player/__tests__/WtVidstackPlayer.spec.js +82 -0
  120. package/src/enums/IconAction/{IconAction.enum.js → IconAction.ts} +4 -2
  121. package/src/enums/index.ts +1 -1
  122. package/src/modules/ObjectPermissions/components/_internal/permissions-tab-content.vue +1 -1
  123. package/types/.tsbuildinfo +1 -1
  124. package/types/components/wt-action-bar/wt-action-bar.vue.d.ts +349 -105
  125. package/types/components/wt-datetime-text/__tests__/WtDatetimeText.spec.d.ts +1 -0
  126. package/types/components/wt-divider/__tests__/WtDivider.spec.d.ts +1 -0
  127. package/types/components/wt-dual-panel/__tests__/WtDualPanel.spec.d.ts +1 -0
  128. package/types/components/wt-empty/__tests__/WtEmpty.spec.d.ts +1 -0
  129. package/types/components/wt-error-page/__tests__/WtErrorPage.spec.d.ts +1 -0
  130. package/types/components/wt-expansion-card/__tests__/WtExpansionCard.spec.d.ts +1 -0
  131. package/types/components/wt-image/__tests__/WtImage.spec.d.ts +1 -0
  132. package/types/components/wt-input-number/__tests__/WtInputNumber.spec.d.ts +1 -0
  133. package/types/components/wt-input-text/__tests__/WtInputText.spec.d.ts +1 -0
  134. package/types/components/wt-logo/__tests__/WtLogo.spec.d.ts +1 -0
  135. package/types/components/wt-menubar/__tests__/WtMenubar.spec.d.ts +1 -0
  136. package/types/components/wt-message/__tests__/WtMessage.spec.d.ts +1 -0
  137. package/types/components/wt-multi-select/__tests__/WtMultiSelect.spec.d.ts +1 -0
  138. package/types/components/wt-page-header/__tests__/WtPageHeader.spec.d.ts +1 -0
  139. package/types/components/wt-password/__tests__/WtPassword.spec.d.ts +1 -0
  140. package/types/components/wt-popover/__tests__/WtPopover.spec.d.ts +1 -0
  141. package/types/components/wt-single-select/__tests__/WtSingleSelect.spec.d.ts +1 -0
  142. package/types/components/wt-slider/__tests__/WtSlider.spec.d.ts +1 -0
  143. package/types/components/wt-stepper/__tests__/WtStepper.spec.d.ts +1 -0
  144. package/types/components/wt-table/__tests__/WtTable.spec.d.ts +1 -0
  145. package/types/components/wt-tree-line/__tests__/WtTreeLine.spec.d.ts +1 -0
  146. package/types/components/wt-tree-table/__tests__/WtTreeTable.spec.d.ts +1 -0
  147. package/types/components/wt-tree-table-row/__tests__/WtTreeTableRow.spec.d.ts +1 -0
  148. package/types/components/wt-vidstack-player/__tests__/WtVidstackPlayer.spec.d.ts +1 -0
  149. package/types/enums/IconAction/IconAction.d.ts +31 -0
  150. package/types/enums/index.d.ts +1 -1
  151. package/dist/wt-action-bar-D4wDtBqb.js +0 -87
  152. package/src/components/wt-action-bar/__tests__/wt-action-bar.spec.js +0 -10
  153. package/src/components/wt-avatar/__tests__/wt-avatar.spec.js +0 -10
  154. package/src/components/wt-badge/__tests__/wt-badge.spec.js +0 -10
  155. package/src/components/wt-breadcrumb/__tests__/wt-breadcrumb.spec.js +0 -14
  156. package/src/components/wt-dual-panel/__tests__/WtDualPanel.js +0 -62
  157. package/src/components/wt-empty/__tests__/wt-empty.spec.js +0 -10
  158. package/src/components/wt-error-page/__tests__/wt-error-page.spec.js +0 -30
  159. package/src/components/wt-image/__tests__/wt-image.spec.js +0 -10
  160. package/src/components/wt-logo/__tests__/wt-logo.spec.js +0 -10
  161. package/src/components/wt-page-header/__tests__/wt-page-header.spec.js +0 -10
  162. package/src/components/wt-stepper/__tests__/WtStepper.spec.vue.js +0 -19
  163. package/types/enums/IconAction/IconAction.enum.d.ts +0 -30
  164. /package/types/components/{wt-action-bar/__tests__/wt-action-bar.spec.d.ts → transitions/__tests__/WtReplaceTransition.spec.d.ts} +0 -0
  165. /package/types/components/{wt-avatar/__tests__/wt-avatar.spec.d.ts → transitions/__tests__/WtTransition.spec.d.ts} +0 -0
  166. /package/types/components/{wt-badge/__tests__/wt-badge.spec.d.ts → wt-action-bar/__tests__/WtActionBar.spec.d.ts} +0 -0
  167. /package/types/components/{wt-breadcrumb/__tests__/wt-breadcrumb.spec.d.ts → wt-avatar/__tests__/WtAvatar.spec.d.ts} +0 -0
  168. /package/types/components/{wt-empty/__tests__/wt-empty.spec.d.ts → wt-badge/__tests__/WtBadge.spec.d.ts} +0 -0
  169. /package/types/components/{wt-dual-panel/__tests__/WtDualPanel.d.ts → wt-badge-new/__tests__/WtBadge.spec.d.ts} +0 -0
  170. /package/types/components/{wt-error-page/__tests__/wt-error-page.spec.d.ts → wt-breadcrumb/__tests__/WtBreadcrumb.spec.d.ts} +0 -0
  171. /package/types/components/{wt-image/__tests__/wt-image.spec.d.ts → wt-call-media-metric/__tests__/WtCallMediaMetric.spec.d.ts} +0 -0
  172. /package/types/components/{wt-logo/__tests__/wt-logo.spec.d.ts → wt-card/__tests__/WtCard.spec.d.ts} +0 -0
  173. /package/types/components/{wt-page-header/__tests__/wt-page-header.spec.d.ts → wt-confirm-dialog/__tests__/WtConfirmDialog.spec.d.ts} +0 -0
  174. /package/types/components/{wt-stepper/__tests__/WtStepper.spec.vue.d.ts → wt-copy-action/__tests__/WtCopyAction.spec.d.ts} +0 -0
@@ -0,0 +1,106 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtMultiSelect from '../wt-multi-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('WtMultiSelect', () => {
12
+ it('renders a component', () => {
13
+ const wrapper = shallowMount(WtMultiSelect);
14
+ expect(wrapper.classes()).toContain('wt-multi-select');
15
+ });
16
+
17
+ it('does not render a label when no label prop or slot is passed', () => {
18
+ const wrapper = shallowMount(WtMultiSelect);
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(WtMultiSelect, {
30
+ props: {
31
+ label: 'Choose options',
32
+ },
33
+ });
34
+ expect(wrapper.find('.wt-select__label').text()).toBe('Choose options');
35
+ });
36
+
37
+ it('appends an asterisk to the label when required', () => {
38
+ const wrapper = mount(WtMultiSelect, {
39
+ props: {
40
+ label: 'Choose options',
41
+ required: true,
42
+ },
43
+ });
44
+ expect(wrapper.find('.wt-select__label').text()).toBe('Choose options*');
45
+ });
46
+
47
+ it('passes disabled down to the underlying multiselect', () => {
48
+ const wrapper = shallowMount(WtMultiSelect, {
49
+ props: {
50
+ disabled: true,
51
+ },
52
+ });
53
+ const select = wrapper.findComponent({
54
+ name: 'MultiSelect',
55
+ });
56
+ expect(select.attributes('disabled')).toBe('true');
57
+ });
58
+
59
+ it('normalizes the model to an array', () => {
60
+ const wrapper = mount(WtMultiSelect, {
61
+ props: {
62
+ modelValue: null,
63
+ },
64
+ });
65
+ const select = wrapper.findComponent({
66
+ name: 'MultiSelect',
67
+ });
68
+ expect(select.props('modelValue')).toEqual([]);
69
+ });
70
+
71
+ it('displays chips when chipsView is true', () => {
72
+ const wrapper = shallowMount(WtMultiSelect, {
73
+ props: {
74
+ chipsView: true,
75
+ },
76
+ });
77
+ expect(
78
+ wrapper
79
+ .findComponent({
80
+ name: 'MultiSelect',
81
+ })
82
+ .attributes('display'),
83
+ ).toBe('chip');
84
+ });
85
+
86
+ it('displays comma-separated values by default', () => {
87
+ const wrapper = shallowMount(WtMultiSelect);
88
+ expect(
89
+ wrapper
90
+ .findComponent({
91
+ name: 'MultiSelect',
92
+ })
93
+ .attributes('display'),
94
+ ).toBe('comma');
95
+ });
96
+
97
+ it('emits hide when the dropdown hides', async () => {
98
+ const wrapper = shallowMount(WtMultiSelect);
99
+ await wrapper
100
+ .findComponent({
101
+ name: 'MultiSelect',
102
+ })
103
+ .vm.$emit('hide');
104
+ expect(wrapper.emitted().hide).toBeTruthy();
105
+ });
106
+ });
@@ -0,0 +1,111 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtPageHeader from '../wt-page-header.vue';
4
+
5
+ describe('WtPageHeader', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtPageHeader);
8
+ expect(wrapper.isVisible()).toBe(true);
9
+ });
10
+
11
+ it('renders default slot content in the title wrapper', () => {
12
+ const wrapper = mount(WtPageHeader, {
13
+ slots: {
14
+ default: 'Header content',
15
+ },
16
+ });
17
+ expect(wrapper.text()).toContain('Header content');
18
+ });
19
+
20
+ it('renders title slot content', () => {
21
+ const wrapper = mount(WtPageHeader, {
22
+ slots: {
23
+ title: 'Page title',
24
+ },
25
+ });
26
+ expect(wrapper.text()).toContain('Page title');
27
+ });
28
+
29
+ it('renders a default primary button labeled "Add" that emits primaryAction on click', async () => {
30
+ const primaryAction = vi.fn();
31
+ const wrapper = mount(WtPageHeader, {
32
+ props: {
33
+ primaryAction,
34
+ },
35
+ });
36
+ const [primaryButton] = wrapper.findAllComponents({
37
+ name: 'wt-button',
38
+ });
39
+ expect(primaryButton.text()).toBe('Add');
40
+
41
+ await primaryButton.trigger('click');
42
+ expect(primaryAction).toHaveBeenCalled();
43
+ });
44
+
45
+ it('uses custom primaryText and disables the primary button', () => {
46
+ const wrapper = mount(WtPageHeader, {
47
+ props: {
48
+ primaryText: 'Create',
49
+ primaryDisabled: true,
50
+ },
51
+ });
52
+ const [primaryButton] = wrapper.findAllComponents({
53
+ name: 'wt-button',
54
+ });
55
+ expect(primaryButton.text()).toBe('Create');
56
+ expect(primaryButton.attributes('disabled')).toBeDefined();
57
+ });
58
+
59
+ it('hides the primary button when hidePrimary is true', () => {
60
+ const wrapper = mount(WtPageHeader, {
61
+ props: {
62
+ hidePrimary: true,
63
+ },
64
+ });
65
+ expect(
66
+ wrapper.findAllComponents({
67
+ name: 'wt-button',
68
+ }).length,
69
+ ).toBe(0);
70
+ });
71
+
72
+ it('does not render a secondary button by default', () => {
73
+ const wrapper = mount(WtPageHeader);
74
+ expect(
75
+ wrapper.findAllComponents({
76
+ name: 'wt-button',
77
+ }).length,
78
+ ).toBe(1);
79
+ });
80
+
81
+ it('renders a secondary button when secondaryText or secondaryAction is provided', async () => {
82
+ const secondaryAction = vi.fn();
83
+ const wrapper = mount(WtPageHeader, {
84
+ props: {
85
+ secondaryAction,
86
+ },
87
+ });
88
+ const buttons = wrapper.findAllComponents({
89
+ name: 'wt-button',
90
+ });
91
+ expect(buttons.length).toBe(2);
92
+ expect(buttons[1].text()).toBe('Close');
93
+
94
+ await buttons[1].trigger('click');
95
+ expect(secondaryAction).toHaveBeenCalled();
96
+ });
97
+
98
+ it('hides the secondary button when hideSecondary is true even with secondaryText set', () => {
99
+ const wrapper = mount(WtPageHeader, {
100
+ props: {
101
+ hideSecondary: true,
102
+ secondaryText: 'Cancel',
103
+ },
104
+ });
105
+ expect(
106
+ wrapper.findAllComponents({
107
+ name: 'wt-button',
108
+ }).length,
109
+ ).toBe(1);
110
+ });
111
+ });
@@ -0,0 +1,107 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtPassword from '../wt-password.vue';
4
+
5
+ describe('WtPassword', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtPassword);
8
+ expect(wrapper.classes()).toContain('wt-password');
9
+ });
10
+
11
+ it('does not render a label when no label prop or slot is passed', () => {
12
+ const wrapper = shallowMount(WtPassword);
13
+ expect(
14
+ wrapper
15
+ .findComponent({
16
+ name: 'wt-label',
17
+ })
18
+ .exists(),
19
+ ).toBe(false);
20
+ });
21
+
22
+ it('renders the label text when passed', () => {
23
+ const wrapper = mount(WtPassword, {
24
+ props: {
25
+ label: 'Password',
26
+ },
27
+ });
28
+ expect(wrapper.find('.wt-label').text()).toBe('Password');
29
+ });
30
+
31
+ it('renders a mask toggle button by default', () => {
32
+ const wrapper = mount(WtPassword);
33
+ expect(
34
+ wrapper
35
+ .findComponent({
36
+ name: 'wt-icon-btn',
37
+ })
38
+ .exists(),
39
+ ).toBe(true);
40
+ });
41
+
42
+ it('does not render a mask toggle button when toggleMask is false', () => {
43
+ const wrapper = mount(WtPassword, {
44
+ props: {
45
+ toggleMask: false,
46
+ },
47
+ });
48
+ expect(
49
+ wrapper
50
+ .findComponent({
51
+ name: 'wt-icon-btn',
52
+ })
53
+ .exists(),
54
+ ).toBe(false);
55
+ });
56
+
57
+ it('toggles the input type and icon when the mask toggle is clicked', async () => {
58
+ const wrapper = mount(WtPassword);
59
+ const toggleBtn = wrapper.findComponent({
60
+ name: 'wt-icon-btn',
61
+ });
62
+ expect(toggleBtn.attributes('icon')).toBe('eye--opened');
63
+ expect(
64
+ wrapper
65
+ .findComponent({
66
+ name: 'Password',
67
+ })
68
+ .props('inputProps'),
69
+ ).toEqual({
70
+ type: 'password',
71
+ });
72
+
73
+ await toggleBtn.trigger('click');
74
+
75
+ expect(
76
+ wrapper
77
+ .findComponent({
78
+ name: 'wt-icon-btn',
79
+ })
80
+ .attributes('icon'),
81
+ ).toBe('eye--closed');
82
+ expect(
83
+ wrapper
84
+ .findComponent({
85
+ name: 'Password',
86
+ })
87
+ .props('inputProps'),
88
+ ).toEqual({
89
+ type: 'text',
90
+ });
91
+ });
92
+
93
+ it('passes disabled down to the underlying password input', () => {
94
+ const wrapper = mount(WtPassword, {
95
+ props: {
96
+ disabled: true,
97
+ },
98
+ });
99
+ expect(
100
+ wrapper
101
+ .findComponent({
102
+ name: 'Password',
103
+ })
104
+ .props('disabled'),
105
+ ).toBe(true);
106
+ });
107
+ });
@@ -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
  });