@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
@@ -2,9 +2,101 @@ import { shallowMount } from '@vue/test-utils';
2
2
 
3
3
  import WtItemLink from '../wt-item-link.vue';
4
4
 
5
+ const stubs = {
6
+ RouterLink: {
7
+ props: [
8
+ 'to',
9
+ 'target',
10
+ ],
11
+ template:
12
+ '<a :href="typeof to === \'string\' ? to : JSON.stringify(to)" :target="target"><slot /></a>',
13
+ },
14
+ };
15
+
5
16
  describe('WtItemLink', () => {
6
17
  it('renders a component', () => {
7
- const wrapper = shallowMount(WtItemLink);
18
+ const wrapper = shallowMount(WtItemLink, {
19
+ global: {
20
+ stubs,
21
+ },
22
+ });
8
23
  expect(wrapper.exists()).toBe(true);
9
24
  });
25
+
26
+ it('renders default slot content', () => {
27
+ const wrapper = shallowMount(WtItemLink, {
28
+ global: {
29
+ stubs,
30
+ },
31
+ slots: {
32
+ default: 'Link text',
33
+ },
34
+ });
35
+ expect(wrapper.text()).toBe('Link text');
36
+ });
37
+
38
+ it('uses the link prop as the route target when provided', () => {
39
+ const wrapper = shallowMount(WtItemLink, {
40
+ global: {
41
+ stubs,
42
+ },
43
+ props: {
44
+ link: '/directory/users/3',
45
+ },
46
+ });
47
+ expect(wrapper.attributes('href')).toBe('/directory/users/3');
48
+ });
49
+
50
+ it('builds a route from the deprecated routeName/id props when link is not provided', () => {
51
+ const wrapper = shallowMount(WtItemLink, {
52
+ global: {
53
+ stubs,
54
+ },
55
+ props: {
56
+ routeName: 'users',
57
+ id: 3,
58
+ },
59
+ });
60
+ expect(wrapper.attributes('href')).toBe(
61
+ JSON.stringify({
62
+ name: 'users-edit',
63
+ params: {
64
+ id: 3,
65
+ },
66
+ }),
67
+ );
68
+ });
69
+
70
+ it('applies the disabled class', () => {
71
+ const wrapper = shallowMount(WtItemLink, {
72
+ global: {
73
+ stubs,
74
+ },
75
+ props: {
76
+ disabled: true,
77
+ },
78
+ });
79
+ expect(wrapper.classes()).toContain('wt-item-link--disabled');
80
+ });
81
+
82
+ it('applies the invisible class', () => {
83
+ const wrapper = shallowMount(WtItemLink, {
84
+ global: {
85
+ stubs,
86
+ },
87
+ props: {
88
+ invisible: true,
89
+ },
90
+ });
91
+ expect(wrapper.classes()).toContain('wt-item-link--invisible');
92
+ });
93
+
94
+ it('defaults target to _self and forwards a custom target', () => {
95
+ const wrapper = shallowMount(WtItemLink, {
96
+ global: {
97
+ stubs,
98
+ },
99
+ });
100
+ expect(wrapper.attributes('target')).toBe('_self');
101
+ });
10
102
  });
@@ -1,4 +1,4 @@
1
- import { shallowMount } from '@vue/test-utils';
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
2
 
3
3
  import WtLabel from '../wt-label.vue';
4
4
 
@@ -7,4 +7,52 @@ describe('WtLabel', () => {
7
7
  const wrapper = shallowMount(WtLabel);
8
8
  expect(wrapper.classes('wt-label')).toBe(true);
9
9
  });
10
+
11
+ it('renders default slot content', () => {
12
+ const wrapper = shallowMount(WtLabel, {
13
+ slots: {
14
+ default: 'Field label',
15
+ },
16
+ });
17
+ expect(wrapper.text()).toContain('Field label');
18
+ });
19
+
20
+ it('applies disabled/invalid/required modifier classes', () => {
21
+ const wrapper = shallowMount(WtLabel, {
22
+ props: {
23
+ disabled: true,
24
+ invalid: true,
25
+ required: true,
26
+ },
27
+ });
28
+ expect(wrapper.classes()).toContain('wt-label--disabled');
29
+ expect(wrapper.classes()).toContain('wt-label--invalid');
30
+ expect(wrapper.classes()).toContain('wt-label--required');
31
+ });
32
+
33
+ it('does not render a hint by default', () => {
34
+ const wrapper = shallowMount(WtLabel);
35
+ expect(
36
+ wrapper
37
+ .findComponent({
38
+ name: 'wt-hint',
39
+ })
40
+ .exists(),
41
+ ).toBe(false);
42
+ });
43
+
44
+ it('renders a hint when the hint prop is passed', async () => {
45
+ const wrapper = mount(WtLabel, {
46
+ props: {
47
+ hint: 'Extra info',
48
+ },
49
+ });
50
+ const hint = wrapper.findComponent({
51
+ name: 'wt-hint',
52
+ });
53
+ expect(hint.exists()).toBe(true);
54
+
55
+ await hint.find('.wt-tooltip__activator').trigger('mouseenter');
56
+ expect(wrapper.text()).toContain('Extra info');
57
+ });
10
58
  });
