@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
@@ -1,22 +1,93 @@
1
- import { shallowMount } from '@vue/test-utils';
1
+ import { flushPromises, mount, shallowMount } from '@vue/test-utils';
2
2
 
3
+ import WtTableActions from '../../wt-table-actions/wt-table-actions.vue';
3
4
  import FiltersPanelWrapper from '../wt-filters-panel-wrapper.vue';
4
5
 
6
+ const mountWithTableActions = (options) =>
7
+ mount(FiltersPanelWrapper, {
8
+ ...options,
9
+ global: {
10
+ ...options?.global,
11
+ stubs: {
12
+ WtTableActions: false,
13
+ ...options?.global?.stubs,
14
+ },
15
+ components: {
16
+ WtTableActions,
17
+ ...options?.global?.components,
18
+ },
19
+ },
20
+ });
21
+
5
22
  describe('Filters Panel Wrapper', () => {
6
23
  it('renders a component', () => {
7
24
  const wrapper = shallowMount(FiltersPanelWrapper);
8
25
  expect(wrapper.exists()).toBe(true);
9
26
  });
10
- it('emits "reset" event at wt-table-actions "filterReset" event', () => {
11
- const wrapper = shallowMount(FiltersPanelWrapper);
12
- wrapper.vm.tableActionsHandler('filterReset');
27
+
28
+ it('renders default slot content in the filters wrap', () => {
29
+ const wrapper = shallowMount(FiltersPanelWrapper, {
30
+ slots: {
31
+ default: 'Filter fields',
32
+ },
33
+ });
34
+ expect(wrapper.find('.filters-wrap').text()).toBe('Filter fields');
35
+ });
36
+
37
+ it('emits "reset" event when wt-table-actions emits input with "filterReset"', async () => {
38
+ const wrapper = mountWithTableActions();
39
+ await flushPromises();
40
+ await wrapper
41
+ .findComponent({
42
+ name: 'wt-table-actions',
43
+ })
44
+ .vm.$emit('input', 'filterReset');
13
45
  expect(wrapper.emitted().reset).toBeTruthy();
14
46
  });
15
- it(`toggles "filters-panel-wrapper--opened" class at
16
- wt-table-actions "settings" event`, async () => {
17
- const wrapper = shallowMount(FiltersPanelWrapper);
18
- const toggleSpy = vi.spyOn(wrapper.vm, 'toggleFiltersExpansion');
19
- wrapper.vm.tableActionsHandler('settings');
20
- expect(toggleSpy).toHaveBeenCalled();
47
+
48
+ // NOTE: the "opened" class is bound to the `isOpened` prop in the template, but
49
+ // toggleFiltersExpansion (triggered by the "settings" table action) mutates the
50
+ // separate `localIsOpened` data property, which nothing reads. So this handler
51
+ // currently has no visible effect on the rendered class — asserting that as the
52
+ // actual current behavior rather than the presumably-intended toggle.
53
+ it('does not change "filters-panel-wrapper--opened" class when wt-table-actions emits input with "settings"', async () => {
54
+ const wrapper = mountWithTableActions();
55
+ await flushPromises();
56
+ expect(wrapper.classes()).not.toContain('filters-panel-wrapper--opened');
57
+
58
+ await wrapper
59
+ .findComponent({
60
+ name: 'wt-table-actions',
61
+ })
62
+ .vm.$emit('input', 'settings');
63
+ expect(wrapper.classes()).not.toContain('filters-panel-wrapper--opened');
64
+ });
65
+
66
+ it('starts opened when isOpened prop is true', () => {
67
+ const wrapper = shallowMount(FiltersPanelWrapper, {
68
+ props: {
69
+ isOpened: true,
70
+ },
71
+ });
72
+ expect(wrapper.classes()).toContain('filters-panel-wrapper--opened');
73
+ });
74
+
75
+ it('passes tableActionIcons down to wt-table-actions', async () => {
76
+ const icons = [
77
+ 'filter-reset',
78
+ ];
79
+ const wrapper = mountWithTableActions({
80
+ props: {
81
+ tableActionIcons: icons,
82
+ },
83
+ });
84
+ await flushPromises();
85
+ expect(
86
+ wrapper
87
+ .findComponent({
88
+ name: 'wt-table-actions',
89
+ })
90
+ .props('icons'),
91
+ ).toEqual(icons);
21
92
  });
22
93
  });
@@ -1,4 +1,4 @@
1
- import { shallowMount } from '@vue/test-utils';
1
+ import { flushPromises, mount, shallowMount } from '@vue/test-utils';
2
2
 
3
3
  import WtHint from '../wt-hint.vue';
4
4
 
@@ -7,4 +7,47 @@ describe('WtHint', () => {
7
7
  const wrapper = shallowMount(WtHint);
8
8
  expect(wrapper.isVisible()).toBe(true);
9
9
  });
10
+
11
+ it('renders the default info icon color', async () => {
12
+ const wrapper = mount(WtHint);
13
+ await flushPromises();
14
+ expect(
15
+ wrapper
16
+ .findComponent({
17
+ name: 'wt-icon-btn',
18
+ })
19
+ .attributes('color'),
20
+ ).toBe('info');
21
+ });
22
+
23
+ it('applies a custom icon color', async () => {
24
+ const wrapper = mount(WtHint, {
25
+ props: {
26
+ iconColor: 'error',
27
+ },
28
+ });
29
+ await flushPromises();
30
+ expect(
31
+ wrapper
32
+ .findComponent({
33
+ name: 'wt-icon-btn',
34
+ })
35
+ .attributes('color'),
36
+ ).toBe('error');
37
+ });
38
+
39
+ it('renders default slot content once the tooltip is shown', async () => {
40
+ const content = 'Hint text';
41
+ const wrapper = mount(WtHint, {
42
+ slots: {
43
+ default: content,
44
+ },
45
+ });
46
+ await flushPromises();
47
+
48
+ await wrapper.find('.wt-tooltip__activator').trigger('mouseenter');
49
+ await flushPromises();
50
+
51
+ expect(wrapper.text()).toContain(content);
52
+ });
10
53
  });
@@ -39,4 +39,33 @@ describe('WtIcon', () => {
39
39
  ]),
40
40
  );
41
41
  });
