@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,117 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtBreadcrumb from '../wt-breadcrumb.vue';
4
+
5
+ describe('WtBreadcrumb', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtBreadcrumb, {
8
+ props: {
9
+ path: [],
10
+ },
11
+ });
12
+ expect(wrapper.isVisible()).toBe(true);
13
+ });
14
+
15
+ it('renders an item for each path entry', () => {
16
+ const path = [
17
+ {
18
+ name: 'directory',
19
+ },
20
+ {
21
+ name: 'users',
22
+ route: '/directory/users',
23
+ },
24
+ ];
25
+ const wrapper = mount(WtBreadcrumb, {
26
+ props: {
27
+ path,
28
+ },
29
+ global: {
30
+ stubs: {
31
+ RouterLink: {
32
+ template: '<a><slot /></a>',
33
+ },
34
+ },
35
+ },
36
+ });
37
+ const items = wrapper.findAll('.wt-breadcrumb__text');
38
+ expect(items.length).toBe(path.length);
39
+ expect(items[0].text()).toBe('directory');
40
+ expect(items[1].text()).toBe('users');
41
+ });
42
+
43
+ it('renders a router-link for items with a route', () => {
44
+ const path = [
45
+ {
46
+ name: 'directory',
47
+ },
48
+ {
49
+ name: 'users',
50
+ route: '/directory/users',
51
+ },
52
+ ];
53
+ const wrapper = mount(WtBreadcrumb, {
54
+ props: {
55
+ path,
56
+ },
57
+ global: {
58
+ stubs: {
59
+ RouterLink: {
60
+ template: '<a><slot /></a>',
61
+ },
62
+ },
63
+ },
64
+ });
65
+ const links = wrapper.findAll('a');
66
+ expect(links.length).toBe(1);
67
+ expect(links[0].text()).toBe('users');
68
+ });
69
+
70
+ it('renders a plain span for items without a route', () => {
71
+ const path = [
72
+ {
73
+ name: 'directory',
74
+ },
75
+ ];
76
+ const wrapper = mount(WtBreadcrumb, {
77
+ props: {
78
+ path,
79
+ },
80
+ global: {
81
+ stubs: {
82
+ RouterLink: {
83
+ template: '<a><slot /></a>',
84
+ },
85
+ },
86
+ },
87
+ });
88
+ expect(wrapper.find('span.wt-breadcrumb__text').exists()).toBe(true);
89
+ expect(wrapper.find('a').exists()).toBe(false);
90
+ });
91
+
92
+ it('marks the last item with the last modifier class', () => {
93
+ const path = [
94
+ {
95
+ name: 'directory',
96
+ },
97
+ {
98
+ name: 'users',
99
+ },
100
+ ];
101
+ const wrapper = mount(WtBreadcrumb, {
102
+ props: {
103
+ path,
104
+ },
105
+ global: {
106
+ stubs: {
107
+ RouterLink: {
108
+ template: '<a><slot /></a>',
109
+ },
110
+ },
111
+ },
112
+ });
113
+ const items = wrapper.findAll('.wt-breadcrumb__text');
114
+ expect(items.at(-1).classes()).toContain('wt-breadcrumb__text--last');
115
+ expect(items[0].classes()).not.toContain('wt-breadcrumb__text--last');
116
+ });
117
+ });
@@ -1,6 +1,6 @@
1
1
  import { mount, shallowMount } from '@vue/test-utils';
2
2
 
3
- import WtSelectButton from '../wt-button-select.vue';
3
+ import WtButtonSelect from '../wt-button-select.vue';
4
4
 
5
5
  // helps to mock @floating-ui/vue autoUpdate method