@@ -7,4 +7,53 @@ describe('WtLoadBar', () => {
7
7
  const wrapper = shallowMount(WtLoadBar);
8
8
  expect(wrapper.exists()).toBe(true);
9
9
  });
10
+
11
+ it('renders 0% width by default', () => {
12
+ const wrapper = shallowMount(WtLoadBar);
13
+ expect(wrapper.find('.wt-load-bar__progress').attributes('style')).toBe(
14
+ 'width: 0%;',
15
+ );
16
+ });
17
+
18
+ it('computes progress width as a percentage of value/max', () => {
19
+ const wrapper = shallowMount(WtLoadBar, {
20
+ props: {
21
+ value: 25,
22
+ max: 50,
23
+ },
24
+ });
25
+ expect(wrapper.find('.wt-load-bar__progress').attributes('style')).toBe(
26
+ 'width: 50%;',
27
+ );
28
+ });
29
+
30
+ // NOTE: progressWidth references `this.isOverflow`, which is never defined
31
+ // (no such data/computed property exists), so it's always undefined/falsy.
32
+ // Progress width is therefore never clamped to 100 and can overflow past
33
+ // it when value > max — documenting the current (likely unintended) behavior.
34
+ it('does not clamp progress width when value exceeds max', () => {
35
+ const wrapper = shallowMount(WtLoadBar, {
36
+ props: {
37
+ value: 150,
38
+ max: 100,
39
+ },
40
+ });
41
+ expect(wrapper.find('.wt-load-bar__progress').attributes('style')).toBe(
42
+ 'width: 150%;',
43
+ );
44
+ });
45
+
46
+ it('applies the default primary color class', () => {
47
+ const wrapper = shallowMount(WtLoadBar);
48
+ expect(wrapper.classes()).toContain('wt-load-bar--color-primary');
49
+ });
50
+
51
+ it('applies a custom color class', () => {
52
+ const wrapper = shallowMount(WtLoadBar, {
53
+ props: {
54
+ color: 'error',
55
+ },
56
+ });
57
+ expect(wrapper.classes()).toContain('wt-load-bar--color-error');
58
+ });
10
59
  });
@@ -1,4 +1,4 @@
1
- import { shallowMount } from '@vue/test-utils';
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
2
 
3
3
  import WtLoader from '../wt-loader.vue';
4
4
 
@@ -7,4 +7,29 @@ describe('WtLoader', () => {
7
7
  const wrapper = shallowMount(WtLoader);
8
8
  expect(wrapper.classes('wt-loader')).toBe(true);
9
9
  });
10
+
11
+ it('renders the brand loader by default (size md)', () => {
12
+ const wrapper = mount(WtLoader);
13
+ expect(wrapper.classes()).toContain('wt-brand-loader');
14
+ });
15
+
16
+ it('renders the spinner loader for non-md sizes', () => {
17
+ const wrapper = mount(WtLoader, {
18
+ props: {
19
+ size: 'sm',
20
+ },
21
+ });
22
+ expect(wrapper.classes()).toContain('wt-spinner-loader');
23
+ expect(wrapper.classes()).toContain('wt-spinner-loader--sm');
24
+ });
25
+
26
+ it('applies the color to the spinner loader', () => {
27
+ const wrapper = mount(WtLoader, {
28
+ props: {
29
+ size: 'xs',
30
+ color: 'icon',
31
+ },
32
+ });
33
+ expect(wrapper.classes()).toContain('wt-spinner-loader--icon');
34
+ });
10
35
  });