42
+
43
+ it('applies the disabled class when disabled', () => {
44
+ const wrapper = shallowMount(WtIcon, {
45
+ props: {
46
+ icon: 'bucket',
47
+ disabled: true,
48
+ },
49
+ });
50
+ expect(wrapper.classes()).toContain('wt-icon--disabled');
51
+ });
52
+
53
+ it('falls back to the raw icon name when not found in the repository', () => {
54
+ const wrapper = shallowMount(WtIcon, {
55
+ props: {
56
+ icon: 'totally-unknown-icon',
57
+ },
58
+ });
59
+ expect(wrapper.vm.iconSvg).toBe('totally-unknown-icon');
60
+ });
61
+
62
+ it('emits click when clicked', async () => {
63
+ const wrapper = shallowMount(WtIcon, {
64
+ props: {
65
+ icon: 'bucket',
66
+ },
67
+ });
68
+ await wrapper.trigger('click');
69
+ expect(wrapper.emitted().click).toBeTruthy();
70
+ });
42
71
  });
@@ -1,5 +1,7 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
+ import { IconAction } from '../../../enums';
4
+ import { SortSymbols } from '../../../scripts/sortQueryAdapters.js';
3
5
  import WtIconAction from '../wt-icon-action.vue';
4
6
 
5
7
  describe('WtIconAction', () => {
@@ -11,4 +13,81 @@ describe('WtIconAction', () => {
11
13
  });
12
14
  expect(wrapper.isVisible()).toBe(true);
13
15
  });