6
6
  global.ResizeObserver = vi.fn().mockImplementation(() => ({
@@ -9,9 +9,9 @@ global.ResizeObserver = vi.fn().mockImplementation(() => ({
9
9
  disconnect: vi.fn(),
10
10
  }));
11
11
 
12
- describe('WtSelectButton', () => {
12
+ describe('WtButtonSelect', () => {
13
13
  it('renders a component', () => {
14
- const wrapper = shallowMount(WtSelectButton, {
14
+ const wrapper = shallowMount(WtButtonSelect, {
15
15
  props: {
16
16
  options: [],
17
17
  },
@@ -21,7 +21,7 @@ describe('WtSelectButton', () => {
21
21
 
22
22
  it('renders a button content via default slot', () => {
23
23
  const content = 'button content';
24
- const wrapper = mount(WtSelectButton, {
24
+ const wrapper = mount(WtButtonSelect, {
25
25
  props: {
26
26
  options: [],
27
27
  },
@@ -33,7 +33,7 @@ describe('WtSelectButton', () => {
33
33
  });
34
34
 
35
35
  it('emits click from main action button', async () => {
36
- const wrapper = shallowMount(WtSelectButton, {
36
+ const wrapper = shallowMount(WtButtonSelect, {
37
37
  props: {
38
38
  options: [],
39
39
  },
@@ -42,4 +42,36 @@ describe('WtSelectButton', () => {
42
42
  await wrapper.find('.wt-button-select__button').trigger('click');
43
43
  expect(wrapper.emitted().click).toBeTruthy();
44
44
  });
45
+
46
+ it('passes disabled prop down to the main action button', () => {
47
+ const wrapper = shallowMount(WtButtonSelect, {
48
+ props: {
49
+ options: [],
50
+ disabled: true,
51
+ },
52
+ });
53
+ expect(
54
+ wrapper
55
+ .findComponent({
56
+ name: 'wt-button',
57
+ })
58
+ .props('disabled'),
59
+ ).toBe(true);
60
+ });
61
+
62
+ it('passes color prop down to the main action button', () => {
63
+ const wrapper = shallowMount(WtButtonSelect, {
64
+ props: {
65
+ options: [],
66
+ color: 'secondary',
67
+ },
68
+ });
69
+ expect(
70
+ wrapper
71
+ .findComponent({
72
+ name: 'wt-button',
73
+ })
74
+ .props('color'),
75
+ ).toBe('secondary');
76
+ });
45
77
  });
@@ -0,0 +1,84 @@
1
+ import { mount } from '@vue/test-utils';
2
+
3
+ import { ConnectionQualityLevels } from '../../../enums';
4
+ import WtCallMediaMetric from '../wt-call-media-metric.vue';
5
+
6
+ describe('WtCallMediaMetric', () => {
7
+ it('renders nothing when neither quality nor mosAvg is provided', () => {
8
+ const wrapper = mount(WtCallMediaMetric);
9
+ expect(
10
+ wrapper
11
+ .findComponent({
12
+ name: 'wt-icon',
13
+ })
14
+ .exists(),
15
+ ).toBe(false);
16
+ });
17
+
18
+ it('renders an icon matching the quality prop when provided directly', () => {
19
+ const wrapper = mount(WtCallMediaMetric, {
20
+ props: {
21
+ quality: ConnectionQualityLevels.High,
22
+ },
23
+ });
24
+ expect(
25
+ wrapper
26
+ .findComponent({
27
+ name: 'wt-icon',
28
+ })
29
+ .props('icon'),
30
+ ).toBe(`ws-signal-${ConnectionQualityLevels.High}`);
31
+ });
32
+
33
+ it('derives quality from mosAvg when quality is not provided', () => {
34
+ const wrapper = mount(WtCallMediaMetric, {
35
+ props: {
36
+ mosAvg: 4.5,
37
+ },
38
+ });
39
+ expect(
40
+ wrapper
41
+ .findComponent({
42
+ name: 'wt-icon',
43
+ })
44
+ .props('icon'),
45
+ ).toBe(`ws-signal-${ConnectionQualityLevels.High}`);
46
+ });
47
+
48
+ it('quality prop takes precedence over mosAvg', () => {
49
+ const wrapper = mount(WtCallMediaMetric, {
50
+ props: {
51
+ quality: ConnectionQualityLevels.Low,
52
+ mosAvg: 4.5,
53
+ },
54
+ });
55
+ expect(
56
+ wrapper
57
+ .findComponent({
58
+ name: 'wt-icon',
59
+ })
60
+ .props('icon'),
61
+ ).toBe(`ws-signal-${ConnectionQualityLevels.Low}`);
62
+ });
63
+
64
+ it('renders nothing when mosAvg does not resolve to a quality', () => {
65
+ const wrapper = mount(WtCallMediaMetric);
66
+ expect(wrapper.html()).toBe('<!--v-if-->');
67
+ });
68
+
69
+ it('passes size prop down to the icon', () => {
70
+ const wrapper = mount(WtCallMediaMetric, {
71
+ props: {
72
+ quality: ConnectionQualityLevels.Medium,
73
+ size: 'lg',
74
+ },
75
+ });
76
+ expect(
77
+ wrapper
78
+ .findComponent({
79
+ name: 'wt-icon',
80
+ })
81
+ .props('size'),
82
+ ).toBe('lg');
83
+ });
84
+ });
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import WtCard from '../wt-card.vue';
4
+
5
+ describe('WtCard', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtCard);
8
+ expect(wrapper.classes('wt-card')).toBe(true);
9
+ });
10
+
11
+ it('renders content via default slot', () => {
12
+ const content = 'card content';
13
+ const wrapper = shallowMount(WtCard, {
14
+ slots: {
15
+ default: content,
16
+ },
17
+ });
18
+ expect(wrapper.text()).toContain(content);
19
+ });
20
+ });
@@ -49,4 +49,67 @@ describe('WtCheckbox', () => {
49
49
  !selected,
50
50
  ]);
51
51
  });
52
+
53
+ it('treats array model value as multi-select and checks by value membership', () => {
54
+ const wrapper = mount(WtCheckbox, {
55
+ stubs: {
56
+ WtLabel,
57
+ WtIcon,
58
+ },
59
+ props: {
60
+ value: 'b',
61
+ selected: [
62
+ 'a',
63
+ 'b',
64
+ ],
65
+ },
66
+ });
67
+ expect(wrapper.find('input[type="checkbox"]').element.checked).toBe(true);
68
+ });
69
+
70
+ it('is not checked when value is not present in array model', () => {
71
+ const wrapper = mount(WtCheckbox, {
72
+ stubs: {
73
+ WtLabel,
74
+ WtIcon,
75
+ },
76
+ props: {
77
+ value: 'c',
78
+ selected: [
79
+ 'a',
80
+ 'b',
81
+ ],
82
+ },
83
+ });
84
+ expect(wrapper.find('input[type="checkbox"]').element.checked).toBe(false);
85
+ });
86
+
87
+ it('does not render a label when no label prop or slot is passed', () => {
88
+ const wrapper = mount(WtCheckbox, {
89
+ stubs: {
90
+ WtLabel,
91
+ WtIcon,
92
+ },
93
+ props: {
94
+ selected: false,
95
+ },
96
+ });
97
+ expect(wrapper.findComponent(WtLabel).exists()).toBe(false);
98
+ });
99
+
100
+ it('disables the underlying checkbox when disabled prop is true', () => {
101
+ const wrapper = mount(WtCheckbox, {
102
+ stubs: {
103
+ WtLabel,
104
+ WtIcon,
105
+ },
106
+ props: {
107
+ selected: false,
108
+ disabled: true,
109
+ },
110
+ });
111
+ expect(
112
+ wrapper.find('input[type="checkbox"]').attributes('disabled'),
113
+ ).toBeDefined();
114
+ });
52
115
  });
@@ -17,4 +17,36 @@ describe('WtChip', () => {
17
17
  });
18
18
  expect(wrapper.text()).toContain(content);
19
19
  });
20
+
21
+ it('applies the default main color class', () => {
22
+ const wrapper = shallowMount(WtChip);
23
+ expect(wrapper.classes()).toContain('p-chip-main');
24
+ });
25
+
26
+ it('applies a custom color class', () => {
27
+ const wrapper = shallowMount(WtChip, {
28
+ props: {
29
+ color: 'danger',
30
+ },
31
+ });
32
+ expect(wrapper.classes()).toContain('p-chip-danger');
33
+ });
34
+
35
+ it('does not render a remove button by default', () => {
36
+ const wrapper = mount(WtChip);
37
+ expect(wrapper.find('.wt-chip__close-icon').exists()).toBe(false);
38
+ });
39
+
40
+ it('renders a remove button and emits remove when removable', async () => {
41
+ const wrapper = mount(WtChip, {
42
+ props: {
43
+ removable: true,
44
+ },
45
+ });
46
+ const closeIcon = wrapper.find('.wt-chip__close-icon');
47
+ expect(closeIcon.exists()).toBe(true);
48
+
49
+ await closeIcon.trigger('click');
50
+ expect(wrapper.emitted().remove).toBeTruthy();
51
+ });
20
52
  });
@@ -0,0 +1,92 @@
1
+ import { flushPromises, mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtConfirmDialog from '../wt-confirm-dialog.vue';
4
+
5
+ describe('WtConfirmDialog', () => {
6
+ it('renders a component with the given title', () => {
7
+ const wrapper = mount(WtConfirmDialog, {
8
+ props: {
9
+ title: 'Delete item?',
10
+ callback: vi.fn(),
11
+ },
12
+ });
13
+ expect(wrapper.classes()).toContain('wt-confirm-dialog');
14
+ expect(wrapper.text()).toContain('Delete item?');
15
+ });
16
+
17
+ it('renders the custom delete message when provided', () => {
18
+ const wrapper = mount(WtConfirmDialog, {
19
+ props: {
20
+ title: 'Delete item?',
21
+ deleteMessage: 'Are you absolutely sure?',
22
+ callback: vi.fn(),
23
+ },
24
+ });
25
+ expect(wrapper.text()).toContain('Are you absolutely sure?');
26
+ });
27
+
28
+ it('emits close when the popup emits close', async () => {
29
+ const wrapper = shallowMount(WtConfirmDialog, {
30
+ props: {
31
+ title: 'Delete item?',
32
+ callback: vi.fn(),
33
+ },
34
+ });
35
+ await wrapper
36
+ .findComponent({
37
+ name: 'wt-popup',
38
+ })
39
+ .vm.$emit('close');
40
+ expect(wrapper.emitted().close).toBeTruthy();
41
+ });
42
+
43
+ it('emits close when cancel action button is clicked', async () => {
44
+ const wrapper = mount(WtConfirmDialog, {
45
+ props: {
46
+ title: 'Delete item?',
47
+ callback: vi.fn(),
48
+ },
49
+ });
50
+ const [cancelButton] = wrapper.findAllComponents({
51
+ name: 'wt-button',
52
+ });
53
+ await cancelButton.trigger('click');
54
+ expect(wrapper.emitted().close).toBeTruthy();
55
+ });
56
+
57
+ it('calls callback and emits close when confirm action button is clicked', async () => {
58
+ const callback = vi.fn().mockResolvedValue();
59
+ const wrapper = mount(WtConfirmDialog, {
60
+ props: {
61
+ title: 'Delete item?',
62
+ callback,
63
+ },
64
+ });
65
+ const [, confirmButton] = wrapper.findAllComponents({
66
+ name: 'wt-button',
67
+ });
68
+ await confirmButton.trigger('click');
69
+ await flushPromises();
70
+
71
+ expect(callback).toHaveBeenCalled();
72
+ expect(wrapper.emitted().close).toBeTruthy();
73
+ });
74
+
75
+ it('exposes isDeleting and confirm/close via the actions slot', () => {
76
+ const callback = vi.fn().mockResolvedValue();
77
+ const wrapper = mount(WtConfirmDialog, {
78
+ props: {
79
+ title: 'Delete item?',
80
+ callback,
81
+ },
82
+ slots: {
83
+ actions: `<template #actions="{ isDeleting, confirm, close }">
84
+ <span class="slot-check">{{ typeof isDeleting }}-{{ typeof confirm }}-{{ typeof close }}</span>
85
+ </template>`,
86
+ },
87
+ });
88
+ expect(wrapper.find('.slot-check').text()).toBe(
89
+ 'boolean-function-function',
90
+ );
91
+ });
92
+ });
@@ -1,7 +1,51 @@
1
- import { shallowMount } from '@vue/test-utils';
1
+ import { flushPromises, mount, shallowMount } from '@vue/test-utils';
2
2
 
3
+ import WtPopover from '../../wt-popover/wt-popover.vue';
3
4
  import WtContextMenu from '../wt-context-menu.vue';
4
5
 
6
+ global.ResizeObserver = vi.fn().mockImplementation(() => ({
7
+ observe: vi.fn(),
8
+ unobserve: vi.fn(),
9
+ disconnect: vi.fn(),
10
+ }));
11
+
12
+ /**
13
+ * wt-popover doesn't wire the `visible` prop through to PrimeVue's Popover — the
14
+ * panel only opens via the activator slot's imperative `show()`. Since the panel
15
+ * content is teleported to document.body, tests attach to the body and open it
16
+ * through a real activator before asserting on the option list.
17
+ */
18
+ const mountOpen = (props) => {
19
+ const TestHost = {
20
+ components: {
21
+ WtContextMenu,
22
+ },
23
+ props: [
24
+ 'options',
25
+ 'disabled',
26
+ ],
27
+ template: `
28
+ <WtContextMenu ref="contextMenu" :options="options" :disabled="disabled">
29
+ <template #activator="{ show }">
30
+ <button class="opener" @click="show">open</button>
31
+ </template>
32
+ </WtContextMenu>
33
+ `,
34
+ };
35
+ return mount(TestHost, {
36
+ props,
37
+ attachTo: document.body,
38
+ global: {
39
+ stubs: {
40
+ WtPopover: false,
41
+ },
42
+ components: {
43
+ WtPopover,
44
+ },
45
+ },
46
+ });
47
+ };
48
+
5
49
  describe('WtContextMenu', () => {
6
50
  it('renders a component', () => {
7
51
  const wrapper = shallowMount(WtContextMenu, {
@@ -11,4 +55,105 @@ describe('WtContextMenu', () => {
11
55
  });
12
56
  expect(wrapper.classes('wt-context-menu')).toBe(true);
13
57
  });
58
+
59
+ it('renders an option for each entry once opened', async () => {
60
+ const options = [
61
+ {
62
+ text: 'Option 1',
63
+ },
64
+ {
65
+ text: 'Option 2',
66
+ },
67
+ ];
68
+ const wrapper = mountOpen({
69
+ options,
70
+ });
71
+ await flushPromises();
72
+ await wrapper.find('.opener').trigger('click');
73
+ await flushPromises();
74
+
75
+ const items = document.body.querySelectorAll('.wt-context-menu__option');
76
+ expect(items.length).toBe(options.length);
77
+ expect(items[0].textContent.trim()).toBe('Option 1');
78
+ expect(items[1].textContent.trim()).toBe('Option 2');
79
+
80
+ wrapper.unmount();
81
+ });
82
+
83
+ it('renders plain string options via their string value', async () => {
84
+ const options = [
85
+ 'Foo',
86
+ 'Bar',
87
+ ];
88
+ const wrapper = mountOpen({
89
+ options,
90
+ });
91
+ await flushPromises();
92
+ await wrapper.find('.opener').trigger('click');
93
+ await flushPromises();
94
+
95
+ const items = document.body.querySelectorAll('.wt-context-menu__option');
96
+ expect(items[0].textContent.trim()).toBe('Foo');
97
+ expect(items[1].textContent.trim()).toBe('Bar');
98
+
99
+ wrapper.unmount();
100
+ });
101
+
102
+ it('emits click with the option and index when an option is clicked', async () => {
103
+ const options = [
104
+ {
105
+ text: 'Option 1',
106
+ },
107
+ {
108
+ text: 'Option 2',
109
+ },
110
+ ];
111
+ const wrapper = mountOpen({
112
+ options,
113
+ });
114
+ await flushPromises();
115
+ await wrapper.find('.opener').trigger('click');
116
+ await flushPromises();
117
+
118
+ document.body.querySelectorAll('.wt-context-menu__option')[1].click();
119
+ await flushPromises();
120
+
121
+ const contextMenu = wrapper.findComponent({
122
+ ref: 'contextMenu',
123
+ });
124
+ expect(contextMenu.emitted().click[0]).toEqual([
125
+ {
126
+ option: options[1],
127
+ index: 1,
128
+ },
129
+ ]);
130
+
131
+ wrapper.unmount();
132
+ });
133
+
134
+ it('applies the disabled modifier class to disabled options', async () => {
135
+ const options = [
136
+ {
137
+ text: 'Option 1',
138
+ disabled: true,
139
+ },
140
+ {
141
+ text: 'Option 2',
142
+ },
143
+ ];
144
+ const wrapper = mountOpen({
145
+ options,
146
+ });
147
+ await flushPromises();
148
+ await wrapper.find('.opener').trigger('click');
149
+ await flushPromises();
150
+
151
+ const items = document.body.querySelectorAll('.wt-context-menu__option');
152
+ expect(items[0].classList).toContain('wt-context-menu__option--disabled');
153
+ expect(items[1].classList).not.toContain(
154
+ 'wt-context-menu__option--disabled',
155
+ );
156
+
157
+ wrapper.unmount();
158
+ });
14
159
  });
@@ -0,0 +1,57 @@
1
+ import { flushPromises, shallowMount } from '@vue/test-utils';
2
+
3
+ vi.mock('clipboard-copy', () => ({
4
+ default: vi.fn().mockResolvedValue(),
5
+ }));
6
+
7
+ import copy from 'clipboard-copy';
8
+ import WtCopyAction from '../wt-copy-action.vue';
9
+
10
+ describe('WtCopyAction', () => {
11
+ beforeEach(() => {
12
+ vi.useFakeTimers();
13
+ copy.mockClear();
14
+ });
15
+
16
+ afterEach(() => {
17
+ vi.useRealTimers();
18
+ });
19
+
20
+ it('renders a component', () => {
21
+ const wrapper = shallowMount(WtCopyAction);
22
+ expect(wrapper.classes()).toContain('copy-action');
23
+ });
24
+
25
+ it('renders the copy icon by default', () => {
26
+ const wrapper = shallowMount(WtCopyAction);
27
+ expect(wrapper.attributes('icon')).toBe('copy');
28
+ });
29
+
30
+ it('copies the value prop when clicked', async () => {
31
+ const wrapper = shallowMount(WtCopyAction, {
32
+ props: {
33
+ value: 'hello world',
34
+ },
35
+ });
36
+ await wrapper.trigger('click');
37
+ await flushPromises();
38
+ expect(copy).toHaveBeenCalledWith('hello world');
39
+ });
40
+
41
+ it('shows the done icon after copying, then reverts after the timeout', async () => {
42
+ const wrapper = shallowMount(WtCopyAction, {
43
+ props: {
44
+ value: 'hello world',
45
+ },
46
+ });
47
+ await wrapper.trigger('click');
48
+ await flushPromises();
49
+
50
+ expect(wrapper.attributes('icon')).toBe('done');
51
+
52
+ vi.advanceTimersByTime(1500);
53
+ await wrapper.vm.$nextTick();
54
+
55
+ expect(wrapper.attributes('icon')).toBe('copy');
56
+ });
57
+ });