@@ -0,0 +1,55 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import WtLogo from '../wt-logo.vue';
4
+
5
+ describe('WtLogo', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtLogo);
8
+ expect(wrapper.exists()).toBeTruthy();
9
+ });
10
+
11
+ it('renders an anchor with logoHref by default', () => {
12
+ const wrapper = shallowMount(WtLogo, {
13
+ props: {
14
+ logoHref: 'https://example.com',
15
+ },
16
+ });
17
+ expect(wrapper.element.tagName).toBe('A');
18
+ expect(wrapper.attributes('href')).toBe('https://example.com');
19
+ });
20
+
21
+ it('renders a router-link when logoRoute is provided', () => {
22
+ const wrapper = shallowMount(WtLogo, {
23
+ props: {
24
+ logoRoute: '/home',
25
+ },
26
+ global: {
27
+ stubs: {
28
+ RouterLink: {
29
+ props: [
30
+ 'to',
31
+ ],
32
+ template: '<a :href="to"><slot /></a>',
33
+ },
34
+ },
35
+ },
36
+ });
37
+ expect(wrapper.attributes('href')).toBe('/home');
38
+ });
39
+
40
+ it('renders a plain span with no link attrs when disabled', () => {
41
+ const wrapper = shallowMount(WtLogo, {
42
+ props: {
43
+ disabled: true,
44
+ logoHref: 'https://example.com',
45
+ },
46
+ });
47
+ expect(wrapper.element.tagName).toBe('SPAN');
48
+ expect(wrapper.attributes('href')).toBeUndefined();
49
+ });
50
+
51
+ it('renders the logo image', () => {
52
+ const wrapper = shallowMount(WtLogo);
53
+ expect(wrapper.find('img.wt-logo').attributes('alt')).toBe('Webitel');
54
+ });
55
+ });
@@ -0,0 +1,30 @@
1
+ import { mount } from '@vue/test-utils';
2
+
3
+ import WtMenubar from '../wt-menubar.vue';
4
+
5
+ describe('WtMenubar', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = mount(WtMenubar);
8
+ expect(wrapper.classes()).toContain('wt-menubar');
9
+ });
10
+
11
+ it('forwards named slots through to PMenubar, excluding default', () => {
12
+ const wrapper = mount(WtMenubar, {
13
+ slots: {
14
+ start: 'Start content',
15
+ end: 'End content',
16
+ },
17
+ });
18
+ expect(wrapper.text()).toContain('Start content');
19
+ expect(wrapper.text()).toContain('End content');
20
+ });
21
+
22
+ it('does not render default slot content', () => {
23
+ const wrapper = mount(WtMenubar, {
24
+ slots: {
25
+ default: 'Default content',
26
+ },
27
+ });
28
+ expect(wrapper.text()).not.toContain('Default content');
29
+ });
30
+ });
@@ -0,0 +1,46 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import { MessageColor, MessageVariant } from '../../../enums';
4
+ import WtMessage from '../wt-message.vue';
5
+
6
+ describe('WtMessage', () => {
7
+ it('renders a component', () => {
8
+ const wrapper = shallowMount(WtMessage);
9
+ expect(
10
+ wrapper
11
+ .findComponent({
12
+ name: 'Message',
13
+ })
14
+ .exists(),
15
+ ).toBe(true);
16
+ });
17
+
18
+ it('applies default color, variant and size', () => {
19
+ const wrapper = shallowMount(WtMessage);
20
+ expect(wrapper.attributes('severity')).toBe(MessageColor.SECONDARY);
21
+ expect(wrapper.attributes('variant')).toBe(MessageVariant.FILLED);
22
+ expect(wrapper.attributes('size')).toBe('normal');
23
+ });
24
+
25
+ it('maps custom color, variant and size props', () => {
26
+ const wrapper = shallowMount(WtMessage, {
27
+ props: {
28
+ color: MessageColor.ERROR,
29
+ variant: MessageVariant.SIMPLE,
30
+ size: 'sm',
31
+ },
32
+ });
33
+ expect(wrapper.attributes('severity')).toBe(MessageColor.ERROR);
34
+ expect(wrapper.attributes('variant')).toBe(MessageVariant.SIMPLE);
35
+ expect(wrapper.attributes('size')).toBe('small');
36
+ });
37
+
38
+ it('renders default slot content', () => {
39
+ const wrapper = mount(WtMessage, {
40
+ slots: {
41
+ default: 'Something happened',
42
+ },
43
+ });
44
+ expect(wrapper.text()).toContain('Something happened');
45
+ });
46
+ });
@@ -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
+ });