16
+
17
+ it('maps a known action to its icon', () => {
18
+ const wrapper = shallowMount(WtIconAction, {
19
+ props: {
20
+ action: IconAction.DELETE,
21
+ },
22
+ });
23
+ expect(
24
+ wrapper
25
+ .findComponent({
26
+ name: 'wt-icon-btn',
27
+ })
28
+ .attributes('icon'),
29
+ ).toBe('bucket');
30
+ });
31
+
32
+ it('uses sort-asc icon by default for the sort action', () => {
33
+ const wrapper = shallowMount(WtIconAction, {
34
+ props: {
35
+ action: IconAction.SORT,
36
+ },
37
+ });
38
+ expect(
39
+ wrapper
40
+ .findComponent({
41
+ name: 'wt-icon-btn',
42
+ })
43
+ .attributes('icon'),
44
+ ).toBe('sort-asc');
45
+ });
46
+
47
+ it('uses sort-desc icon for the sort action when sort:order is desc', () => {
48
+ const wrapper = shallowMount(WtIconAction, {
49
+ props: {
50
+ action: IconAction.SORT,
51
+ 'sort:order': SortSymbols.DESC,
52
+ },
53
+ });
54
+ expect(
55
+ wrapper
56
+ .findComponent({
57
+ name: 'wt-icon-btn',
58
+ })
59
+ .attributes('icon'),
60
+ ).toBe('sort-desc');
61
+ });
62
+
63
+ it('passes disabled and size down to wt-icon-btn', () => {
64
+ const wrapper = shallowMount(WtIconAction, {
65
+ props: {
66
+ action: IconAction.EDIT,
67
+ disabled: true,
68
+ size: 'lg',
69
+ },
70
+ });
71
+ const iconBtn = wrapper.findComponent({
72
+ name: 'wt-icon-btn',
73
+ });
74
+ expect(iconBtn.props('disabled')).toBe(true);
75
+ expect(iconBtn.attributes('size')).toBe('lg');
76
+ });
77
+
78
+ it('emits click and mousedown from the underlying icon button', async () => {
79
+ const wrapper = shallowMount(WtIconAction, {
80
+ props: {
81
+ action: IconAction.EDIT,
82
+ },
83
+ });
84
+ const iconBtn = wrapper.findComponent({
85
+ name: 'wt-icon-btn',
86
+ });
87
+ await iconBtn.vm.$emit('click');
88
+ await iconBtn.vm.$emit('mousedown');
89
+
90
+ expect(wrapper.emitted().click).toBeTruthy();
91
+ expect(wrapper.emitted().mousedown).toBeTruthy();
92
+ });
14
93
  });
@@ -13,7 +13,7 @@
13
13
  import { computed } from 'vue';
14
14
  import { useI18n } from 'vue-i18n';
15
15
 
16
- import IconAction from '../../enums/IconAction/IconAction.enum.js';
16
+ import { IconAction } from '../../enums';
17
17
  import { SortSymbols } from '../../scripts/sortQueryAdapters.js';
18
18
  import { WtIconActionIconMappings } from './iconMappings.js';
19
19
 
@@ -15,4 +15,50 @@ describe('WtIconBtn', () => {
15
15
  });
16
16
  expect(wrapper.classes('wt-icon-btn')).toBe(true);
17
17
  });
18
+
19
+ it('passes icon and other attrs through to wt-icon', () => {
20
+ const wrapper = shallowMount(WtIconBtn, {
21
+ stubs: {
22
+ WtIcon,
23
+ },
24
+ attrs: {
25
+ icon: 'bucket',
26
+ color: 'error',
27
+ },
28
+ });
29
+ const icon = wrapper.findComponent(WtIcon);
30
+ expect(icon.props('icon')).toBe('bucket');
31
+ expect(icon.props('color')).toBe('error');
32
+ });
33
+
34
+ it('applies the disabled class and forwards disabled to wt-icon', () => {
35
+ const wrapper = shallowMount(WtIconBtn, {
36
+ stubs: {
37
+ WtIcon,
38
+ },
39
+ props: {
40
+ disabled: true,
41
+ },
42
+ attrs: {
43
+ icon: 'bucket',
44
+ },
45
+ });
46
+ expect(wrapper.classes()).toContain('wt-icon-btn--disabled');
47
+ expect(wrapper.findComponent(WtIcon).props('disabled')).toBe(true);
48
+ });
49
+
50
+ it('emits click and mousedown', async () => {
51
+ const wrapper = shallowMount(WtIconBtn, {
52
+ stubs: {
53
+ WtIcon,
54
+ },
55
+ attrs: {
56
+ icon: 'bucket',
57
+ },
58
+ });
59
+ await wrapper.trigger('click');
60
+ await wrapper.trigger('mousedown');
61
+ expect(wrapper.emitted().click).toBeTruthy();
62
+ expect(wrapper.emitted().mousedown).toBeTruthy();
63
+ });
18
64
  });
