@getmicdrop/svelte-components 2.0.4 → 2.0.6

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 (107) hide show
  1. package/dist/components/Alert/Alert.spec.js +170 -170
  2. package/dist/components/Badges/Badge.spec.js +103 -103
  3. package/dist/components/BottomSheet/BottomSheet.spec.js +127 -127
  4. package/dist/components/Breadcrumb/Breadcrumb.spec.js +120 -120
  5. package/dist/components/Button/Button.spec.js +211 -211
  6. package/dist/components/Button/ButtonSaveDemo.spec.js +48 -48
  7. package/dist/components/Calendar/Calendar.spec.js +131 -131
  8. package/dist/components/Calendar/QuarterView.spec.js +394 -394
  9. package/dist/components/Card.spec.js +47 -47
  10. package/dist/components/CropImage/CropImage.spec.js +216 -216
  11. package/dist/components/DarkModeToggle.spec.js +357 -357
  12. package/dist/components/ErrorDisplay.spec.js +69 -69
  13. package/dist/components/FormActions.spec.js +88 -88
  14. package/dist/components/FormValidationSummary.spec.js +203 -203
  15. package/dist/components/Icons/Icon.spec.js +175 -175
  16. package/dist/components/Icons/MoreHori.spec.js +67 -67
  17. package/dist/components/Icons/WarningIcon.spec.js +30 -30
  18. package/dist/components/Input/Input.spec.js +573 -573
  19. package/dist/components/Input/MultiSelect.spec.js +257 -257
  20. package/dist/components/Input/OTPInput.spec.js +238 -238
  21. package/dist/components/Input/Select.spec.js +218 -218
  22. package/dist/components/Layout/BottomNav.spec.js +130 -130
  23. package/dist/components/Layout/Header.spec.js +203 -203
  24. package/dist/components/Modal/ConfirmationModal.spec.js +191 -191
  25. package/dist/components/Modal/Modal.spec.js +95 -95
  26. package/dist/components/Modal/ModalStateManager.spec.js +100 -100
  27. package/dist/components/PageLoader.spec.js +54 -54
  28. package/dist/components/PasswordStrengthIndicator/PasswordStrengthIndicator.spec.js +173 -173
  29. package/dist/components/PlaceAutocomplete/PlaceAutocomplete.spec.js +300 -300
  30. package/dist/components/Spinner/Spinner.spec.js +75 -75
  31. package/dist/components/StatusIndicator/StatusIndicator.spec.js +129 -129
  32. package/dist/components/Toaster/Toaster.stories.svelte +1 -1
  33. package/dist/components/Toggle.spec.js +158 -158
  34. package/dist/components/ValidationError.spec.js +79 -79
  35. package/dist/components/pages/performers/AvailabilityCalendarModal.spec.js +606 -606
  36. package/dist/components/pages/performers/AvailabilityCalendarModal.svelte +4 -4
  37. package/dist/components/pages/performers/ModalShowInfo.spec.js +124 -124
  38. package/dist/components/pages/performers/ModalShowInfo.svelte +1 -1
  39. package/dist/components/pages/performers/PageBackButton.spec.js +89 -89
  40. package/dist/components/pages/performers/SectionHeader.spec.js +75 -75
  41. package/dist/components/pages/performers/ShowDetails.spec.js +166 -166
  42. package/dist/components/pages/performers/ShowItemCard.spec.js +793 -793
  43. package/dist/components/pages/performers/ShowItemCard.svelte +4 -4
  44. package/dist/components/pages/performers/SwitchOption.spec.js +127 -127
  45. package/dist/components/pages/performers/VenueInfo.spec.js +167 -167
  46. package/dist/components/pages/performers/VenueInfo.svelte +1 -1
  47. package/dist/components/pages/performers/VenueItemCard.spec.js +763 -763
  48. package/dist/components/pages/performers/VenueItemCard.svelte +4 -4
  49. package/dist/components/pages/profile/profile-form.spec.js +9 -9
  50. package/dist/components/pages/settings/tabs/CustomImageDropzone.svelte +3 -3
  51. package/dist/components/pages/shows/ShowList.spec.js +33 -33
  52. package/dist/components/pages/shows/TabContent.spec.js +90 -90
  53. package/dist/components/pages/shows/TabNavigation.spec.js +143 -143
  54. package/dist/config.js +5 -5
  55. package/dist/config.spec.js +29 -29
  56. package/dist/constants/formOptions.js +25 -25
  57. package/dist/constants/formOptions.spec.js +88 -88
  58. package/dist/index.js +111 -111
  59. package/dist/stores/auth.d.ts +9 -0
  60. package/dist/stores/auth.d.ts.map +1 -0
  61. package/dist/stores/auth.js +36 -0
  62. package/dist/stores/auth.spec.d.ts +2 -0
  63. package/dist/stores/auth.spec.d.ts.map +1 -0
  64. package/dist/stores/auth.spec.js +139 -0
  65. package/dist/stores/formDataStore.d.ts +17 -0
  66. package/dist/stores/formDataStore.d.ts.map +1 -0
  67. package/dist/stores/formDataStore.js +25 -0
  68. package/dist/stores/formDataStore.spec.d.ts +2 -0
  69. package/dist/stores/formDataStore.spec.d.ts.map +1 -0
  70. package/dist/stores/formDataStore.spec.js +257 -0
  71. package/dist/stores/formSave.d.ts +24 -0
  72. package/dist/stores/formSave.d.ts.map +1 -0
  73. package/dist/stores/formSave.js +132 -0
  74. package/dist/stores/formSave.spec.d.ts +2 -0
  75. package/dist/stores/formSave.spec.d.ts.map +1 -0
  76. package/dist/stores/formSave.spec.js +296 -0
  77. package/dist/stores/index.d.ts +1 -0
  78. package/dist/stores/index.d.ts.map +1 -0
  79. package/dist/stores/index.js +0 -0
  80. package/dist/stores/navigation.d.ts +5 -0
  81. package/dist/stores/navigation.d.ts.map +1 -0
  82. package/dist/stores/navigation.js +12 -0
  83. package/dist/stores/navigation.spec.d.ts +2 -0
  84. package/dist/stores/navigation.spec.d.ts.map +1 -0
  85. package/dist/stores/navigation.spec.js +136 -0
  86. package/dist/stores/toaster.d.ts +4 -0
  87. package/dist/stores/toaster.d.ts.map +1 -0
  88. package/dist/stores/toaster.js +13 -0
  89. package/dist/stores/toaster.spec.d.ts +2 -0
  90. package/dist/stores/toaster.spec.d.ts.map +1 -0
  91. package/dist/stores/toaster.spec.js +59 -0
  92. package/dist/telemetry.js +357 -357
  93. package/dist/telemetry.server.js +211 -211
  94. package/dist/telemetry.server.spec.js +434 -434
  95. package/dist/telemetry.spec.js +660 -660
  96. package/dist/utils/apiConfig.js +49 -49
  97. package/dist/utils/apiConfig.spec.js +118 -118
  98. package/dist/utils/greetings.js +187 -187
  99. package/dist/utils/greetings.spec.js +337 -337
  100. package/dist/utils/imageValidation.js +121 -121
  101. package/dist/utils/imageValidation.spec.js +220 -220
  102. package/dist/utils/portal.js +25 -25
  103. package/dist/utils/portal.spec.js +143 -143
  104. package/dist/utils/utils/utils.js +323 -323
  105. package/dist/utils/utils/utils.spec.js +698 -698
  106. package/dist/utils/utils.spec.js +643 -643
  107. package/package.json +1 -1
