@datametria/vue-components 2.3.1 → 2.4.1

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 (126) hide show
  1. package/README.md +625 -594
  2. package/dist/index.es.js +1962 -1887
  3. package/dist/index.umd.js +6 -6
  4. package/dist/src/components/DatametriaForm.vue.d.ts +1 -1
  5. package/dist/src/components/DatametriaInput.vue.d.ts +9 -1
  6. package/dist/src/components/DatametriaSelect.vue.d.ts +10 -1
  7. package/dist/vue-components.css +1 -1
  8. package/package.json +103 -102
  9. package/src/components/DatametriaAlert.vue +151 -133
  10. package/src/components/DatametriaAutocomplete.vue +250 -229
  11. package/src/components/DatametriaAvatar.vue +256 -238
  12. package/src/components/DatametriaBadge.vue +101 -96
  13. package/src/components/DatametriaBreadcrumb.vue +132 -128
  14. package/src/components/DatametriaButton.vue +191 -173
  15. package/src/components/DatametriaCard.vue +84 -66
  16. package/src/components/DatametriaCheckbox.vue +197 -193
  17. package/src/components/DatametriaChip.vue +159 -141
  18. package/src/components/DatametriaContainer.vue +70 -52
  19. package/src/components/DatametriaDataTable.vue +318 -300
  20. package/src/components/DatametriaDatePicker.vue +396 -378
  21. package/src/components/DatametriaDialog.vue +297 -293
  22. package/src/components/DatametriaDivider.vue +105 -98
  23. package/src/components/DatametriaDropdown.vue +356 -350
  24. package/src/components/DatametriaEmpty.vue +155 -151
  25. package/src/components/DatametriaFileUpload.vue +413 -395
  26. package/src/components/DatametriaFloatingBar.vue +144 -126
  27. package/src/components/DatametriaForm.vue +174 -156
  28. package/src/components/DatametriaFormItem.vue +183 -179
  29. package/src/components/DatametriaGrid.vue +55 -37
  30. package/src/components/DatametriaInput.vue +314 -263
  31. package/src/components/DatametriaMenu.vue +618 -600
  32. package/src/components/DatametriaModal.vue +147 -129
  33. package/src/components/DatametriaNavbar.vue +277 -223
  34. package/src/components/DatametriaPagination.vue +375 -371
  35. package/src/components/DatametriaPasswordInput.vue +446 -426
  36. package/src/components/DatametriaPopconfirm.vue +240 -234
  37. package/src/components/DatametriaProgress.vue +228 -224
  38. package/src/components/DatametriaRadio.vue +151 -147
  39. package/src/components/DatametriaResult.vue +135 -131
  40. package/src/components/DatametriaSelect.vue +311 -211
  41. package/src/components/DatametriaSidebar.vue +294 -222
  42. package/src/components/DatametriaSkeleton.vue +257 -234
  43. package/src/components/DatametriaSlider.vue +409 -391
  44. package/src/components/DatametriaSortableTable.vue +826 -802
  45. package/src/components/DatametriaSpinner.vue +114 -110
  46. package/src/components/DatametriaSteps.vue +318 -312
  47. package/src/components/DatametriaSwitch.vue +146 -142
  48. package/src/components/DatametriaTabPane.vue +94 -76
  49. package/src/components/DatametriaTable.vue +118 -100
  50. package/src/components/DatametriaTabs.vue +315 -297
  51. package/src/components/DatametriaTextarea.vue +213 -195
  52. package/src/components/DatametriaTimePicker.vue +317 -299
  53. package/src/components/DatametriaToast.vue +176 -176
  54. package/src/components/DatametriaTooltip.vue +421 -400
  55. package/src/components/DatametriaTree.vue +126 -122
  56. package/src/components/DatametriaTreeNode.vue +176 -172
  57. package/src/components/DatametriaUpload.vue +379 -361
  58. package/src/components/__tests__/DatametriaAlert.test.js +35 -35
  59. package/src/components/__tests__/DatametriaAlert.test.ts +190 -190
  60. package/src/components/__tests__/DatametriaAvatar.test.ts +151 -151
  61. package/src/components/__tests__/DatametriaBadge.test.js +29 -29
  62. package/src/components/__tests__/DatametriaBadge.test.ts +167 -167
  63. package/src/components/__tests__/DatametriaBreadcrumb.test.ts +187 -0
  64. package/src/components/__tests__/DatametriaButton.test.js +30 -30
  65. package/src/components/__tests__/DatametriaButton.test.ts +283 -283
  66. package/src/components/__tests__/DatametriaCard.test.ts +201 -201
  67. package/src/components/__tests__/DatametriaCheckbox.test.ts +204 -0
  68. package/src/components/__tests__/DatametriaChip.test.js +38 -38
  69. package/src/components/__tests__/DatametriaContainer.test.ts +52 -52
  70. package/src/components/__tests__/DatametriaDialog.test.ts +338 -0
  71. package/src/components/__tests__/DatametriaDivider.test.ts +54 -54
  72. package/src/components/__tests__/DatametriaDropdown.test.ts +357 -0
  73. package/src/components/__tests__/DatametriaEmpty.test.ts +261 -0
  74. package/src/components/__tests__/DatametriaFileUpload.test.ts +290 -290
  75. package/src/components/__tests__/DatametriaFloatingBar.test.ts +137 -137
  76. package/src/components/__tests__/DatametriaForm.test.ts +96 -0
  77. package/src/components/__tests__/DatametriaFormItem.test.ts +58 -0
  78. package/src/components/__tests__/DatametriaGrid.test.ts +31 -31
  79. package/src/components/__tests__/DatametriaInput.test.ts +72 -72
  80. package/src/components/__tests__/DatametriaMenu.test.ts +366 -366
  81. package/src/components/__tests__/DatametriaModal.test.ts +86 -86
  82. package/src/components/__tests__/DatametriaNavbar.test.js +48 -48
  83. package/src/components/__tests__/DatametriaNavbar.test.ts +203 -203
  84. package/src/components/__tests__/DatametriaPasswordInput.test.js +305 -305
  85. package/src/components/__tests__/DatametriaRadio.test.ts +195 -0
  86. package/src/components/__tests__/DatametriaSelect.test.ts +77 -77
  87. package/src/components/__tests__/DatametriaSidebar.test.ts +169 -169
  88. package/src/components/__tests__/DatametriaSlider.test.ts +261 -261
  89. package/src/components/__tests__/DatametriaSortableTable.test.js +168 -168
  90. package/src/components/__tests__/DatametriaSpinner.test.ts +156 -156
  91. package/src/components/__tests__/DatametriaSteps.test.ts +211 -0
  92. package/src/components/__tests__/DatametriaSwitch.test.ts +129 -0
  93. package/src/components/__tests__/DatametriaTabPane.test.ts +205 -0
  94. package/src/components/__tests__/DatametriaTable.test.ts +97 -97
  95. package/src/components/__tests__/DatametriaTabs.test.ts +232 -232
  96. package/src/components/__tests__/DatametriaToast.test.js +48 -48
  97. package/src/components/__tests__/DatametriaToast.test.ts +99 -99
  98. package/src/components/__tests__/DatametriaTree.test.ts +376 -0
  99. package/src/components/__tests__/index.test.ts +48 -0
  100. package/src/composables/useAccessibilityScale.ts +94 -94
  101. package/src/composables/useBreakpoints.ts +82 -82
  102. package/src/composables/useHapticFeedback.ts +439 -439
  103. package/src/composables/useRipple.ts +218 -218
  104. package/src/composables/useTheme.ts +5 -1
  105. package/src/index.ts +84 -84
  106. package/src/stories/Variants.stories.js +95 -95
  107. package/src/styles/design-tokens.css +623 -623
  108. package/src/theme/ThemeProvider.vue +96 -96
  109. package/src/theme/__tests__/ThemeProvider.test.ts +208 -208
  110. package/src/theme/__tests__/constants.test.ts +31 -31
  111. package/src/theme/__tests__/presets.test.ts +166 -166
  112. package/src/theme/__tests__/tokens.test.ts +155 -155
  113. package/src/theme/__tests__/types.test.ts +153 -153
  114. package/src/theme/__tests__/useTheme.test.ts +146 -146
  115. package/src/theme/constants.ts +14 -14
  116. package/src/theme/index.ts +12 -12
  117. package/src/theme/presets/datametria.ts +94 -94
  118. package/src/theme/presets/default.ts +94 -94
  119. package/src/theme/presets/index.ts +8 -8
  120. package/src/theme/tokens/colors.ts +28 -28
  121. package/src/theme/tokens/index.ts +47 -47
  122. package/src/theme/tokens/spacing.ts +21 -21
  123. package/src/theme/tokens/typography.ts +35 -35
  124. package/src/theme/types.ts +111 -111
  125. package/src/theme/useTheme.ts +28 -28
  126. package/src/types/index.ts +55 -55
