@zap-wunschlachen/wl-shared-components 1.0.0

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 (254) hide show
  1. package/.github/workflows/playwright.yml +215 -0
  2. package/.github/workflows/static.yml +62 -0
  3. package/.prettierrc +5 -0
  4. package/.storybook/main.ts +18 -0
  5. package/.storybook/preview.ts +37 -0
  6. package/.storybook/storyWrapper.vue +18 -0
  7. package/.storybook/withVuetifyTheme.decorator.ts +21 -0
  8. package/App.vue +95 -0
  9. package/README.md +56 -0
  10. package/heroicons.ts +75 -0
  11. package/index.html +19 -0
  12. package/package.json +66 -0
  13. package/playwright.config.ts +35 -0
  14. package/public/audio/dummy_pink_noise.wav +0 -0
  15. package/public/background.svg +60 -0
  16. package/public/javascript.svg +1 -0
  17. package/public/style.css +187 -0
  18. package/public/technologies.svg +22 -0
  19. package/src/assets/css/base.css +235 -0
  20. package/src/assets/css/variables.css +96 -0
  21. package/src/assets/fonts/Outfit-Black.ttf +0 -0
  22. package/src/assets/fonts/Outfit-Bold.ttf +0 -0
  23. package/src/assets/fonts/Outfit-ExtraBold.ttf +0 -0
  24. package/src/assets/fonts/Outfit-ExtraLight.ttf +0 -0
  25. package/src/assets/fonts/Outfit-Light.ttf +0 -0
  26. package/src/assets/fonts/Outfit-Medium.ttf +0 -0
  27. package/src/assets/fonts/Outfit-Regular.ttf +0 -0
  28. package/src/assets/fonts/Outfit-SemiBold.ttf +0 -0
  29. package/src/assets/fonts/Outfit-Thin.ttf +0 -0
  30. package/src/components/Accordion/Accordion.css +59 -0
  31. package/src/components/Accordion/AccordionGroup.vue +51 -0
  32. package/src/components/Accordion/AccordionItem.vue +66 -0
  33. package/src/components/Appointment/Card/Actions.css +30 -0
  34. package/src/components/Appointment/Card/Actions.vue +66 -0
  35. package/src/components/Appointment/Card/Card.css +49 -0
  36. package/src/components/Appointment/Card/Card.vue +55 -0
  37. package/src/components/Appointment/Card/Details.css +51 -0
  38. package/src/components/Appointment/Card/Details.vue +44 -0
  39. package/src/components/Audio/Audio.vue +188 -0
  40. package/src/components/Audio/Waveform.vue +118 -0
  41. package/src/components/Button/Button.vue +119 -0
  42. package/src/components/CheckBox/CheckBox.css +185 -0
  43. package/src/components/CheckBox/Checkbox.vue +130 -0
  44. package/src/components/DateInput/DateInput.css +3 -0
  45. package/src/components/DateInput/DateInput.vue +263 -0
  46. package/src/components/Dialog/Dialog.css +6 -0
  47. package/src/components/Dialog/Dialog.vue +29 -0
  48. package/src/components/EditField/EditField.css +20 -0
  49. package/src/components/EditField/EditField.vue +202 -0
  50. package/src/components/IconBullet/IconBullet.vue +86 -0
  51. package/src/components/IconBullet/IconBulletList.vue +41 -0
  52. package/src/components/Icons/Audio/CloudFailed.vue +21 -0
  53. package/src/components/Icons/Audio/CloudSaved.vue +22 -0
  54. package/src/components/Icons/Audio/Delete.vue +16 -0
  55. package/src/components/Icons/Audio/Pause.vue +19 -0
  56. package/src/components/Icons/Audio/Play.vue +16 -0
  57. package/src/components/Icons/CalendarNotification.vue +126 -0
  58. package/src/components/Icons/Chair.vue +32 -0
  59. package/src/components/Icons/ChairNotification.vue +35 -0
  60. package/src/components/Icons/Circle.vue +66 -0
  61. package/src/components/Icons/FavIcon.vue +22 -0
  62. package/src/components/Icons/FilledCircle.vue +11 -0
  63. package/src/components/Icons/Group3.vue +46 -0
  64. package/src/components/Icons/RingNotification.vue +54 -0
  65. package/src/components/Icons/SolidArrowRight.vue +14 -0
  66. package/src/components/Icons/calendar.vue +17 -0
  67. package/src/components/Icons/checkbox.vue +19 -0
  68. package/src/components/Icons/outlineChecked.vue +27 -0
  69. package/src/components/Icons/play.vue +6 -0
  70. package/src/components/Input/Input.css +187 -0
  71. package/src/components/Input/Input.vue +247 -0
  72. package/src/components/Laboratory/AppointmentCard/AppointmentCard.css +7 -0
  73. package/src/components/Laboratory/AppointmentCard/AppointmentCard.vue +116 -0
  74. package/src/components/Laboratory/ChatBoxImage/ChatBoxImage.vue +81 -0
  75. package/src/components/Laboratory/ChatMessage/ChatMessage.vue +113 -0
  76. package/src/components/Laboratory/ChatMessage/ChatMessageBadge.css +4 -0
  77. package/src/components/Laboratory/ChatMessage/ChatMessageBadge.vue +99 -0
  78. package/src/components/Laboratory/ChatNotification/ChatNotification.vue +130 -0
  79. package/src/components/Laboratory/DocumentCard/DocumentCard.css +3 -0
  80. package/src/components/Laboratory/DocumentCard/DocumentCard.vue +50 -0
  81. package/src/components/Laboratory/DocumentCard/DocumentCardItem.vue +53 -0
  82. package/src/components/Laboratory/InfoCard/InfoCard.vue +162 -0
  83. package/src/components/Laboratory/MainColumnsBar/MainColumnsBar.vue +102 -0
  84. package/src/components/Laboratory/ProgressCircle/ProgressCircle.vue +152 -0
  85. package/src/components/Laboratory/ProgressLinear/ProgressLinear.css +33 -0
  86. package/src/components/Laboratory/ProgressLinear/ProgressLinear.vue +75 -0
  87. package/src/components/Laboratory/SelectionColumnBar/SelectionColumnBar.vue +92 -0
  88. package/src/components/Laboratory/StatusNotification/StatusNotification.vue +49 -0
  89. package/src/components/Laboratory/TagLabel/TagLabel.vue +126 -0
  90. package/src/components/Laboratory/TagLabelGroup/TagLabelGroup.vue +97 -0
  91. package/src/components/Laboratory/TicketCard/TicketCard.css +3 -0
  92. package/src/components/Laboratory/TicketCard/TicketCard.vue +143 -0
  93. package/src/components/Laboratory/TimeLine/TimeLineEvent.css +18 -0
  94. package/src/components/Laboratory/TimeLine/TimeLineEvent.vue +119 -0
  95. package/src/components/Laboratory/TimeLine/Timeline.css +4 -0
  96. package/src/components/Laboratory/TimeLine/Timeline.vue +30 -0
  97. package/src/components/Modal/Modal.css +6 -0
  98. package/src/components/Modal/Modal.vue +23 -0
  99. package/src/components/NotificationBubble/NotificationBubble.css +4 -0
  100. package/src/components/NotificationBubble/NotificationBubble.vue +90 -0
  101. package/src/components/OtpInput/OtpInput.css +39 -0
  102. package/src/components/OtpInput/OtpInput.vue +144 -0
  103. package/src/components/PhoneInput/PhoneInput.css +32 -0
  104. package/src/components/PhoneInput/PhoneInput.vue +114 -0
  105. package/src/components/Select/Select.css +150 -0
  106. package/src/components/Select/Select.vue +304 -0
  107. package/src/components/TextArea/TextArea.css +3 -0
  108. package/src/components/TextArea/TextArea.vue +126 -0
  109. package/src/components/TickBox/TickBox.css +49 -0
  110. package/src/components/TickBox/TickBox.vue +126 -0
  111. package/src/components/index.ts +20 -0
  112. package/src/constants/buttonEnums.ts +0 -0
  113. package/src/constants/iconEnums.ts +4 -0
  114. package/src/i18n/i18n.ts +16 -0
  115. package/src/i18n/locales/de.json +19 -0
  116. package/src/i18n/locales/en.json +19 -0
  117. package/src/index.ts +31 -0
  118. package/src/main.ts +11 -0
  119. package/src/plugins/vuetify.ts +131 -0
  120. package/src/shims-vue.d.ts +10 -0
  121. package/src/stories/Accordion.stories.ts +650 -0
  122. package/src/stories/Audio.stories.ts +29 -0
  123. package/src/stories/Button.stories.ts +263 -0
  124. package/src/stories/CheckBox.stories.ts +348 -0
  125. package/src/stories/DateInput.stories.ts +54 -0
  126. package/src/stories/Dialog.stories.ts +147 -0
  127. package/src/stories/EditField.stories.ts +79 -0
  128. package/src/stories/IconBullet/IconBullet.stories.ts +201 -0
  129. package/src/stories/IconBullet/IconBulletList.stories.ts +275 -0
  130. package/src/stories/Input.stories.ts +351 -0
  131. package/src/stories/Laboratory/Cards/AppointmentCard/AppointmentCard.stories.ts +260 -0
  132. package/src/stories/Laboratory/Cards/DocumentCard/DocumentCard.stories.ts +176 -0
  133. package/src/stories/Laboratory/Cards/DocumentCard/DocumentCardItem.stories.ts +119 -0
  134. package/src/stories/Laboratory/Cards/InfoCard/InfoCard.stories.ts +320 -0
  135. package/src/stories/Laboratory/Cards/TicketCard/TicketCard.stories.ts +335 -0
  136. package/src/stories/Laboratory/Chat/ChatBoxImage.stories.ts +82 -0
  137. package/src/stories/Laboratory/Chat/ChatMessage.stories.ts +198 -0
  138. package/src/stories/Laboratory/Chat/ChatMessageBadge.stories.ts +204 -0
  139. package/src/stories/Laboratory/Chat/ChatNotification.stories.ts +144 -0
  140. package/src/stories/Laboratory/Chat/ProgressLinear.stories.ts +186 -0
  141. package/src/stories/Laboratory/Chat/StatusNotification.stories.ts +111 -0
  142. package/src/stories/Laboratory/MainColumnsBar.stories.ts +48 -0
  143. package/src/stories/Laboratory/ProgressCircle.stories.ts +261 -0
  144. package/src/stories/Laboratory/SelectionColumnBar.stories.ts +234 -0
  145. package/src/stories/Laboratory/TagLabel.stories.ts +418 -0
  146. package/src/stories/Laboratory/TagLabelGroup.stories.ts +234 -0
  147. package/src/stories/Laboratory/Timeline.stories.ts +403 -0
  148. package/src/stories/NotificationBubble.stories.ts +194 -0
  149. package/src/stories/OtpInput.stories.ts +101 -0
  150. package/src/stories/PhoneInput.stories.ts +53 -0
  151. package/src/stories/Select.stories.ts +419 -0
  152. package/src/stories/TextArea.stories.ts +112 -0
  153. package/src/stories/TickBox.stories.ts +294 -0
  154. package/src/stories/assets/accessibility.png +0 -0
  155. package/src/stories/assets/accessibility.svg +1 -0
  156. package/src/stories/assets/addon-library.png +0 -0
  157. package/src/stories/assets/assets.png +0 -0
  158. package/src/stories/assets/avif-test-image.avif +0 -0
  159. package/src/stories/assets/context.png +0 -0
  160. package/src/stories/assets/discord.svg +1 -0
  161. package/src/stories/assets/docs.png +0 -0
  162. package/src/stories/assets/figma-plugin.png +0 -0
  163. package/src/stories/assets/github.svg +1 -0
  164. package/src/stories/assets/share.png +0 -0
  165. package/src/stories/assets/styling.png +0 -0
  166. package/src/stories/assets/testing.png +0 -0
  167. package/src/stories/assets/theming.png +0 -0
  168. package/src/stories/assets/tutorials.svg +1 -0
  169. package/src/stories/assets/youtube.svg +1 -0
  170. package/src/stories/v-icon.stories.ts +91 -0
  171. package/src/types/index.ts +21 -0
  172. package/src/vite-env.d.ts +1 -0
  173. package/tests/e2e/README.md +221 -0
  174. package/tests/e2e/accessibility.spec.ts +639 -0
  175. package/tests/e2e/accordion.spec.ts +42 -0
  176. package/tests/e2e/additional-components.spec.ts +438 -0
  177. package/tests/e2e/all-components.spec.ts +135 -0
  178. package/tests/e2e/button-fixed.spec.ts +59 -0
  179. package/tests/e2e/button.spec.ts +76 -0
  180. package/tests/e2e/checkbox.spec.ts +50 -0
  181. package/tests/e2e/date-input.spec.ts +46 -0
  182. package/tests/e2e/debug.spec.ts +52 -0
  183. package/tests/e2e/dialog.spec.ts +58 -0
  184. package/tests/e2e/input.spec.ts +55 -0
  185. package/tests/e2e/laboratory-components.spec.ts +321 -0
  186. package/tests/e2e/otp-input.spec.ts +50 -0
  187. package/tests/e2e/select.spec.ts +52 -0
  188. package/tests/e2e/storybook-utils.ts +59 -0
  189. package/tests/e2e/test-basic.spec.ts +34 -0
  190. package/tests/e2e/visual-regression.spec.ts +351 -0
  191. package/tests/unit/components/Accordion/AccordionGroup.spec.ts +343 -0
  192. package/tests/unit/components/Accordion/AccordionItem.spec.ts +384 -0
  193. package/tests/unit/components/Audio/Audio.spec.ts +404 -0
  194. package/tests/unit/components/Audio/Waveform.spec.ts +484 -0
  195. package/tests/unit/components/Core/Button.spec.ts +337 -0
  196. package/tests/unit/components/Core/Checkbox.spec.ts +545 -0
  197. package/tests/unit/components/Core/DateInput.spec.ts +691 -0
  198. package/tests/unit/components/Core/Dialog.spec.ts +486 -0
  199. package/tests/unit/components/Core/EditField.spec.ts +783 -0
  200. package/tests/unit/components/Core/Input.spec.ts +513 -0
  201. package/tests/unit/components/Core/Modal.spec.ts +519 -0
  202. package/tests/unit/components/Core/NotificationBubble.spec.ts +607 -0
  203. package/tests/unit/components/Core/OtpInput.spec.ts +709 -0
  204. package/tests/unit/components/Core/PhoneInput.spec.ts +620 -0
  205. package/tests/unit/components/Core/Select.spec.ts +713 -0
  206. package/tests/unit/components/Core/TextArea.spec.ts +566 -0
  207. package/tests/unit/components/Core/TickBox.spec.ts +780 -0
  208. package/tests/unit/components/IconBullet/IconBullet.spec.ts +357 -0
  209. package/tests/unit/components/IconBullet/IconBulletList.spec.ts +372 -0
  210. package/tests/unit/components/Icons/Audio/CloudFailed.spec.ts +109 -0
  211. package/tests/unit/components/Icons/Audio/CloudSaved.spec.ts +150 -0
  212. package/tests/unit/components/Icons/Audio/Delete.spec.ts +159 -0
  213. package/tests/unit/components/Icons/Audio/Pause.spec.ts +209 -0
  214. package/tests/unit/components/Icons/Audio/Play.spec.ts +218 -0
  215. package/tests/unit/components/Icons/CalendarNotification.spec.ts +187 -0
  216. package/tests/unit/components/Icons/Chair.spec.ts +235 -0
  217. package/tests/unit/components/Icons/ChairNotification.spec.ts +312 -0
  218. package/tests/unit/components/Icons/Circle.spec.ts +256 -0
  219. package/tests/unit/components/Icons/FavIcon.spec.ts +252 -0
  220. package/tests/unit/components/Icons/FilledCircle.spec.ts +275 -0
  221. package/tests/unit/components/Icons/Group3.spec.ts +356 -0
  222. package/tests/unit/components/Icons/RingNotification.spec.ts +394 -0
  223. package/tests/unit/components/Icons/calendar.spec.ts +287 -0
  224. package/tests/unit/components/Icons/checkbox.spec.ts +316 -0
  225. package/tests/unit/components/Icons/outlineChecked.spec.ts +435 -0
  226. package/tests/unit/components/Icons/play.spec.ts +309 -0
  227. package/tests/unit/components/Laboratory/AppointmentCard.spec.ts +168 -0
  228. package/tests/unit/components/Laboratory/ChatBoxImage.spec.ts +180 -0
  229. package/tests/unit/components/Laboratory/ChatMessage.spec.ts +264 -0
  230. package/tests/unit/components/Laboratory/ChatMessageBadge.spec.ts +283 -0
  231. package/tests/unit/components/Laboratory/ChatNotification.spec.ts +257 -0
  232. package/tests/unit/components/Laboratory/DocumentCard.spec.ts +229 -0
  233. package/tests/unit/components/Laboratory/DocumentCardItem.spec.ts +237 -0
  234. package/tests/unit/components/Laboratory/InfoCard.spec.ts +309 -0
  235. package/tests/unit/components/Laboratory/MainColumnsBar.spec.ts +252 -0
  236. package/tests/unit/components/Laboratory/ProgressCircle.spec.ts +291 -0
  237. package/tests/unit/components/Laboratory/ProgressLinear.spec.ts +276 -0
  238. package/tests/unit/components/Laboratory/SelectionColumnBar.spec.ts +289 -0
  239. package/tests/unit/components/Laboratory/StatusNotification.spec.ts +297 -0
  240. package/tests/unit/components/Laboratory/TagLabel.spec.ts +354 -0
  241. package/tests/unit/components/Laboratory/TagLabelGroup.spec.ts +378 -0
  242. package/tests/unit/components/Laboratory/TicketCard.spec.ts +352 -0
  243. package/tests/unit/components/Laboratory/TimeLineEvent.spec.ts +382 -0
  244. package/tests/unit/components/Laboratory/Timeline.spec.ts +420 -0
  245. package/tests/unit/constants/iconEnums.spec.ts +40 -0
  246. package/tests/unit/i18n/i18n.spec.ts +89 -0
  247. package/tests/unit/plugins/vuetify.spec.ts +221 -0
  248. package/tests/unit/setup.ts +190 -0
  249. package/tests/unit/src/components/index.spec.ts +193 -0
  250. package/tests/unit/src/index.spec.ts +183 -0
  251. package/tests/unit/src/main.spec.ts +152 -0
  252. package/tsconfig.json +26 -0
  253. package/vite.config.ts +29 -0
  254. package/vitest.config.ts +84 -0