@@ -0,0 +1,83 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import WtImage from '../wt-image.vue';
4
+
5
+ describe('WtImage', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtImage);
8
+ expect(wrapper.exists()).toBe(true);
9
+ });
10
+
11
+ it('applies width/height in px based on the size preset', () => {
12
+ const wrapper = shallowMount(WtImage, {
13
+ props: {
14
+ size: 'sm',
15
+ src: 'pic.png',
16
+ },
17
+ });
18
+ expect(wrapper.attributes('style')).toContain('width: 128px');
19
+ expect(wrapper.attributes('style')).toContain('height: 128px');
20
+ });
21
+
22
+ it('uses explicit width/height props when size is not passed', () => {
23
+ const wrapper = shallowMount(WtImage, {
24
+ props: {
25
+ width: '50%',
26
+ height: 300,
27
+ src: 'pic.png',
28
+ },
29
+ });
30
+ expect(wrapper.attributes('style')).toContain('width: 50%');
31
+ expect(wrapper.attributes('style')).toContain('height: 300px');
32
+ });
33
+
34
+ it('does not render an overlay icon by default', () => {
35
+ const wrapper = shallowMount(WtImage, {
36
+ props: {
37
+ src: 'pic.png',
38
+ },
39
+ });
40
+ expect(wrapper.find('.wt-image__overlay-icon').exists()).toBe(false);
41
+ });
42
+
43
+ it('renders an overlay icon and uses a pointer cursor when overlayIcon is set', () => {
44
+ const wrapper = shallowMount(WtImage, {
45
+ props: {
46
+ overlayIcon: 'edit',
47
+ src: 'pic.png',
48
+ },
49
+ });
50
+ expect(wrapper.find('.wt-image__overlay-icon').exists()).toBe(true);
51
+ expect(wrapper.attributes('style')).toContain('cursor: pointer');
52
+ });
53
+
54
+ it('emits click when clicked', async () => {
55
+ const wrapper = shallowMount(WtImage, {
56
+ props: {
57
+ src: 'pic.png',
58
+ },
59
+ });
60
+ await wrapper.trigger('click');
61
+ expect(wrapper.emitted().click).toBeTruthy();
62
+ });
63
+
64
+ it('renders custom content via default slot instead of the image', () => {
65
+ const wrapper = shallowMount(WtImage, {
66
+ props: {
67
+ src: 'pic.png',
68
+ alt: 'Alt text',
69
+ },
70
+ slots: {
71
+ default: `<template #default="{ src, alt }"><span class="custom">{{ src }}-{{ alt }}</span></template>`,
72
+ },
73
+ });
74
+ expect(wrapper.find('.custom').text()).toBe('pic.png-Alt text');
75
+ expect(
76
+ wrapper
77
+ .findComponent({
78
+ name: 'Image',
79
+ })
80
+ .exists(),
81
+ ).toBe(false);
82
+ });
83
+ });
@@ -28,4 +28,27 @@ describe('WtIndicator', () => {
28
28
  'wt-indicator__indicator--primary',
29
29
  );
30
30
  });
31
+
32
+ it('does not render text when text prop is not passed', () => {
33
+ const wrapper = shallowMount(WtIndicator);
34
+ expect(wrapper.find('.wt-indicator__text').exists()).toBe(false);
35
+ });
36
+
37
+ it('renders numeric text values', () => {
38
+ const wrapper = shallowMount(WtIndicator, {
39
+ props: {
40
+ text: 0,
41
+ },
42
+ });
43
+ expect(wrapper.find('.wt-indicator__text').text()).toBe('0');
44
+ });
45
+
46
+ it('applies the size modifier class', () => {
47
+ const wrapper = shallowMount(WtIndicator, {
48
+ props: {
49
+ size: 'sm',
50
+ },
51
+ });
52
+ expect(wrapper.classes()).toContain('wt-indicator--size-sm');
53
+ });
31
54
  });
