@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
@@ -1,283 +1,283 @@
1
- /**
2
- * DatametriaButton Tests
3
- * @author Vander Loto - CTO DATAMETRIA
4
- * @date 13/11/2025
5
- */
6
-
7
- import { describe, it, expect } from 'vitest'
8
- import { mount } from '@vue/test-utils'
9
- import DatametriaButton from '../DatametriaButton.vue'
10
- import { ButtonVariant, ButtonSize } from '../../types'
11
-
12
- describe('DatametriaButton', () => {
13
- describe('Rendering', () => {
14
- it('should render button with text', () => {
15
- const wrapper = mount(DatametriaButton, {
16
- slots: { default: 'Click me' }
17
- })
18
-
19
- expect(wrapper.text()).toContain('Click me')
20
- expect(wrapper.find('button').exists()).toBe(true)
21
- })
22
-
23
- it('should render with default variant and size', () => {
24
- const wrapper = mount(DatametriaButton, {
25
- slots: { default: 'Button' }
26
- })
27
-
28
- expect(wrapper.classes()).toContain('datametria-button--primary')
29
- expect(wrapper.classes()).toContain('datametria-button--md')
30
- })
31
- })
32
-
33
- describe('Variants', () => {
34
- it('should render primary variant', () => {
35
- const wrapper = mount(DatametriaButton, {
36
- props: { variant: ButtonVariant.PRIMARY },
37
- slots: { default: 'Primary' }
38
- })
39
-
40
- expect(wrapper.classes()).toContain('datametria-button--primary')
41
- })
42
-
43
- it('should render secondary variant', () => {
44
- const wrapper = mount(DatametriaButton, {
45
- props: { variant: ButtonVariant.SECONDARY },
46
- slots: { default: 'Secondary' }
47
- })
48
-
49
- expect(wrapper.classes()).toContain('datametria-button--secondary')
50
- })
51
-
52
- it('should render outline variant', () => {
53
- const wrapper = mount(DatametriaButton, {
54
- props: { variant: ButtonVariant.OUTLINE },
55
- slots: { default: 'Outline' }
56
- })
57
-
58
- expect(wrapper.classes()).toContain('datametria-button--outline')
59
- })
60
-
61
- it('should render ghost variant', () => {
62
- const wrapper = mount(DatametriaButton, {
63
- props: { variant: ButtonVariant.GHOST },
64
- slots: { default: 'Ghost' }
65
- })
66
-
67
- expect(wrapper.classes()).toContain('datametria-button--ghost')
68
- })
69
- })
70
-
71
- describe('Sizes', () => {
72
- it('should render small size', () => {
73
- const wrapper = mount(DatametriaButton, {
74
- props: { size: ButtonSize.SM },
75
- slots: { default: 'Small' }
76
- })
77
-
78
- expect(wrapper.classes()).toContain('datametria-button--sm')
79
- })
80
-
81
- it('should render medium size', () => {
82
- const wrapper = mount(DatametriaButton, {
83
- props: { size: ButtonSize.MD },
84
- slots: { default: 'Medium' }
85
- })
86
-
87
- expect(wrapper.classes()).toContain('datametria-button--md')
88
- })
89
-
90
- it('should render large size', () => {
91
- const wrapper = mount(DatametriaButton, {
92
- props: { size: ButtonSize.LG },
93
- slots: { default: 'Large' }
94
- })
95
-
96
- expect(wrapper.classes()).toContain('datametria-button--lg')
97
- })
98
- })
99
-
100
- describe('States', () => {
101
- it('should be disabled when disabled prop is true', () => {
102
- const wrapper = mount(DatametriaButton, {
103
- props: { disabled: true },
104
- slots: { default: 'Disabled' }
105
- })
106
-
107
- expect(wrapper.attributes('disabled')).toBeDefined()
108
- expect(wrapper.classes()).toContain('datametria-button--disabled')
109
- })
110
-
111
- it('should show loading spinner', () => {
112
- const wrapper = mount(DatametriaButton, {
113
- props: { loading: true },
114
- slots: { default: 'Loading' }
115
- })
116
-
117
- expect(wrapper.find('.spinner').exists()).toBe(true)
118
- expect(wrapper.attributes('aria-busy')).toBe('true')
119
- })
120
-
121
- it('should be disabled when loading', () => {
122
- const wrapper = mount(DatametriaButton, {
123
- props: { loading: true },
124
- slots: { default: 'Loading' }
125
- })
126
-
127
- expect(wrapper.attributes('disabled')).toBeDefined()
128
- })
129
-
130
- it('should render full width', () => {
131
- const wrapper = mount(DatametriaButton, {
132
- props: { fullWidth: true },
133
- slots: { default: 'Full Width' }
134
- })
135
-
136
- expect(wrapper.classes()).toContain('datametria-button--full-width')
137
- })
138
- })
139
-
140
- describe('Button Types', () => {
141
- it('should render as button type by default', () => {
142
- const wrapper = mount(DatametriaButton, {
143
- slots: { default: 'Button' }
144
- })
145
-
146
- expect(wrapper.attributes('type')).toBe('button')
147
- })
148
-
149
- it('should render as submit type', () => {
150
- const wrapper = mount(DatametriaButton, {
151
- props: { type: 'submit' },
152
- slots: { default: 'Submit' }
153
- })
154
-
155
- expect(wrapper.attributes('type')).toBe('submit')
156
- })
157
-
158
- it('should render as reset type', () => {
159
- const wrapper = mount(DatametriaButton, {
160
- props: { type: 'reset' },
161
- slots: { default: 'Reset' }
162
- })
163
-
164
- expect(wrapper.attributes('type')).toBe('reset')
165
- })
166
- })
167
-
168
- describe('Events', () => {
169
- it('should emit click event', async () => {
170
- const wrapper = mount(DatametriaButton, {
171
- slots: { default: 'Click' }
172
- })
173
-
174
- await wrapper.trigger('click')
175
-
176
- expect(wrapper.emitted('click')).toBeTruthy()
177
- expect(wrapper.emitted('click')?.[0]).toBeDefined()
178
- })
179
-
180
- it('should not emit click when disabled', async () => {
181
- const wrapper = mount(DatametriaButton, {
182
- props: { disabled: true },
183
- slots: { default: 'Disabled' }
184
- })
185
-
186
- await wrapper.trigger('click')
187
-
188
- expect(wrapper.emitted('click')).toBeFalsy()
189
- })
190
-
191
- it('should not emit click when loading', async () => {
192
- const wrapper = mount(DatametriaButton, {
193
- props: { loading: true },
194
- slots: { default: 'Loading' }
195
- })
196
-
197
- await wrapper.trigger('click')
198
-
199
- expect(wrapper.emitted('click')).toBeFalsy()
200
- })
201
- })
202
-
203
- describe('Accessibility', () => {
204
- it('should have aria-disabled when disabled', () => {
205
- const wrapper = mount(DatametriaButton, {
206
- props: { disabled: true },
207
- slots: { default: 'Disabled' }
208
- })
209
-
210
- expect(wrapper.attributes('aria-disabled')).toBe('true')
211
- })
212
-
213
- it('should have aria-busy when loading', () => {
214
- const wrapper = mount(DatametriaButton, {
215
- props: { loading: true },
216
- slots: { default: 'Loading' }
217
- })
218
-
219
- expect(wrapper.attributes('aria-busy')).toBe('true')
220
- })
221
-
222
- it('should have spinner with role and label', () => {
223
- const wrapper = mount(DatametriaButton, {
224
- props: { loading: true },
225
- slots: { default: 'Loading' }
226
- })
227
-
228
- const spinner = wrapper.find('.spinner')
229
- expect(spinner.attributes('role')).toBe('status')
230
- expect(spinner.attributes('aria-label')).toBe('Carregando')
231
- })
232
- })
233
-
234
- describe('CSS Variables Integration', () => {
235
- it('should use CSS variables for styling', () => {
236
- const wrapper = mount(DatametriaButton, {
237
- slots: { default: 'Button' }
238
- })
239
-
240
- const button = wrapper.find('button')
241
- const style = getComputedStyle(button.element)
242
-
243
- // Verifica que o componente está pronto para usar CSS variables
244
- expect(button.classes()).toContain('datametria-button')
245
- })
246
-
247
- it('should apply variant classes for theming', () => {
248
- const wrapper = mount(DatametriaButton, {
249
- props: { variant: ButtonVariant.PRIMARY },
250
- slots: { default: 'Primary' }
251
- })
252
-
253
- expect(wrapper.classes()).toContain('datametria-button--primary')
254
- })
255
- })
256
-
257
- describe('Backward Compatibility', () => {
258
- it('should maintain existing API', () => {
259
- const wrapper = mount(DatametriaButton, {
260
- props: {
261
- variant: ButtonVariant.PRIMARY,
262
- size: ButtonSize.MD,
263
- disabled: false,
264
- loading: false,
265
- fullWidth: false,
266
- type: 'button'
267
- },
268
- slots: { default: 'Button' }
269
- })
270
-
271
- expect(wrapper.exists()).toBe(true)
272
- })
273
-
274
- it('should work without ThemeProvider (fallback values)', () => {
275
- const wrapper = mount(DatametriaButton, {
276
- slots: { default: 'Button' }
277
- })
278
-
279
- expect(wrapper.find('button').exists()).toBe(true)
280
- expect(wrapper.classes()).toContain('datametria-button--primary')
281
- })
282
- })
283
- })
1
+ /**
2
+ * DatametriaButton Tests
3
+ * @author Vander Loto - CTO DATAMETRIA
4
+ * @date 13/11/2025
5
+ */
6
+
7
+ import { describe, it, expect } from 'vitest'
8
+ import { mount } from '@vue/test-utils'
9
+ import DatametriaButton from '../DatametriaButton.vue'
10
+ import { ButtonVariant, ButtonSize } from '../../types'
11
+
12
+ describe('DatametriaButton', () => {
13
+ describe('Rendering', () => {
14
+ it('should render button with text', () => {
15
+ const wrapper = mount(DatametriaButton, {
16
+ slots: { default: 'Click me' }
17
+ })
18
+
19
+ expect(wrapper.text()).toContain('Click me')
20
+ expect(wrapper.find('button').exists()).toBe(true)
21
+ })
22
+
23
+ it('should render with default variant and size', () => {
24
+ const wrapper = mount(DatametriaButton, {
25
+ slots: { default: 'Button' }
26
+ })
27
+
28
+ expect(wrapper.classes()).toContain('datametria-button--primary')
29
+ expect(wrapper.classes()).toContain('datametria-button--md')
30
+ })
31
+ })
32
+
33
+ describe('Variants', () => {
34
+ it('should render primary variant', () => {
35
+ const wrapper = mount(DatametriaButton, {
36
+ props: { variant: ButtonVariant.PRIMARY },
37
+ slots: { default: 'Primary' }
38
+ })
39
+
40
+ expect(wrapper.classes()).toContain('datametria-button--primary')
41
+ })
42
+
43
+ it('should render secondary variant', () => {
44
+ const wrapper = mount(DatametriaButton, {
45
+ props: { variant: ButtonVariant.SECONDARY },
46
+ slots: { default: 'Secondary' }
47
+ })
48
+
49
+ expect(wrapper.classes()).toContain('datametria-button--secondary')
50
+ })
51
+
52
+ it('should render outline variant', () => {
53
+ const wrapper = mount(DatametriaButton, {
54
+ props: { variant: ButtonVariant.OUTLINE },
55
+ slots: { default: 'Outline' }
56
+ })
57
+
58
+ expect(wrapper.classes()).toContain('datametria-button--outline')
59
+ })
60
+
61
+ it('should render ghost variant', () => {
62
+ const wrapper = mount(DatametriaButton, {
63
+ props: { variant: ButtonVariant.GHOST },
64
+ slots: { default: 'Ghost' }
65
+ })
66
+
67
+ expect(wrapper.classes()).toContain('datametria-button--ghost')
68
+ })
69
+ })
70
+
71
+ describe('Sizes', () => {
72
+ it('should render small size', () => {
73
+ const wrapper = mount(DatametriaButton, {
74
+ props: { size: ButtonSize.SM },
75
+ slots: { default: 'Small' }
76
+ })
77
+
78
+ expect(wrapper.classes()).toContain('datametria-button--sm')
79
+ })
80
+
81
+ it('should render medium size', () => {
82
+ const wrapper = mount(DatametriaButton, {
83
+ props: { size: ButtonSize.MD },
84
+ slots: { default: 'Medium' }
85
+ })
86
+
87
+ expect(wrapper.classes()).toContain('datametria-button--md')
88
+ })
89
+
90
+ it('should render large size', () => {
91
+ const wrapper = mount(DatametriaButton, {
92
+ props: { size: ButtonSize.LG },
93
+ slots: { default: 'Large' }
94
+ })
95
+
96
+ expect(wrapper.classes()).toContain('datametria-button--lg')
97
+ })
98
+ })
99
+
100
+ describe('States', () => {
101
+ it('should be disabled when disabled prop is true', () => {
102
+ const wrapper = mount(DatametriaButton, {
103
+ props: { disabled: true },
104
+ slots: { default: 'Disabled' }
105
+ })
106
+
107
+ expect(wrapper.attributes('disabled')).toBeDefined()
108
+ expect(wrapper.classes()).toContain('datametria-button--disabled')
109
+ })
110
+
111
+ it('should show loading spinner', () => {
112
+ const wrapper = mount(DatametriaButton, {
113
+ props: { loading: true },
114
+ slots: { default: 'Loading' }
115
+ })
116
+
117
+ expect(wrapper.find('.spinner').exists()).toBe(true)
118
+ expect(wrapper.attributes('aria-busy')).toBe('true')
119
+ })
120
+
121
+ it('should be disabled when loading', () => {
122
+ const wrapper = mount(DatametriaButton, {
123
+ props: { loading: true },
124
+ slots: { default: 'Loading' }
125
+ })
126
+
127
+ expect(wrapper.attributes('disabled')).toBeDefined()
128
+ })
129
+
130
+ it('should render full width', () => {
131
+ const wrapper = mount(DatametriaButton, {
132
+ props: { fullWidth: true },
133
+ slots: { default: 'Full Width' }
134
+ })
135
+
136
+ expect(wrapper.classes()).toContain('datametria-button--full-width')
137
+ })
138
+ })
139
+
140
+ describe('Button Types', () => {
141
+ it('should render as button type by default', () => {
142
+ const wrapper = mount(DatametriaButton, {
143
+ slots: { default: 'Button' }
144
+ })
145
+
146
+ expect(wrapper.attributes('type')).toBe('button')
147
+ })
148
+
149
+ it('should render as submit type', () => {
150
+ const wrapper = mount(DatametriaButton, {
151
+ props: { type: 'submit' },
152
+ slots: { default: 'Submit' }
153
+ })
154
+
155
+ expect(wrapper.attributes('type')).toBe('submit')
156
+ })
157
+
158
+ it('should render as reset type', () => {
159
+ const wrapper = mount(DatametriaButton, {
160
+ props: { type: 'reset' },
161
+ slots: { default: 'Reset' }
162
+ })
163
+
164
+ expect(wrapper.attributes('type')).toBe('reset')
165
+ })
166
+ })
167
+
168
+ describe('Events', () => {
169
+ it('should emit click event', async () => {
170
+ const wrapper = mount(DatametriaButton, {
171
+ slots: { default: 'Click' }
172
+ })
173
+
174
+ await wrapper.trigger('click')
175
+
176
+ expect(wrapper.emitted('click')).toBeTruthy()
177
+ expect(wrapper.emitted('click')?.[0]).toBeDefined()
178
+ })
179
+
180
+ it('should not emit click when disabled', async () => {
181
+ const wrapper = mount(DatametriaButton, {
182
+ props: { disabled: true },
183
+ slots: { default: 'Disabled' }
184
+ })
185
+
186
+ await wrapper.trigger('click')
187
+
188
+ expect(wrapper.emitted('click')).toBeFalsy()
189
+ })
190
+
191
+ it('should not emit click when loading', async () => {
192
+ const wrapper = mount(DatametriaButton, {
193
+ props: { loading: true },
194
+ slots: { default: 'Loading' }
195
+ })
196
+
197
+ await wrapper.trigger('click')
198
+
199
+ expect(wrapper.emitted('click')).toBeFalsy()
200
+ })
201
+ })
202
+
203
+ describe('Accessibility', () => {
204
+ it('should have aria-disabled when disabled', () => {
205
+ const wrapper = mount(DatametriaButton, {
206
+ props: { disabled: true },
207
+ slots: { default: 'Disabled' }
208
+ })
209
+
210
+ expect(wrapper.attributes('aria-disabled')).toBe('true')
211
+ })
212
+
213
+ it('should have aria-busy when loading', () => {
214
+ const wrapper = mount(DatametriaButton, {
215
+ props: { loading: true },
216
+ slots: { default: 'Loading' }
217
+ })
218
+
219
+ expect(wrapper.attributes('aria-busy')).toBe('true')
220
+ })
221
+
222
+ it('should have spinner with role and label', () => {
223
+ const wrapper = mount(DatametriaButton, {
224
+ props: { loading: true },
225
+ slots: { default: 'Loading' }
226
+ })
227
+
228
+ const spinner = wrapper.find('.spinner')
229
+ expect(spinner.attributes('role')).toBe('status')
230
+ expect(spinner.attributes('aria-label')).toBe('Carregando')
231
+ })
232
+ })
233
+
234
+ describe('CSS Variables Integration', () => {
235
+ it('should use CSS variables for styling', () => {
236
+ const wrapper = mount(DatametriaButton, {
237
+ slots: { default: 'Button' }
238
+ })
239
+
240
+ const button = wrapper.find('button')
241
+ const style = getComputedStyle(button.element)
242
+
243
+ // Verifica que o componente está pronto para usar CSS variables
244
+ expect(button.classes()).toContain('datametria-button')
245
+ })
246
+
247
+ it('should apply variant classes for theming', () => {
248
+ const wrapper = mount(DatametriaButton, {
249
+ props: { variant: ButtonVariant.PRIMARY },
250
+ slots: { default: 'Primary' }
251
+ })
252
+
253
+ expect(wrapper.classes()).toContain('datametria-button--primary')
254
+ })
255
+ })
256
+
257
+ describe('Backward Compatibility', () => {
258
+ it('should maintain existing API', () => {
259
+ const wrapper = mount(DatametriaButton, {
260
+ props: {
261
+ variant: ButtonVariant.PRIMARY,
262
+ size: ButtonSize.MD,
263
+ disabled: false,
264
+ loading: false,
265
+ fullWidth: false,
266
+ type: 'button'
267
+ },
268
+ slots: { default: 'Button' }
269
+ })
270
+
271
+ expect(wrapper.exists()).toBe(true)
272
+ })
273
+
274
+ it('should work without ThemeProvider (fallback values)', () => {
275
+ const wrapper = mount(DatametriaButton, {
276
+ slots: { default: 'Button' }
277
+ })
278
+
279
+ expect(wrapper.find('button').exists()).toBe(true)
280
+ expect(wrapper.classes()).toContain('datametria-button--primary')
281
+ })
282
+ })
283
+ })