@@ -1,238 +1,238 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { render, fireEvent } from '@testing-library/svelte';
3
- import OTPInput from './OTPInput.svelte';
4
-
5
- describe('OTPInput Component', () => {
6
- it('renders 6 input fields by default', () => {
7
- const { container } = render(OTPInput);
8
- const inputs = container.querySelectorAll('input');
9
- expect(inputs.length).toBe(6);
10
- });
11
-
12
- it('renders custom number of input fields', () => {
13
- const { container } = render(OTPInput, { props: { length: 4 } });
14
- const inputs = container.querySelectorAll('input');
15
- expect(inputs.length).toBe(4);
16
- });
17
-
18
- it('has numeric inputmode', () => {
19
- const { container } = render(OTPInput);
20
- const input = container.querySelector('input');
21
- expect(input.getAttribute('inputmode')).toBe('numeric');
22
- });
23
-
24
- it('has maxlength of 1', () => {
25
- const { container } = render(OTPInput);
26
- const input = container.querySelector('input');
27
- expect(input.getAttribute('maxlength')).toBe('1');
28
- });
29
-
30
- it('has autocomplete one-time-code', () => {
31
- const { container } = render(OTPInput);
32
- const input = container.querySelector('input');
33
- expect(input.getAttribute('autocomplete')).toBe('one-time-code');
34
- });
35
-
36
- it('disables inputs when disabled prop is true', () => {
37
- const { container } = render(OTPInput, { props: { disabled: true } });
38
- const inputs = container.querySelectorAll('input');
39
- inputs.forEach((input) => {
40
- expect(input.disabled).toBe(true);
41
- });
42
- });
43
-
44
- it('enables inputs when disabled prop is false', () => {
45
- const { container } = render(OTPInput, { props: { disabled: false } });
46
- const inputs = container.querySelectorAll('input');
47
- inputs.forEach((input) => {
48
- expect(input.disabled).toBe(false);
49
- });
50
- });
51
-
52
- it('accepts digit input', async () => {
53
- const { container, component } = render(OTPInput);
54
- const inputs = container.querySelectorAll('input');
55
-
56
- let changeEvent = null;
57
- component.$on('change', (e) => {
58
- changeEvent = e;
59
- });
60
-
61
- await fireEvent.input(inputs[0], { target: { value: '5' } });
62
-
63
- expect(changeEvent).toBeTruthy();
64
- expect(changeEvent.detail.value[0]).toBe('5');
65
- });
66
-
67
- it('rejects non-digit input', async () => {
68
- const { container, component } = render(OTPInput);
69
- const inputs = container.querySelectorAll('input');
70
-
71
- let changeEvent = null;
72
- component.$on('change', (e) => {
73
- changeEvent = e;
74
- });
75
-
76
- await fireEvent.input(inputs[0], { target: { value: 'a' } });
77
-
78
- // Change event should not include the non-digit
79
- expect(changeEvent?.detail?.value[0] || '').toBe('');
80
- });
81
-
82
- it('auto-advances to next input on valid digit', async () => {
83
- const { container } = render(OTPInput);
84
- const inputs = container.querySelectorAll('input');
85
-
86
- inputs[0].focus();
87
- await fireEvent.input(inputs[0], { target: { value: '1' } });
88
-
89
- // Next input should be focused (tested by being active element)
90
- expect(document.activeElement).toBe(inputs[1]);
91
- });
92
-
93
- it('dispatches complete event when all digits entered', async () => {
94
- const { container, component } = render(OTPInput);
95
- const inputs = container.querySelectorAll('input');
96
-
97
- let completeEvent = null;
98
- component.$on('complete', (e) => {
99
- completeEvent = e;
100
- });
101
-
102
- // Fill all inputs
103
- for (let i = 0; i < 6; i++) {
104
- await fireEvent.input(inputs[i], { target: { value: String(i + 1) } });
105
- }
106
-
107
- expect(completeEvent).toBeTruthy();
108
- expect(completeEvent.detail.code).toBe('123456');
109
- });
110
-
111
- it('moves focus back on backspace when current input is empty', async () => {
112
- const { container } = render(OTPInput);
113
- const inputs = container.querySelectorAll('input');
114
-
115
- // Set first input value
116
- await fireEvent.input(inputs[0], { target: { value: '1' } });
117
-
118
- // Focus second input (empty)
119
- inputs[1].focus();
120
-
121
- // Press backspace
122
- await fireEvent.keyDown(inputs[1], { key: 'Backspace' });
123
-
124
- expect(document.activeElement).toBe(inputs[0]);
125
- });
126
-
127
- it('does not move focus back on backspace when current input has value', async () => {
128
- const { container, component } = render(OTPInput, {
129
- props: { value: ['1', '2', '', '', '', ''] },
130
- });
131
- const inputs = container.querySelectorAll('input');
132
-
133
- inputs[1].focus();
134
- await fireEvent.keyDown(inputs[1], { key: 'Backspace' });
135
-
136
- // Should stay on same input since it has a value
137
- expect(document.activeElement).toBe(inputs[1]);
138
- });
139
-
140
- it('handles paste of complete code', async () => {
141
- vi.useFakeTimers();
142
- const { container, component } = render(OTPInput);
143
- const inputs = container.querySelectorAll('input');
144
-
145
- let completeEvent = null;
146
- component.$on('complete', (e) => {
147
- completeEvent = e;
148
- });
149
-
150
- await fireEvent.paste(inputs[0], {
151
- clipboardData: { getData: () => '123456' },
152
- });
153
-
154
- vi.advanceTimersByTime(150);
155
-
156
- expect(completeEvent).toBeTruthy();
157
- expect(completeEvent.detail.code).toBe('123456');
158
- vi.useRealTimers();
159
- });
160
-
161
- it('ignores paste if code length does not match', async () => {
162
- const { container, component } = render(OTPInput);
163
- const inputs = container.querySelectorAll('input');
164
-
165
- let completeEvent = null;
166
- component.$on('complete', (e) => {
167
- completeEvent = e;
168
- });
169
-
170
- await fireEvent.paste(inputs[0], {
171
- clipboardData: { getData: () => '12345' }, // Only 5 digits
172
- });
173
-
174
- expect(completeEvent).toBeFalsy();
175
- });
176
-
177
- it('strips non-digits from pasted content', async () => {
178
- vi.useFakeTimers();
179
- const { container, component } = render(OTPInput);
180
- const inputs = container.querySelectorAll('input');
181
-
182
- let completeEvent = null;
183
- component.$on('complete', (e) => {
184
- completeEvent = e;
185
- });
186
-
187
- await fireEvent.paste(inputs[0], {
188
- clipboardData: { getData: () => '1-2-3-4-5-6' }, // Code with dashes
189
- });
190
-
191
- vi.advanceTimersByTime(150);
192
-
193
- expect(completeEvent).toBeTruthy();
194
- expect(completeEvent.detail.code).toBe('123456');
195
- vi.useRealTimers();
196
- });
197
-
198
- it('has aria-label for each input', () => {
199
- const { container } = render(OTPInput);
200
- const inputs = container.querySelectorAll('input');
201
-
202
- inputs.forEach((input, index) => {
203
- expect(input.getAttribute('aria-label')).toBe(`Digit ${index + 1} of 6`);
204
- });
205
- });
206
-
207
- it('has role="group" on container', () => {
208
- const { container } = render(OTPInput);
209
- const group = container.querySelector('[role="group"]');
210
- expect(group).toBeTruthy();
211
- });
212
-
213
- it('has screen reader instructions', () => {
214
- const { container } = render(OTPInput);
215
- const instructions = container.querySelector('#otp-instructions');
216
- expect(instructions).toBeTruthy();
217
- expect(instructions.classList.contains('sr-only')).toBe(true);
218
- });
219
-
220
- it('initializes value array when length changes', () => {
221
- const { container, component } = render(OTPInput, { props: { length: 4 } });
222
- let inputs = container.querySelectorAll('input');
223
- expect(inputs.length).toBe(4);
224
-
225
- component.$set({ length: 8 });
226
- // Trigger reactivity
227
- });
228
-
229
- it('exposes focus method', () => {
230
- const { component } = render(OTPInput);
231
- expect(typeof component.focus).toBe('function');
232
- });
233
-
234
- it('exposes clear method', () => {
235
- const { component } = render(OTPInput);
236
- expect(typeof component.clear).toBe('function');
237
- });
238
- });
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
+ import { render, fireEvent } from '@testing-library/svelte';
3
+ import OTPInput from './OTPInput.svelte';
4
+
5
+ describe('OTPInput Component', () => {
6
+ it('renders 6 input fields by default', () => {
7
+ const { container } = render(OTPInput);
8
+ const inputs = container.querySelectorAll('input');
9
+ expect(inputs.length).toBe(6);
10
+ });
11
+
12
+ it('renders custom number of input fields', () => {
13
+ const { container } = render(OTPInput, { props: { length: 4 } });
14
+ const inputs = container.querySelectorAll('input');
15
+ expect(inputs.length).toBe(4);
16
+ });
17
+
18
+ it('has numeric inputmode', () => {
19
+ const { container } = render(OTPInput);
20
+ const input = container.querySelector('input');
21
+ expect(input.getAttribute('inputmode')).toBe('numeric');
22
+ });
23
+
24
+ it('has maxlength of 1', () => {
25
+ const { container } = render(OTPInput);
26
+ const input = container.querySelector('input');
27
+ expect(input.getAttribute('maxlength')).toBe('1');
28
+ });
29
+
30
+ it('has autocomplete one-time-code', () => {
31
+ const { container } = render(OTPInput);
32
+ const input = container.querySelector('input');
33
+ expect(input.getAttribute('autocomplete')).toBe('one-time-code');
34
+ });
35
+
36
+ it('disables inputs when disabled prop is true', () => {
37
+ const { container } = render(OTPInput, { props: { disabled: true } });
38
+ const inputs = container.querySelectorAll('input');
39
+ inputs.forEach((input) => {
40
+ expect(input.disabled).toBe(true);
41
+ });
42
+ });
43
+
44
+ it('enables inputs when disabled prop is false', () => {
45
+ const { container } = render(OTPInput, { props: { disabled: false } });
46
+ const inputs = container.querySelectorAll('input');
47
+ inputs.forEach((input) => {
48
+ expect(input.disabled).toBe(false);
49
+ });
50
+ });
51
+
52
+ it('accepts digit input', async () => {
53
+ const { container, component } = render(OTPInput);
54
+ const inputs = container.querySelectorAll('input');
55
+
56
+ let changeEvent = null;
57
+ component.$on('change', (e) => {
58
+ changeEvent = e;
59
+ });
60
+
61
+ await fireEvent.input(inputs[0], { target: { value: '5' } });
62
+
63
+ expect(changeEvent).toBeTruthy();
64
+ expect(changeEvent.detail.value[0]).toBe('5');
65
+ });
66
+
67
+ it('rejects non-digit input', async () => {
68
+ const { container, component } = render(OTPInput);
69
+ const inputs = container.querySelectorAll('input');
70
+
71
+ let changeEvent = null;
72
+ component.$on('change', (e) => {
73
+ changeEvent = e;
74
+ });
75
+
76
+ await fireEvent.input(inputs[0], { target: { value: 'a' } });
77
+
78
+ // Change event should not include the non-digit
79
+ expect(changeEvent?.detail?.value[0] || '').toBe('');
80
+ });
81
+
82
+ it('auto-advances to next input on valid digit', async () => {
83
+ const { container } = render(OTPInput);
84
+ const inputs = container.querySelectorAll('input');
85
+
86
+ inputs[0].focus();
87
+ await fireEvent.input(inputs[0], { target: { value: '1' } });
88
+
89
+ // Next input should be focused (tested by being active element)
90
+ expect(document.activeElement).toBe(inputs[1]);
91
+ });
92
+
93
+ it('dispatches complete event when all digits entered', async () => {
94
+ const { container, component } = render(OTPInput);
95
+ const inputs = container.querySelectorAll('input');
96
+
97
+ let completeEvent = null;
98
+ component.$on('complete', (e) => {
99
+ completeEvent = e;
100
+ });
101
+
102
+ // Fill all inputs
103
+ for (let i = 0; i < 6; i++) {
104
+ await fireEvent.input(inputs[i], { target: { value: String(i + 1) } });
105
+ }
106
+
107
+ expect(completeEvent).toBeTruthy();
108
+ expect(completeEvent.detail.code).toBe('123456');
109
+ });
110
+
111
+ it('moves focus back on backspace when current input is empty', async () => {
112
+ const { container } = render(OTPInput);
113
+ const inputs = container.querySelectorAll('input');
114
+
115
+ // Set first input value
116
+ await fireEvent.input(inputs[0], { target: { value: '1' } });
117
+
118
+ // Focus second input (empty)
119
+ inputs[1].focus();
120
+
121
+ // Press backspace
122
+ await fireEvent.keyDown(inputs[1], { key: 'Backspace' });
123
+
124
+ expect(document.activeElement).toBe(inputs[0]);
125
+ });
126
+
127
+ it('does not move focus back on backspace when current input has value', async () => {
128
+ const { container, component } = render(OTPInput, {
129
+ props: { value: ['1', '2', '', '', '', ''] },
130
+ });
131
+ const inputs = container.querySelectorAll('input');
132
+
133
+ inputs[1].focus();
134
+ await fireEvent.keyDown(inputs[1], { key: 'Backspace' });
135
+
136
+ // Should stay on same input since it has a value
137
+ expect(document.activeElement).toBe(inputs[1]);
138
+ });
139
+
140
+ it('handles paste of complete code', async () => {
141
+ vi.useFakeTimers();
142
+ const { container, component } = render(OTPInput);
143
+ const inputs = container.querySelectorAll('input');
144
+
145
+ let completeEvent = null;
146
+ component.$on('complete', (e) => {
147
+ completeEvent = e;
148
+ });
149
+
150
+ await fireEvent.paste(inputs[0], {
151
+ clipboardData: { getData: () => '123456' },
152
+ });
153
+
154
+ vi.advanceTimersByTime(150);
155
+
156
+ expect(completeEvent).toBeTruthy();
157
+ expect(completeEvent.detail.code).toBe('123456');
158
+ vi.useRealTimers();
159
+ });
160
+
161
+ it('ignores paste if code length does not match', async () => {
162
+ const { container, component } = render(OTPInput);
163
+ const inputs = container.querySelectorAll('input');
164
+
165
+ let completeEvent = null;
166
+ component.$on('complete', (e) => {
167
+ completeEvent = e;
168
+ });
169
+
170
+ await fireEvent.paste(inputs[0], {
171
+ clipboardData: { getData: () => '12345' }, // Only 5 digits
172
+ });
173
+
174
+ expect(completeEvent).toBeFalsy();
175
+ });
176
+
177
+ it('strips non-digits from pasted content', async () => {
178
+ vi.useFakeTimers();
179
+ const { container, component } = render(OTPInput);
180
+ const inputs = container.querySelectorAll('input');
181
+
182
+ let completeEvent = null;
183
+ component.$on('complete', (e) => {
184
+ completeEvent = e;
185
+ });
186
+
187
+ await fireEvent.paste(inputs[0], {
188
+ clipboardData: { getData: () => '1-2-3-4-5-6' }, // Code with dashes
189
+ });
190
+
191
+ vi.advanceTimersByTime(150);
192
+
193
+ expect(completeEvent).toBeTruthy();
194
+ expect(completeEvent.detail.code).toBe('123456');
195
+ vi.useRealTimers();
196
+ });
197
+
198
+ it('has aria-label for each input', () => {
199
+ const { container } = render(OTPInput);
200
+ const inputs = container.querySelectorAll('input');
201
+
202
+ inputs.forEach((input, index) => {
203
+ expect(input.getAttribute('aria-label')).toBe(`Digit ${index + 1} of 6`);
204
+ });
205
+ });
206
+
207
+ it('has role="group" on container', () => {
208
+ const { container } = render(OTPInput);
209
+ const group = container.querySelector('[role="group"]');
210
+ expect(group).toBeTruthy();
211
+ });
212
+
213
+ it('has screen reader instructions', () => {
214
+ const { container } = render(OTPInput);
215
+ const instructions = container.querySelector('#otp-instructions');
216
+ expect(instructions).toBeTruthy();
217
+ expect(instructions.classList.contains('sr-only')).toBe(true);
218
+ });
219
+
220
+ it('initializes value array when length changes', () => {
221
+ const { container, component } = render(OTPInput, { props: { length: 4 } });
222
+ let inputs = container.querySelectorAll('input');
223
+ expect(inputs.length).toBe(4);
224
+
225
+ component.$set({ length: 8 });
226
+ // Trigger reactivity
227
+ });
228
+
229
+ it('exposes focus method', () => {
230
+ const { component } = render(OTPInput);
231
+ expect(typeof component.focus).toBe('function');
232
+ });
233
+
234
+ it('exposes clear method', () => {
235
+ const { component } = render(OTPInput);
236
+ expect(typeof component.clear).toBe('function');
237
+ });
238
+ });