@@ -0,0 +1,211 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import DatametriaSteps from '../DatametriaSteps.vue'
4
+
5
+ describe('DatametriaSteps', () => {
6
+ const items = [
7
+ { title: 'Passo 1', description: 'Descrição 1' },
8
+ { title: 'Passo 2', description: 'Descrição 2' },
9
+ { title: 'Passo 3', description: 'Descrição 3' }
10
+ ]
11
+
12
+ it('renders correctly', () => {
13
+ const wrapper = mount(DatametriaSteps, {
14
+ props: { items }
15
+ })
16
+ expect(wrapper.find('.datametria-steps').exists()).toBe(true)
17
+ })
18
+
19
+ it('renders all items', () => {
20
+ const wrapper = mount(DatametriaSteps, {
21
+ props: { items }
22
+ })
23
+ const stepItems = wrapper.findAll('.datametria-steps__item')
24
+ expect(stepItems).toHaveLength(3)
25
+ })
26
+
27
+ it('renders item titles', () => {
28
+ const wrapper = mount(DatametriaSteps, {
29
+ props: { items }
30
+ })
31
+ expect(wrapper.text()).toContain('Passo 1')
32
+ expect(wrapper.text()).toContain('Passo 2')
33
+ expect(wrapper.text()).toContain('Passo 3')
34
+ })
35
+
36
+ it('renders item descriptions', () => {
37
+ const wrapper = mount(DatametriaSteps, {
38
+ props: { items }
39
+ })
40
+ expect(wrapper.text()).toContain('Descrição 1')
41
+ expect(wrapper.text()).toContain('Descrição 2')
42
+ expect(wrapper.text()).toContain('Descrição 3')
43
+ })
44
+
45
+ it('renders horizontal direction by default', () => {
46
+ const wrapper = mount(DatametriaSteps, {
47
+ props: { items }
48
+ })
49
+ expect(wrapper.find('.datametria-steps--horizontal').exists()).toBe(true)
50
+ })
51
+
52
+ it('renders vertical direction', () => {
53
+ const wrapper = mount(DatametriaSteps, {
54
+ props: { items, direction: 'vertical' }
55
+ })
56
+ expect(wrapper.find('.datametria-steps--vertical').exists()).toBe(true)
57
+ })
58
+
59
+ it('sets active step correctly', () => {
60
+ const wrapper = mount(DatametriaSteps, {
61
+ props: { items, active: 1 }
62
+ })
63
+ const stepItems = wrapper.findAll('.datametria-steps__item')
64
+ expect(stepItems[0].classes()).toContain('is-finish')
65
+ expect(stepItems[1].classes()).toContain('is-process')
66
+ expect(stepItems[2].classes()).toContain('is-wait')
67
+ })
68
+
69
+ it('shows finish status for completed steps', () => {
70
+ const wrapper = mount(DatametriaSteps, {
71
+ props: { items, active: 2 }
72
+ })
73
+ const stepItems = wrapper.findAll('.datametria-steps__item')
74
+ expect(stepItems[0].classes()).toContain('is-finish')
75
+ expect(stepItems[1].classes()).toContain('is-finish')
76
+ })
77
+
78
+ it('shows process status for current step', () => {
79
+ const wrapper = mount(DatametriaSteps, {
80
+ props: { items, active: 1 }
81
+ })
82
+ const stepItems = wrapper.findAll('.datametria-steps__item')
83
+ expect(stepItems[1].classes()).toContain('is-process')
84
+ })
85
+
86
+ it('shows wait status for pending steps', () => {
87
+ const wrapper = mount(DatametriaSteps, {
88
+ props: { items, active: 0 }
89
+ })
90
+ const stepItems = wrapper.findAll('.datametria-steps__item')
91
+ expect(stepItems[1].classes()).toContain('is-wait')
92
+ expect(stepItems[2].classes()).toContain('is-wait')
93
+ })
94
+
95
+ it('renders check icon for finished steps', () => {
96
+ const wrapper = mount(DatametriaSteps, {
97
+ props: { items, active: 1 }
98
+ })
99
+ const icons = wrapper.findAll('.icon-check')
100
+ expect(icons.length).toBeGreaterThan(0)
101
+ })
102
+
103
+ it('renders number for non-finished steps', () => {
104
+ const wrapper = mount(DatametriaSteps, {
105
+ props: { items, active: 0 }
106
+ })
107
+ const numbers = wrapper.findAll('.icon-number')
108
+ expect(numbers.length).toBeGreaterThan(0)
109
+ })
110
+
111
+ it('supports custom status per item', () => {
112
+ const customItems = [
113
+ { title: 'Passo 1', status: 'finish' as const },
114
+ { title: 'Passo 2', status: 'error' as const },
115
+ { title: 'Passo 3' }
116
+ ]
117
+ const wrapper = mount(DatametriaSteps, {
118
+ props: { items: customItems, active: 0 }
119
+ })
120
+ const stepItems = wrapper.findAll('.datametria-steps__item')
121
+ expect(stepItems[0].classes()).toContain('is-finish')
122
+ expect(stepItems[1].classes()).toContain('is-error')
123
+ })
124
+
125
+ it('renders error icon for error status', () => {
126
+ const errorItems = [
127
+ { title: 'Passo 1', status: 'error' as const }
128
+ ]
129
+ const wrapper = mount(DatametriaSteps, {
130
+ props: { items: errorItems }
131
+ })
132
+ expect(wrapper.find('.icon-error').exists()).toBe(true)
133
+ })
134
+
135
+ it('supports global status override', () => {
136
+ const wrapper = mount(DatametriaSteps, {
137
+ props: { items, status: 'error' }
138
+ })
139
+ const stepItems = wrapper.findAll('.datametria-steps__item')
140
+ stepItems.forEach(item => {
141
+ expect(item.classes()).toContain('is-error')
142
+ })
143
+ })
144
+
145
+ it('renders simple mode without descriptions', () => {
146
+ const wrapper = mount(DatametriaSteps, {
147
+ props: { items, simple: true }
148
+ })
149
+ expect(wrapper.find('.datametria-steps--simple').exists()).toBe(true)
150
+ })
151
+
152
+ it('adds is-last class to last item', () => {
153
+ const wrapper = mount(DatametriaSteps, {
154
+ props: { items }
155
+ })
156
+ const stepItems = wrapper.findAll('.datametria-steps__item')
157
+ expect(stepItems[2].classes()).toContain('is-last')
158
+ })
159
+
160
+ it('does not add is-last class to non-last items', () => {
161
+ const wrapper = mount(DatametriaSteps, {
162
+ props: { items }
163
+ })
164
+ const stepItems = wrapper.findAll('.datametria-steps__item')
165
+ expect(stepItems[0].classes()).not.toContain('is-last')
166
+ expect(stepItems[1].classes()).not.toContain('is-last')
167
+ })
168
+
169
+ it('renders lines between steps', () => {
170
+ const wrapper = mount(DatametriaSteps, {
171
+ props: { items }
172
+ })
173
+ const lines = wrapper.findAll('.datametria-steps__line')
174
+ expect(lines).toHaveLength(2) // 3 items = 2 lines
175
+ })
176
+
177
+ it('does not render line for first step', () => {
178
+ const wrapper = mount(DatametriaSteps, {
179
+ props: { items }
180
+ })
181
+ const firstItem = wrapper.findAll('.datametria-steps__item')[0]
182
+ expect(firstItem.find('.datametria-steps__line').exists()).toBe(false)
183
+ })
184
+
185
+ it('renders with single item', () => {
186
+ const wrapper = mount(DatametriaSteps, {
187
+ props: { items: [{ title: 'Único' }] }
188
+ })
189
+ expect(wrapper.findAll('.datametria-steps__item')).toHaveLength(1)
190
+ expect(wrapper.findAll('.datametria-steps__line')).toHaveLength(0)
191
+ })
192
+
193
+ it('handles items without description', () => {
194
+ const simpleItems = [
195
+ { title: 'Passo 1' },
196
+ { title: 'Passo 2' }
197
+ ]
198
+ const wrapper = mount(DatametriaSteps, {
199
+ props: { items: simpleItems }
200
+ })
201
+ expect(wrapper.findAll('.datametria-steps__description')).toHaveLength(0)
202
+ })
203
+
204
+ it('renders step numbers correctly', () => {
205
+ const wrapper = mount(DatametriaSteps, {
206
+ props: { items, active: 0 }
207
+ })
208
+ const numbers = wrapper.findAll('.icon-number')
209
+ expect(numbers[0].text()).toBe('1')
210
+ })
211
+ })
@@ -0,0 +1,129 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import DatametriaSwitch from '../DatametriaSwitch.vue'
4
+
5
+ describe('DatametriaSwitch', () => {
6
+ it('renders correctly', () => {
7
+ const wrapper = mount(DatametriaSwitch)
8
+ expect(wrapper.find('.datametria-switch').exists()).toBe(true)
9
+ })
10
+
11
+ it('toggles value on click', async () => {
12
+ const wrapper = mount(DatametriaSwitch, {
13
+ props: { modelValue: false }
14
+ })
15
+
16
+ await wrapper.find('.datametria-switch').trigger('click')
17
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([true])
18
+ expect(wrapper.emitted('change')?.[0]).toEqual([true])
19
+ })
20
+
21
+ it('applies checked class when true', () => {
22
+ const wrapper = mount(DatametriaSwitch, {
23
+ props: { modelValue: true }
24
+ })
25
+ expect(wrapper.find('.is-checked').exists()).toBe(true)
26
+ })
27
+
28
+ it('handles disabled state', async () => {
29
+ const wrapper = mount(DatametriaSwitch, {
30
+ props: { disabled: true }
31
+ })
32
+
33
+ expect(wrapper.find('.is-disabled').exists()).toBe(true)
34
+ expect(wrapper.find('button').attributes('disabled')).toBeDefined()
35
+
36
+ await wrapper.find('button').trigger('click')
37
+ expect(wrapper.emitted('update:modelValue')).toBeUndefined()
38
+ })
39
+
40
+ it('handles loading state', async () => {
41
+ const wrapper = mount(DatametriaSwitch, {
42
+ props: { loading: true }
43
+ })
44
+
45
+ expect(wrapper.find('.is-loading').exists()).toBe(true)
46
+ expect(wrapper.find('.datametria-switch__loading').exists()).toBe(true)
47
+ expect(wrapper.find('.spinner').exists()).toBe(true)
48
+
49
+ await wrapper.find('button').trigger('click')
50
+ expect(wrapper.emitted('update:modelValue')).toBeUndefined()
51
+ })
52
+
53
+ it('applies custom active color', () => {
54
+ const wrapper = mount(DatametriaSwitch, {
55
+ props: { modelValue: true, activeColor: '#ff0000' }
56
+ })
57
+ const core = wrapper.find('.datametria-switch__core')
58
+ expect(core.attributes('style')).toContain('background-color: rgb(255, 0, 0)')
59
+ })
60
+
61
+ it('applies custom inactive color', () => {
62
+ const wrapper = mount(DatametriaSwitch, {
63
+ props: { modelValue: false, inactiveColor: '#00ff00' }
64
+ })
65
+ const core = wrapper.find('.datametria-switch__core')
66
+ expect(core.attributes('style')).toContain('background-color: rgb(0, 255, 0)')
67
+ })
68
+
69
+ it('has correct aria attributes', () => {
70
+ const wrapper = mount(DatametriaSwitch, {
71
+ props: { modelValue: true }
72
+ })
73
+ const button = wrapper.find('button')
74
+ expect(button.attributes('role')).toBe('switch')
75
+ expect(button.attributes('aria-checked')).toBe('true')
76
+ })
77
+
78
+ it('updates aria-checked when value changes', async () => {
79
+ const wrapper = mount(DatametriaSwitch, {
80
+ props: { modelValue: false }
81
+ })
82
+
83
+ await wrapper.setProps({ modelValue: true })
84
+ expect(wrapper.find('button').attributes('aria-checked')).toBe('true')
85
+ })
86
+
87
+ it('emits change event with correct value', async () => {
88
+ const wrapper = mount(DatametriaSwitch, {
89
+ props: { modelValue: false }
90
+ })
91
+
92
+ await wrapper.find('button').trigger('click')
93
+ expect(wrapper.emitted('change')?.[0]).toEqual([true])
94
+ })
95
+
96
+ it('does not emit when disabled', async () => {
97
+ const wrapper = mount(DatametriaSwitch, {
98
+ props: { modelValue: false, disabled: true }
99
+ })
100
+
101
+ await wrapper.find('button').trigger('click')
102
+ expect(wrapper.emitted('update:modelValue')).toBeUndefined()
103
+ expect(wrapper.emitted('change')).toBeUndefined()
104
+ })
105
+
106
+ it('does not emit when loading', async () => {
107
+ const wrapper = mount(DatametriaSwitch, {
108
+ props: { modelValue: false, loading: true }
109
+ })
110
+
111
+ await wrapper.find('button').trigger('click')
112
+ expect(wrapper.emitted('update:modelValue')).toBeUndefined()
113
+ expect(wrapper.emitted('change')).toBeUndefined()
114
+ })
115
+
116
+ it('toggles from true to false', async () => {
117
+ const wrapper = mount(DatametriaSwitch, {
118
+ props: { modelValue: true }
119
+ })
120
+
121
+ await wrapper.find('button').trigger('click')
122
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([false])
123
+ })
124
+
125
+ it('has button type', () => {
126
+ const wrapper = mount(DatametriaSwitch)
127
+ expect(wrapper.find('button').attributes('type')).toBe('button')
128
+ })
129
+ })
@@ -0,0 +1,205 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import { ref, provide } from 'vue'
4
+ import DatametriaTabPane from '../DatametriaTabPane.vue'
5
+
6
+ describe('DatametriaTabPane', () => {
7
+ it('renders correctly', () => {
8
+ const wrapper = mount(DatametriaTabPane, {
9
+ props: { label: 'Test Tab' },
10
+ slots: { default: 'Tab Content' }
11
+ })
12
+ expect(wrapper.find('.datametria-tab-pane').exists()).toBe(true)
13
+ })
14
+
15
+ it('renders slot content', () => {
16
+ const wrapper = mount(DatametriaTabPane, {
17
+ props: { label: 'Test' },
18
+ slots: { default: 'Content' }
19
+ })
20
+ expect(wrapper.text()).toContain('Content')
21
+ })
22
+
23
+ it('applies active class when active', () => {
24
+ const activePane = ref('test')
25
+ const wrapper = mount(DatametriaTabPane, {
26
+ props: { label: 'Test', name: 'test' },
27
+ global: {
28
+ provide: {
29
+ datametriaTabs: {
30
+ activePane,
31
+ registerPane: () => {},
32
+ unregisterPane: () => {}
33
+ }
34
+ }
35
+ }
36
+ })
37
+ expect(wrapper.find('.is-active').exists()).toBe(true)
38
+ })
39
+
40
+ it('hides when not active', () => {
41
+ const activePane = ref('other')
42
+ const wrapper = mount(DatametriaTabPane, {
43
+ props: { label: 'Test', name: 'test' },
44
+ global: {
45
+ provide: {
46
+ datametriaTabs: {
47
+ activePane,
48
+ registerPane: () => {},
49
+ unregisterPane: () => {}
50
+ }
51
+ }
52
+ }
53
+ })
54
+ expect(wrapper.find('.datametria-tab-pane').attributes('hidden')).toBeDefined()
55
+ })
56
+
57
+ it('generates correct id from label', () => {
58
+ const wrapper = mount(DatametriaTabPane, {
59
+ props: { label: 'Test Tab' }
60
+ })
61
+ expect(wrapper.find('.datametria-tab-pane').attributes('id')).toBe('pane-test-tab')
62
+ })
63
+
64
+ it('uses name prop for id if provided', () => {
65
+ const wrapper = mount(DatametriaTabPane, {
66
+ props: { label: 'Test', name: 'custom' }
67
+ })
68
+ expect(wrapper.find('.datametria-tab-pane').attributes('id')).toBe('pane-custom')
69
+ })
70
+
71
+ it('sets correct aria-labelledby', () => {
72
+ const wrapper = mount(DatametriaTabPane, {
73
+ props: { label: 'Test Tab' }
74
+ })
75
+ expect(wrapper.find('.datametria-tab-pane').attributes('aria-labelledby')).toBe('tab-test-tab')
76
+ })
77
+
78
+ it('supports lazy loading', async () => {
79
+ const activePane = ref('other')
80
+ const wrapper = mount(DatametriaTabPane, {
81
+ props: { label: 'Test', name: 'test', lazy: true },
82
+ slots: { default: 'Lazy Content' },
83
+ global: {
84
+ provide: {
85
+ datametriaTabs: {
86
+ activePane,
87
+ registerPane: () => {},
88
+ unregisterPane: () => {}
89
+ }
90
+ }
91
+ }
92
+ })
93
+
94
+ // Content should not be rendered initially
95
+ expect(wrapper.text()).toBe('')
96
+
97
+ // Activate the pane
98
+ activePane.value = 'test'
99
+ await wrapper.vm.$nextTick()
100
+
101
+ // Content should now be rendered
102
+ expect(wrapper.text()).toContain('Lazy Content')
103
+ })
104
+
105
+ it('registers pane on mount', () => {
106
+ let registered = false
107
+ const registerPane = () => { registered = true }
108
+
109
+ mount(DatametriaTabPane, {
110
+ props: { label: 'Test' },
111
+ global: {
112
+ provide: {
113
+ datametriaTabs: {
114
+ activePane: ref('test'),
115
+ registerPane,
116
+ unregisterPane: () => {}
117
+ }
118
+ }
119
+ }
120
+ })
121
+
122
+ expect(registered).toBe(true)
123
+ })
124
+
125
+ it('unregisters pane on unmount', () => {
126
+ let unregistered = false
127
+ const unregisterPane = () => { unregistered = true }
128
+
129
+ const wrapper = mount(DatametriaTabPane, {
130
+ props: { label: 'Test' },
131
+ global: {
132
+ provide: {
133
+ datametriaTabs: {
134
+ activePane: ref('test'),
135
+ registerPane: () => {},
136
+ unregisterPane
137
+ }
138
+ }
139
+ }
140
+ })
141
+
142
+ wrapper.unmount()
143
+ expect(unregistered).toBe(true)
144
+ })
145
+
146
+ it('passes icon prop to registration', () => {
147
+ let registeredPane: any = null
148
+ const registerPane = (pane: any) => { registeredPane = pane }
149
+
150
+ mount(DatametriaTabPane, {
151
+ props: { label: 'Test', icon: '🔥' },
152
+ global: {
153
+ provide: {
154
+ datametriaTabs: {
155
+ activePane: ref('test'),
156
+ registerPane,
157
+ unregisterPane: () => {}
158
+ }
159
+ }
160
+ }
161
+ })
162
+
163
+ expect(registeredPane?.icon).toBe('🔥')
164
+ })
165
+
166
+ it('passes badge prop to registration', () => {
167
+ let registeredPane: any = null
168
+ const registerPane = (pane: any) => { registeredPane = pane }
169
+
170
+ mount(DatametriaTabPane, {
171
+ props: { label: 'Test', badge: '5' },
172
+ global: {
173
+ provide: {
174
+ datametriaTabs: {
175
+ activePane: ref('test'),
176
+ registerPane,
177
+ unregisterPane: () => {}
178
+ }
179
+ }
180
+ }
181
+ })
182
+
183
+ expect(registeredPane?.badge).toBe('5')
184
+ })
185
+
186
+ it('passes disabled prop to registration', () => {
187
+ let registeredPane: any = null
188
+ const registerPane = (pane: any) => { registeredPane = pane }
189
+
190
+ mount(DatametriaTabPane, {
191
+ props: { label: 'Test', disabled: true },
192
+ global: {
193
+ provide: {
194
+ datametriaTabs: {
195
+ activePane: ref('test'),
196
+ registerPane,
197
+ unregisterPane: () => {}
198
+ }
199
+ }
200
+ }
201
+ })
202
+
203
+ expect(registeredPane?.disabled).toBe(true)
204
+ })
205
+ })