@@ -0,0 +1,780 @@
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
+ import { mount } from '@vue/test-utils';
3
+ import TickBox from '@components/TickBox/TickBox.vue';
4
+
5
+ describe('TickBox', () => {
6
+ beforeEach(() => {
7
+ vi.clearAllMocks();
8
+ });
9
+
10
+ // Test default behavior and rendering
11
+ describe('Default Behavior', () => {
12
+ it('renders with required props', () => {
13
+ const wrapper = mount(TickBox, {
14
+ props: {
15
+ label: 'Test Label',
16
+ modelValue: false
17
+ }
18
+ });
19
+
20
+ expect(wrapper.find('[data-testid="root"]').exists()).toBe(true);
21
+ expect(wrapper.find('.tick-box').exists()).toBe(true);
22
+ expect(wrapper.vm.label).toBe('Test Label');
23
+ expect(wrapper.vm.modelValue).toBe(false);
24
+ expect(wrapper.vm.success).toBe(false);
25
+ expect(wrapper.vm.error).toBe(false);
26
+ expect(wrapper.vm.disabled).toBe(false);
27
+ expect(wrapper.vm.value).toBe(true);
28
+ expect(wrapper.vm.density).toBe('comfortable');
29
+ });
30
+
31
+ it('has data-testid for testing', () => {
32
+ const wrapper = mount(TickBox, {
33
+ props: {
34
+ label: 'Test',
35
+ modelValue: false
36
+ }
37
+ });
38
+
39
+ expect(wrapper.find('[data-testid="root"]').exists()).toBe(true);
40
+ });
41
+
42
+ it('applies tick-box CSS class', () => {
43
+ const wrapper = mount(TickBox, {
44
+ props: {
45
+ label: 'Test',
46
+ modelValue: false
47
+ }
48
+ });
49
+
50
+ expect(wrapper.find('.tick-box').exists()).toBe(true);
51
+ });
52
+
53
+ it('requires label prop', () => {
54
+ // This test verifies that label is marked as required
55
+ const wrapper = mount(TickBox, {
56
+ props: {
57
+ label: 'Required Label',
58
+ modelValue: false
59
+ }
60
+ });
61
+
62
+ expect(wrapper.vm.label).toBe('Required Label');
63
+ });
64
+
65
+ it('requires modelValue prop', () => {
66
+ // This test verifies that modelValue is marked as required
67
+ const wrapper = mount(TickBox, {
68
+ props: {
69
+ label: 'Test',
70
+ modelValue: true
71
+ }
72
+ });
73
+
74
+ expect(wrapper.vm.modelValue).toBe(true);
75
+ });
76
+ });
77
+
78
+ // Test v-model functionality
79
+ describe('v-model', () => {
80
+ it('handles boolean modelValue', () => {
81
+ const wrapper = mount(TickBox, {
82
+ props: {
83
+ label: 'Boolean Test',
84
+ modelValue: true
85
+ }
86
+ });
87
+
88
+ expect(wrapper.vm.internalValue).toBe(true);
89
+ });
90
+
91
+ it('handles false boolean modelValue', () => {
92
+ const wrapper = mount(TickBox, {
93
+ props: {
94
+ label: 'Boolean Test',
95
+ modelValue: false
96
+ }
97
+ });
98
+
99
+ expect(wrapper.vm.internalValue).toBe(false);
100
+ });
101
+
102
+ it('handles array modelValue', () => {
103
+ const wrapper = mount(TickBox, {
104
+ props: {
105
+ label: 'Array Test',
106
+ modelValue: ['option1', 'option2']
107
+ }
108
+ });
109
+
110
+ expect(wrapper.vm.internalValue).toEqual(['option1', 'option2']);
111
+ });
112
+
113
+ it('handles empty array modelValue', () => {
114
+ const wrapper = mount(TickBox, {
115
+ props: {
116
+ label: 'Empty Array Test',
117
+ modelValue: []
118
+ }
119
+ });
120
+
121
+ expect(wrapper.vm.internalValue).toEqual([]);
122
+ });
123
+
124
+ it('emits update:modelValue when internalValue changes', () => {
125
+ const wrapper = mount(TickBox, {
126
+ props: {
127
+ label: 'Emit Test',
128
+ modelValue: false
129
+ }
130
+ });
131
+
132
+ wrapper.vm.internalValue = true;
133
+
134
+ expect(wrapper.emitted('update:modelValue')).toBeTruthy();
135
+ expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([true]);
136
+ });
137
+
138
+ it('updates when modelValue prop changes', async () => {
139
+ const wrapper = mount(TickBox, {
140
+ props: {
141
+ label: 'Update Test',
142
+ modelValue: false
143
+ }
144
+ });
145
+
146
+ expect(wrapper.vm.internalValue).toBe(false);
147
+
148
+ await wrapper.setProps({ modelValue: true });
149
+
150
+ expect(wrapper.vm.internalValue).toBe(true);
151
+ });
152
+
153
+ it('handles array to boolean modelValue changes', async () => {
154
+ const wrapper = mount(TickBox, {
155
+ props: {
156
+ label: 'Type Change Test',
157
+ modelValue: []
158
+ }
159
+ });
160
+
161
+ expect(wrapper.vm.internalValue).toEqual([]);
162
+
163
+ await wrapper.setProps({ modelValue: true });
164
+
165
+ expect(wrapper.vm.internalValue).toBe(true);
166
+ });
167
+ });
168
+
169
+ // Test value prop
170
+ describe('Value Prop', () => {
171
+ it('uses default value of true', () => {
172
+ const wrapper = mount(TickBox, {
173
+ props: {
174
+ label: 'Default Value Test',
175
+ modelValue: false
176
+ }
177
+ });
178
+
179
+ expect(wrapper.vm.value).toBe(true);
180
+ });
181
+
182
+ it('accepts string value', () => {
183
+ const wrapper = mount(TickBox, {
184
+ props: {
185
+ label: 'String Value Test',
186
+ modelValue: false,
187
+ value: 'option1'
188
+ }
189
+ });
190
+
191
+ expect(wrapper.vm.value).toBe('option1');
192
+ });
193
+
194
+ it('accepts number value', () => {
195
+ const wrapper = mount(TickBox, {
196
+ props: {
197
+ label: 'Number Value Test',
198
+ modelValue: false,
199
+ value: 42
200
+ }
201
+ });
202
+
203
+ expect(wrapper.vm.value).toBe(42);
204
+ });
205
+
206
+ it('accepts boolean value', () => {
207
+ const wrapper = mount(TickBox, {
208
+ props: {
209
+ label: 'Boolean Value Test',
210
+ modelValue: false,
211
+ value: false
212
+ }
213
+ });
214
+
215
+ expect(wrapper.vm.value).toBe(false);
216
+ });
217
+ });
218
+
219
+ // Test state props
220
+ describe('State Props', () => {
221
+ it('handles success state', () => {
222
+ const wrapper = mount(TickBox, {
223
+ props: {
224
+ label: 'Success Test',
225
+ modelValue: false,
226
+ success: true
227
+ }
228
+ });
229
+
230
+ expect(wrapper.vm.success).toBe(true);
231
+ expect(wrapper.vm.error).toBe(false);
232
+ });
233
+
234
+ it('handles error state', () => {
235
+ const wrapper = mount(TickBox, {
236
+ props: {
237
+ label: 'Error Test',
238
+ modelValue: false,
239
+ error: true
240
+ }
241
+ });
242
+
243
+ expect(wrapper.vm.error).toBe(true);
244
+ expect(wrapper.vm.success).toBe(false);
245
+ });
246
+
247
+ it('handles disabled state', () => {
248
+ const wrapper = mount(TickBox, {
249
+ props: {
250
+ label: 'Disabled Test',
251
+ modelValue: false,
252
+ disabled: true
253
+ }
254
+ });
255
+
256
+ expect(wrapper.vm.disabled).toBe(true);
257
+ });
258
+
259
+ it('handles multiple states together', () => {
260
+ const wrapper = mount(TickBox, {
261
+ props: {
262
+ label: 'Multiple States Test',
263
+ modelValue: false,
264
+ success: true,
265
+ disabled: true
266
+ }
267
+ });
268
+
269
+ expect(wrapper.vm.success).toBe(true);
270
+ expect(wrapper.vm.disabled).toBe(true);
271
+ expect(wrapper.vm.error).toBe(false);
272
+ });
273
+
274
+ it('handles conflicting error and success states', () => {
275
+ const wrapper = mount(TickBox, {
276
+ props: {
277
+ label: 'Conflicting States Test',
278
+ modelValue: false,
279
+ success: true,
280
+ error: true
281
+ }
282
+ });
283
+
284
+ expect(wrapper.vm.success).toBe(true);
285
+ expect(wrapper.vm.error).toBe(true);
286
+ });
287
+ });
288
+
289
+ // Test density prop
290
+ describe('Density', () => {
291
+ it('uses default density of comfortable', () => {
292
+ const wrapper = mount(TickBox, {
293
+ props: {
294
+ label: 'Default Density Test',
295
+ modelValue: false
296
+ }
297
+ });
298
+
299
+ expect(wrapper.vm.density).toBe('comfortable');
300
+ });
301
+
302
+ it('accepts custom density', () => {
303
+ const wrapper = mount(TickBox, {
304
+ props: {
305
+ label: 'Custom Density Test',
306
+ modelValue: false,
307
+ density: 'compact'
308
+ }
309
+ });
310
+
311
+ expect(wrapper.vm.density).toBe('compact');
312
+ });
313
+
314
+ it('accepts all density variations', () => {
315
+ const densities = ['comfortable', 'compact', 'default'];
316
+
317
+ densities.forEach(density => {
318
+ const wrapper = mount(TickBox, {
319
+ props: {
320
+ label: `Density ${density} Test`,
321
+ modelValue: false,
322
+ density
323
+ }
324
+ });
325
+
326
+ expect(wrapper.vm.density).toBe(density);
327
+ });
328
+ });
329
+ });
330
+
331
+ // Test computed properties
332
+ describe('Computed Properties', () => {
333
+ describe('checkboxClass', () => {
334
+ it('returns default-state by default', () => {
335
+ const wrapper = mount(TickBox, {
336
+ props: {
337
+ label: 'Default Class Test',
338
+ modelValue: false
339
+ }
340
+ });
341
+
342
+ expect(wrapper.vm.checkboxClass).toBe('default-state');
343
+ expect(wrapper.find('.default-state').exists()).toBe(true);
344
+ });
345
+
346
+ it('returns error-state when error is true', () => {
347
+ const wrapper = mount(TickBox, {
348
+ props: {
349
+ label: 'Error Class Test',
350
+ modelValue: false,
351
+ error: true
352
+ }
353
+ });
354
+
355
+ expect(wrapper.vm.checkboxClass).toBe('error-state');
356
+ expect(wrapper.find('.error-state').exists()).toBe(true);
357
+ });
358
+
359
+ it('returns success-state when success is true', () => {
360
+ const wrapper = mount(TickBox, {
361
+ props: {
362
+ label: 'Success Class Test',
363
+ modelValue: false,
364
+ success: true
365
+ }
366
+ });
367
+
368
+ expect(wrapper.vm.checkboxClass).toBe('success-state');
369
+ expect(wrapper.find('.success-state').exists()).toBe(true);
370
+ });
371
+
372
+ it('prioritizes error over success', () => {
373
+ const wrapper = mount(TickBox, {
374
+ props: {
375
+ label: 'Priority Test',
376
+ modelValue: false,
377
+ success: true,
378
+ error: true
379
+ }
380
+ });
381
+
382
+ expect(wrapper.vm.checkboxClass).toBe('error-state');
383
+ expect(wrapper.find('.error-state').exists()).toBe(true);
384
+ });
385
+ });
386
+
387
+ describe('labelStyles', () => {
388
+ it('returns default color', () => {
389
+ const wrapper = mount(TickBox, {
390
+ props: {
391
+ label: 'Default Style Test',
392
+ modelValue: false
393
+ }
394
+ });
395
+
396
+ expect(wrapper.vm.labelStyles).toEqual({ color: 'var(--Dental-Blue-0)' });
397
+ });
398
+
399
+ it('returns error color when error is true', () => {
400
+ const wrapper = mount(TickBox, {
401
+ props: {
402
+ label: 'Error Style Test',
403
+ modelValue: false,
404
+ error: true
405
+ }
406
+ });
407
+
408
+ expect(wrapper.vm.labelStyles).toEqual({ color: 'var(--Error-Red-0)' });
409
+ });
410
+
411
+ it('returns success color when success is true', () => {
412
+ const wrapper = mount(TickBox, {
413
+ props: {
414
+ label: 'Success Style Test',
415
+ modelValue: false,
416
+ success: true
417
+ }
418
+ });
419
+
420
+ expect(wrapper.vm.labelStyles).toEqual({ color: 'var(--Success-Green-1)' });
421
+ });
422
+
423
+ it('prioritizes error color over success color', () => {
424
+ const wrapper = mount(TickBox, {
425
+ props: {
426
+ label: 'Priority Style Test',
427
+ modelValue: false,
428
+ success: true,
429
+ error: true
430
+ }
431
+ });
432
+
433
+ expect(wrapper.vm.labelStyles).toEqual({ color: 'var(--Error-Red-0)' });
434
+ });
435
+ });
436
+
437
+ describe('hoverColor', () => {
438
+ it('returns default color', () => {
439
+ const wrapper = mount(TickBox, {
440
+ props: {
441
+ label: 'Default Hover Test',
442
+ modelValue: false
443
+ }
444
+ });
445
+
446
+ expect(wrapper.vm.hoverColor).toBe('var(--Dental-Blue-0)');
447
+ });
448
+
449
+ it('returns error color when error is true', () => {
450
+ const wrapper = mount(TickBox, {
451
+ props: {
452
+ label: 'Error Hover Test',
453
+ modelValue: false,
454
+ error: true
455
+ }
456
+ });
457
+
458
+ expect(wrapper.vm.hoverColor).toBe('var(--Error-Red-0)');
459
+ });
460
+
461
+ it('returns success color when success is true', () => {
462
+ const wrapper = mount(TickBox, {
463
+ props: {
464
+ label: 'Success Hover Test',
465
+ modelValue: false,
466
+ success: true
467
+ }
468
+ });
469
+
470
+ expect(wrapper.vm.hoverColor).toBe('var(--Success-Green-1)');
471
+ });
472
+
473
+ it('prioritizes error color over success color', () => {
474
+ const wrapper = mount(TickBox, {
475
+ props: {
476
+ label: 'Priority Hover Test',
477
+ modelValue: false,
478
+ success: true,
479
+ error: true
480
+ }
481
+ });
482
+
483
+ expect(wrapper.vm.hoverColor).toBe('var(--Error-Red-0)');
484
+ });
485
+ });
486
+ });
487
+
488
+ // Test label slot
489
+ describe('Label Slot', () => {
490
+ it('renders label with default styles', () => {
491
+ const wrapper = mount(TickBox, {
492
+ props: {
493
+ label: 'Test Label',
494
+ modelValue: false
495
+ }
496
+ });
497
+
498
+ const labelSpan = wrapper.find('span');
499
+ expect(labelSpan.exists()).toBe(true);
500
+ expect(labelSpan.text()).toBe('Test Label');
501
+ });
502
+
503
+ it('applies dynamic styles to label', () => {
504
+ const wrapper = mount(TickBox, {
505
+ props: {
506
+ label: 'Styled Label',
507
+ modelValue: false,
508
+ error: true
509
+ }
510
+ });
511
+
512
+ const labelSpan = wrapper.find('span');
513
+ expect(labelSpan.exists()).toBe(true);
514
+ // The style attribute would be applied by Vue
515
+ expect(labelSpan.text()).toBe('Styled Label');
516
+ });
517
+
518
+ it('handles empty label', () => {
519
+ const wrapper = mount(TickBox, {
520
+ props: {
521
+ label: '',
522
+ modelValue: false
523
+ }
524
+ });
525
+
526
+ const labelSpan = wrapper.find('span');
527
+ expect(labelSpan.exists()).toBe(true);
528
+ expect(labelSpan.text()).toBe('');
529
+ });
530
+
531
+ it('handles long label text', () => {
532
+ const longLabel = 'This is a very long label that might wrap to multiple lines and should be handled gracefully by the component';
533
+ const wrapper = mount(TickBox, {
534
+ props: {
535
+ label: longLabel,
536
+ modelValue: false
537
+ }
538
+ });
539
+
540
+ const labelSpan = wrapper.find('span');
541
+ expect(labelSpan.text()).toBe(longLabel);
542
+ });
543
+ });
544
+
545
+ // Test Vuetify integration
546
+ describe('Vuetify Integration', () => {
547
+ it('passes props to v-checkbox correctly', () => {
548
+ const wrapper = mount(TickBox, {
549
+ props: {
550
+ label: 'Vuetify Test',
551
+ modelValue: true,
552
+ disabled: true,
553
+ value: 'test-value',
554
+ density: 'compact'
555
+ }
556
+ });
557
+
558
+ expect(wrapper.find('[data-testid="root"]').exists()).toBe(true);
559
+ expect(wrapper.vm.disabled).toBe(true);
560
+ expect(wrapper.vm.value).toBe('test-value');
561
+ expect(wrapper.vm.density).toBe('compact');
562
+ });
563
+
564
+ it('uses custom icons', () => {
565
+ const wrapper = mount(TickBox, {
566
+ props: {
567
+ label: 'Icon Test',
568
+ modelValue: false
569
+ }
570
+ });
571
+
572
+ // The component template specifies heroicons for true and false states
573
+ expect(wrapper.find('[data-testid="root"]').exists()).toBe(true);
574
+ });
575
+
576
+ it('applies color and base-color from hoverColor', () => {
577
+ const wrapper = mount(TickBox, {
578
+ props: {
579
+ label: 'Color Test',
580
+ modelValue: false,
581
+ success: true
582
+ }
583
+ });
584
+
585
+ expect(wrapper.vm.hoverColor).toBe('var(--Success-Green-1)');
586
+ });
587
+ });
588
+
589
+ // Test accessibility
590
+ describe('Accessibility', () => {
591
+ it('has data-testid for testing', () => {
592
+ const wrapper = mount(TickBox, {
593
+ props: {
594
+ label: 'Accessibility Test',
595
+ modelValue: false
596
+ }
597
+ });
598
+
599
+ expect(wrapper.find('[data-testid="root"]').exists()).toBe(true);
600
+ });
601
+
602
+ it('provides meaningful label text', () => {
603
+ const wrapper = mount(TickBox, {
604
+ props: {
605
+ label: 'I agree to the terms and conditions',
606
+ modelValue: false
607
+ }
608
+ });
609
+
610
+ expect(wrapper.vm.label).toBe('I agree to the terms and conditions');
611
+ expect(wrapper.find('span').text()).toBe('I agree to the terms and conditions');
612
+ });
613
+
614
+ it('maintains accessibility with disabled state', () => {
615
+ const wrapper = mount(TickBox, {
616
+ props: {
617
+ label: 'Disabled option',
618
+ modelValue: false,
619
+ disabled: true
620
+ }
621
+ });
622
+
623
+ expect(wrapper.vm.disabled).toBe(true);
624
+ expect(wrapper.find('span').text()).toBe('Disabled option');
625
+ });
626
+
627
+ it('provides visual feedback through states', () => {
628
+ const wrapper = mount(TickBox, {
629
+ props: {
630
+ label: 'Visual feedback test',
631
+ modelValue: false,
632
+ error: true
633
+ }
634
+ });
635
+
636
+ expect(wrapper.vm.error).toBe(true);
637
+ expect(wrapper.vm.checkboxClass).toBe('error-state');
638
+ expect(wrapper.vm.labelStyles.color).toBe('var(--Error-Red-0)');
639
+ });
640
+ });
641
+
642
+ // Test edge cases
643
+ describe('Edge Cases', () => {
644
+ it('handles special characters in label', () => {
645
+ const specialLabel = 'Special chars: !@#$%^&*()_+{}|:"<>?`~[]\\;\',./ ñáéíóú';
646
+ const wrapper = mount(TickBox, {
647
+ props: {
648
+ label: specialLabel,
649
+ modelValue: false
650
+ }
651
+ });
652
+
653
+ expect(wrapper.vm.label).toBe(specialLabel);
654
+ expect(wrapper.find('span').text()).toBe(specialLabel);
655
+ });
656
+
657
+ it('handles HTML entities in label', () => {
658
+ const htmlLabel = 'HTML entities: &lt;&gt;&amp;&quot;&#39;';
659
+ const wrapper = mount(TickBox, {
660
+ props: {
661
+ label: htmlLabel,
662
+ modelValue: false
663
+ }
664
+ });
665
+
666
+ expect(wrapper.vm.label).toBe(htmlLabel);
667
+ });
668
+
669
+ it('handles zero as value', () => {
670
+ const wrapper = mount(TickBox, {
671
+ props: {
672
+ label: 'Zero value test',
673
+ modelValue: [0],
674
+ value: 0
675
+ }
676
+ });
677
+
678
+ expect(wrapper.vm.value).toBe(0);
679
+ });
680
+
681
+ it('handles empty string as value', () => {
682
+ const wrapper = mount(TickBox, {
683
+ props: {
684
+ label: 'Empty string value test',
685
+ modelValue: false,
686
+ value: ''
687
+ }
688
+ });
689
+
690
+ expect(wrapper.vm.value).toBe('');
691
+ });
692
+
693
+ it('handles rapid state changes', async () => {
694
+ const wrapper = mount(TickBox, {
695
+ props: {
696
+ label: 'Rapid changes test',
697
+ modelValue: false
698
+ }
699
+ });
700
+
701
+ await wrapper.setProps({ success: true });
702
+ expect(wrapper.vm.checkboxClass).toBe('success-state');
703
+
704
+ await wrapper.setProps({ success: false, error: true });
705
+ expect(wrapper.vm.checkboxClass).toBe('error-state');
706
+
707
+ await wrapper.setProps({ error: false });
708
+ expect(wrapper.vm.checkboxClass).toBe('default-state');
709
+ });
710
+ });
711
+
712
+ // Test complex scenarios
713
+ describe('Complex Scenarios', () => {
714
+ it('works with all props configured', () => {
715
+ const wrapper = mount(TickBox, {
716
+ props: {
717
+ label: 'Complete configuration test',
718
+ modelValue: ['option1', 'option2'],
719
+ value: 'option1',
720
+ success: true,
721
+ disabled: false,
722
+ density: 'compact'
723
+ }
724
+ });
725
+
726
+ expect(wrapper.vm.label).toBe('Complete configuration test');
727
+ expect(wrapper.vm.modelValue).toEqual(['option1', 'option2']);
728
+ expect(wrapper.vm.value).toBe('option1');
729
+ expect(wrapper.vm.success).toBe(true);
730
+ expect(wrapper.vm.disabled).toBe(false);
731
+ expect(wrapper.vm.density).toBe('compact');
732
+ expect(wrapper.vm.checkboxClass).toBe('success-state');
733
+ expect(wrapper.vm.hoverColor).toBe('var(--Success-Green-1)');
734
+ });
735
+
736
+ it('handles state priority correctly in all combinations', () => {
737
+ // Test error takes priority
738
+ const errorPriorityWrapper = mount(TickBox, {
739
+ props: {
740
+ label: 'Priority test',
741
+ modelValue: false,
742
+ success: true,
743
+ error: true
744
+ }
745
+ });
746
+
747
+ expect(errorPriorityWrapper.vm.checkboxClass).toBe('error-state');
748
+ expect(errorPriorityWrapper.vm.hoverColor).toBe('var(--Error-Red-0)');
749
+ expect(errorPriorityWrapper.vm.labelStyles.color).toBe('var(--Error-Red-0)');
750
+ });
751
+
752
+ it('maintains reactive updates across all computed properties', async () => {
753
+ const wrapper = mount(TickBox, {
754
+ props: {
755
+ label: 'Reactive test',
756
+ modelValue: false
757
+ }
758
+ });
759
+
760
+ // Initial state
761
+ expect(wrapper.vm.checkboxClass).toBe('default-state');
762
+ expect(wrapper.vm.hoverColor).toBe('var(--Dental-Blue-0)');
763
+
764
+ // Change to success
765
+ await wrapper.setProps({ success: true });
766
+ expect(wrapper.vm.checkboxClass).toBe('success-state');
767
+ expect(wrapper.vm.hoverColor).toBe('var(--Success-Green-1)');
768
+
769
+ // Change to error (should override success)
770
+ await wrapper.setProps({ error: true });
771
+ expect(wrapper.vm.checkboxClass).toBe('error-state');
772
+ expect(wrapper.vm.hoverColor).toBe('var(--Error-Red-0)');
773
+
774
+ // Remove error but keep success
775
+ await wrapper.setProps({ error: false });
776
+ expect(wrapper.vm.checkboxClass).toBe('success-state');
777
+ expect(wrapper.vm.hoverColor).toBe('var(--Success-Green-1)');
778
+ });
779
+ });
780
+ });