@@ -0,0 +1,77 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtInputNumber from '../wt-input-number.vue';
4
+
5
+ describe('WtInputNumber', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtInputNumber);
8
+ expect(wrapper.classes()).toContain('wt-input-number');
9
+ });
10
+
11
+ it('does not render a label when no label prop or slot is passed', () => {
12
+ const wrapper = shallowMount(WtInputNumber);
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(WtInputNumber, {
24
+ props: {
25
+ label: 'Amount',
26
+ },
27
+ });
28
+ expect(wrapper.find('.wt-label').text()).toBe('Amount');
29
+ });
30
+
31
+ it('appends an asterisk to the label when required', () => {
32
+ const wrapper = mount(WtInputNumber, {
33
+ props: {
34
+ label: 'Amount',
35
+ required: true,
36
+ },
37
+ });
38
+ expect(wrapper.find('.wt-label').text()).toBe('Amount*');
39
+ });
40
+
41
+ it('passes disabled and modelValue down to the underlying input', () => {
42
+ const wrapper = mount(WtInputNumber, {
43
+ props: {
44
+ disabled: true,
45
+ modelValue: 42,
46
+ },
47
+ });
48
+ const input = wrapper.findComponent({
49
+ name: 'InputNumber',
50
+ });
51
+ expect(input.props('disabled')).toBe(true);
52
+ expect(input.props('modelValue')).toBe(42);
53
+ });
54
+
55
+ it('emits update:modelValue when the underlying input changes', async () => {
56
+ const wrapper = mount(WtInputNumber);
57
+ const input = wrapper.findComponent({
58
+ name: 'InputNumber',
59
+ });
60
+ await input.vm.$emit('update:model-value', 7);
61
+ expect(wrapper.emitted()['update:modelValue']).toBeTruthy();
62
+ expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
63
+ 7,
64
+ ]);
65
+ });
66
+
67
+ it('renders prefix and suffix slots', () => {
68
+ const wrapper = mount(WtInputNumber, {
69
+ slots: {
70
+ prefix: '$',
71
+ suffix: 'USD',
72
+ },
73
+ });
74
+ expect(wrapper.text()).toContain('$');
75
+ expect(wrapper.text()).toContain('USD');
76
+ });
77
+ });
@@ -0,0 +1,85 @@
1
+ import { mount, shallowMount } from '@vue/test-utils';
2
+
3
+ import WtInputText from '../wt-input-text.vue';
4
+
5
+ describe('WtInputText', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtInputText);
8
+ expect(wrapper.classes()).toContain('wt-input-text');
9
+ });
10
+
11
+ it('does not render a label when no label prop or slot is passed', () => {
12
+ const wrapper = shallowMount(WtInputText);
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(WtInputText, {
24
+ props: {
25
+ label: 'Name',
26
+ },
27
+ });
28
+ expect(wrapper.find('.wt-label').text()).toBe('Name');
29
+ });
30
+
31
+ it('trims the value by default on input', () => {
32
+ const wrapper = mount(WtInputText);
33
+ const input = wrapper.findComponent({
34
+ name: 'InputText',
35
+ });
36
+ input.vm.$emit('update:model-value', ' hello ');
37
+ expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
38
+ 'hello',
39
+ ]);
40
+ });
41
+
42
+ it('does not trim the value when preventTrim is true', () => {
43
+ const wrapper = mount(WtInputText, {
44
+ props: {
45
+ preventTrim: true,
46
+ },
47
+ });
48
+ const input = wrapper.findComponent({
49
+ name: 'InputText',
50
+ });
51
+ input.vm.$emit('update:model-value', ' hello ');
52
+ expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
53
+ ' hello ',
54
+ ]);
55
+ });
56
+
57
+ it('toggles the eye icon and masks the input when hideInputValue is true', async () => {
58
+ const wrapper = mount(WtInputText, {
59
+ props: {
60
+ hideInputValue: true,
61
+ modelValue: 'secret',
62
+ },
63
+ });
64
+ const input = wrapper.find('.wt-input-text__input');
65
+ expect(input.classes()).toContain('wt-input-text__input--masked');
66
+
67
+ await wrapper
68
+ .findComponent({
69
+ name: 'wt-icon-btn',
70
+ })
71
+ .trigger('click');
72
+ expect(wrapper.find('.wt-input-text__input').classes()).not.toContain(
73
+ 'wt-input-text__input--masked',
74
+ );
75
+ });
76
+
77
+ it('emits focus when the underlying input is focused', async () => {
78
+ const wrapper = mount(WtInputText);
79
+ const input = wrapper.findComponent({
80
+ name: 'InputText',
81
+ });
82
+ await input.vm.$emit('focus', new Event('focus'));
83
+ expect(wrapper.emitted().focus).toBeTruthy();
84
+ });
85
+ });
@@ -3,13 +3,34 @@ import { shallowMount } from '@vue/test-utils';
3
3
  import WtIntersectionObserver from '../wt-intersection-observer.vue';
4
4
 
5
5
  describe('WtIntersectionObserver', () => {
6
- const next = () => true;
7
6
  it('renders a component', () => {
7
+ const wrapper = shallowMount(WtIntersectionObserver);
8
+ expect(wrapper.exists()).toBe(true);
9
+ });
10
+
11
+ it('does not render a loader by default', () => {
12
+ const wrapper = shallowMount(WtIntersectionObserver);
13
+ expect(
14
+ wrapper
15
+ .findComponent({
16
+ name: 'wt-loader',
17
+ })
18
+ .exists(),
19
+ ).toBe(false);
20
+ });
21
+
22
+ it('renders a loader when loading is true', () => {
8
23
  const wrapper = shallowMount(WtIntersectionObserver, {
9
24
  props: {
10
- next,
25
+ loading: true,
11
26
  },
12
27
  });
13
- expect(wrapper.exists()).toBe(true);
28
+ expect(
29
+ wrapper
30
+ .findComponent({
31
+ name: 'wt-loader',
32
+ })
33
+ .exists(),
34
+ ).toBe(true);
14
35
  });
15
36
  });