@getmicdrop/svelte-components 2.0.13 → 2.1.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.
- package/dist/__LIB_STORES__.js +30 -2
- package/dist/components/AboutShow/AboutShow.svelte +278 -0
- package/dist/components/AboutShow/AboutShow.svelte.d.ts +43 -0
- package/dist/components/AboutShow/AboutShow.svelte.d.ts.map +1 -0
- package/dist/components/Calendar/MiniMonthCalendar.svelte +1446 -0
- package/dist/components/Calendar/{Calendar.svelte.d.ts → MiniMonthCalendar.svelte.d.ts} +20 -21
- package/dist/components/Calendar/MiniMonthCalendar.svelte.d.ts.map +1 -0
- package/dist/components/DarkModeToggle.svelte +3 -1
- package/dist/components/DarkModeToggle.svelte.d.ts.map +1 -1
- package/dist/components/FAQs/FAQs.svelte +49 -0
- package/dist/components/{Calendar/QuarterView.svelte.d.ts → FAQs/FAQs.svelte.d.ts} +10 -10
- package/dist/components/FAQs/FAQs.svelte.d.ts.map +1 -0
- package/dist/components/Input/Input.svelte +100 -12
- package/dist/components/Input/Input.svelte.d.ts +12 -0
- package/dist/components/Input/Input.svelte.d.ts.map +1 -1
- package/dist/components/Input/OTPInput.svelte +1 -1
- package/dist/components/MonthSwitcher/MonthSwitcher.svelte +206 -0
- package/dist/components/MonthSwitcher/MonthSwitcher.svelte.d.ts +37 -0
- package/dist/components/MonthSwitcher/MonthSwitcher.svelte.d.ts.map +1 -0
- package/dist/components/OrderSummary/OrderSummary.svelte +553 -0
- package/dist/components/OrderSummary/OrderSummary.svelte.d.ts +65 -0
- package/dist/components/OrderSummary/OrderSummary.svelte.d.ts.map +1 -0
- package/dist/components/PublicCard/PublicCard.svelte +267 -0
- package/dist/components/{pages/performers/AvailabilityCalendarModal.svelte.d.ts → PublicCard/PublicCard.svelte.d.ts} +12 -14
- package/dist/components/PublicCard/PublicCard.svelte.d.ts.map +1 -0
- package/dist/components/ShowCard/ShowCard.svelte +240 -0
- package/dist/components/ShowCard/ShowCard.svelte.d.ts +39 -0
- package/dist/components/ShowCard/ShowCard.svelte.d.ts.map +1 -0
- package/dist/components/ShowTimeCard/ShowTimeCard.svelte +92 -0
- package/dist/components/{Calendar/QuarterView.stories.svelte.d.ts → ShowTimeCard/ShowTimeCard.svelte.d.ts} +17 -21
- package/dist/components/ShowTimeCard/ShowTimeCard.svelte.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.svelte +73 -17
- package/dist/components/Spinner/Spinner.svelte.d.ts +5 -3
- package/dist/components/Spinner/Spinner.svelte.d.ts.map +1 -1
- package/dist/components/pages/performers/ShowDetails.svelte.d.ts +2 -2
- package/dist/components/pages/performers/ShowItemCard.svelte.d.ts +6 -6
- package/dist/components/pages/performers/VenueItemCard.svelte.d.ts +2 -2
- package/dist/components/pages/shows/TabNavigation.svelte +7 -8
- package/dist/index.d.ts +8 -3
- package/dist/index.js +12 -3
- package/dist/services/EventService.js +75 -75
- package/dist/services/EventService.spec.js +217 -217
- package/dist/services/ShowService.spec.js +342 -342
- package/package.json +160 -160
- package/dist/components/Calendar/Calendar.spec.d.ts +0 -2
- package/dist/components/Calendar/Calendar.spec.d.ts.map +0 -1
- package/dist/components/Calendar/Calendar.spec.js +0 -131
- package/dist/components/Calendar/Calendar.svelte +0 -1115
- package/dist/components/Calendar/Calendar.svelte.d.ts.map +0 -1
- package/dist/components/Calendar/QuarterView.spec.d.ts +0 -2
- package/dist/components/Calendar/QuarterView.spec.d.ts.map +0 -1
- package/dist/components/Calendar/QuarterView.spec.js +0 -394
- package/dist/components/Calendar/QuarterView.stories.svelte +0 -134
- package/dist/components/Calendar/QuarterView.stories.svelte.d.ts.map +0 -1
- package/dist/components/Calendar/QuarterView.svelte +0 -736
- package/dist/components/Calendar/QuarterView.svelte.d.ts.map +0 -1
- package/dist/components/pages/performers/AvailabilityCalendarModal.svelte +0 -632
- package/dist/components/pages/performers/AvailabilityCalendarModal.svelte.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Calendar/Calendar.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6qBA;;;;;;;;;;;;;;;;;mBAAiQ;yBAxqBxO,oBAAoB;6CA+pBA,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterView.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Calendar/QuarterView.spec.js"],"names":[],"mappings":""}
|
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { render, fireEvent } from '@testing-library/svelte';
|
|
3
|
-
import { writable, get } from 'svelte/store';
|
|
4
|
-
import QuarterView from './QuarterView.svelte';
|
|
5
|
-
|
|
6
|
-
// Mock date-fns functions
|
|
7
|
-
vi.mock('date-fns', () => ({
|
|
8
|
-
getDay: vi.fn((date) => date.getDay()),
|
|
9
|
-
getDaysInMonth: vi.fn((date) => {
|
|
10
|
-
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
11
|
-
}),
|
|
12
|
-
startOfMonth: vi.fn((date) => new Date(date.getFullYear(), date.getMonth(), 1)),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
describe('QuarterView Component', () => {
|
|
16
|
-
let selectedDates;
|
|
17
|
-
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
vi.useFakeTimers();
|
|
20
|
-
vi.setSystemTime(new Date(2024, 5, 15)); // June 15, 2024
|
|
21
|
-
|
|
22
|
-
selectedDates = writable([]);
|
|
23
|
-
|
|
24
|
-
// Mock navigator.vibrate for haptic feedback tests
|
|
25
|
-
Object.defineProperty(navigator, 'vibrate', {
|
|
26
|
-
value: vi.fn(),
|
|
27
|
-
writable: true,
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
afterEach(() => {
|
|
32
|
-
vi.useRealTimers();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('renders calendar container', () => {
|
|
36
|
-
const { container } = render(QuarterView, {
|
|
37
|
-
props: {
|
|
38
|
-
currentevents: [],
|
|
39
|
-
selectedDates,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
const calendarContainer = container.querySelector('.calendar-container');
|
|
43
|
-
expect(calendarContainer).toBeTruthy();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('renders day headers', () => {
|
|
47
|
-
const { getByText } = render(QuarterView, {
|
|
48
|
-
props: {
|
|
49
|
-
currentevents: [],
|
|
50
|
-
selectedDates,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
expect(getByText('Sun')).toBeTruthy();
|
|
54
|
-
expect(getByText('Mon')).toBeTruthy();
|
|
55
|
-
expect(getByText('Tue')).toBeTruthy();
|
|
56
|
-
expect(getByText('Wed')).toBeTruthy();
|
|
57
|
-
expect(getByText('Thu')).toBeTruthy();
|
|
58
|
-
expect(getByText('Fri')).toBeTruthy();
|
|
59
|
-
expect(getByText('Sat')).toBeTruthy();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('renders current month name', () => {
|
|
63
|
-
const { getByText } = render(QuarterView, {
|
|
64
|
-
props: {
|
|
65
|
-
currentevents: [],
|
|
66
|
-
selectedDates,
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
expect(getByText('June')).toBeTruthy();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('renders current year', () => {
|
|
73
|
-
const { getByText } = render(QuarterView, {
|
|
74
|
-
props: {
|
|
75
|
-
currentevents: [],
|
|
76
|
-
selectedDates,
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
expect(getByText('2024')).toBeTruthy();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('renders navigation buttons', () => {
|
|
83
|
-
const { container } = render(QuarterView, {
|
|
84
|
-
props: {
|
|
85
|
-
currentevents: [],
|
|
86
|
-
selectedDates,
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
const navButtons = container.querySelectorAll('.nav-btn');
|
|
90
|
-
expect(navButtons.length).toBe(2);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('renders Today button', () => {
|
|
94
|
-
const { getByText } = render(QuarterView, {
|
|
95
|
-
props: {
|
|
96
|
-
currentevents: [],
|
|
97
|
-
selectedDates,
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
expect(getByText('Today')).toBeTruthy();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('renders day cells', () => {
|
|
104
|
-
const { container } = render(QuarterView, {
|
|
105
|
-
props: {
|
|
106
|
-
currentevents: [],
|
|
107
|
-
selectedDates,
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
const dayCells = container.querySelectorAll('.day-cell');
|
|
111
|
-
// June 2024 has 30 days
|
|
112
|
-
expect(dayCells.length).toBe(30);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('previous button has aria-label', () => {
|
|
116
|
-
const { container } = render(QuarterView, {
|
|
117
|
-
props: {
|
|
118
|
-
currentevents: [],
|
|
119
|
-
selectedDates,
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
const prevButton = container.querySelector('[aria-label="Previous month"]');
|
|
123
|
-
expect(prevButton).toBeTruthy();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('next button has aria-label', () => {
|
|
127
|
-
const { container } = render(QuarterView, {
|
|
128
|
-
props: {
|
|
129
|
-
currentevents: [],
|
|
130
|
-
selectedDates,
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
const nextButton = container.querySelector('[aria-label="Next month"]');
|
|
134
|
-
expect(nextButton).toBeTruthy();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('clicking next navigates to next month', async () => {
|
|
138
|
-
const { container, getByText } = render(QuarterView, {
|
|
139
|
-
props: {
|
|
140
|
-
currentevents: [],
|
|
141
|
-
selectedDates,
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
const nextButton = container.querySelector('[aria-label="Next month"]');
|
|
146
|
-
await fireEvent.click(nextButton);
|
|
147
|
-
|
|
148
|
-
vi.advanceTimersByTime(300);
|
|
149
|
-
|
|
150
|
-
expect(getByText('July')).toBeTruthy();
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('clicking previous navigates to previous month', async () => {
|
|
154
|
-
const { container, getByText } = render(QuarterView, {
|
|
155
|
-
props: {
|
|
156
|
-
currentevents: [],
|
|
157
|
-
selectedDates,
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
const prevButton = container.querySelector('[aria-label="Previous month"]');
|
|
162
|
-
await fireEvent.click(prevButton);
|
|
163
|
-
|
|
164
|
-
vi.advanceTimersByTime(300);
|
|
165
|
-
|
|
166
|
-
expect(getByText('May')).toBeTruthy();
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it('shows save status when provided', () => {
|
|
170
|
-
const { container } = render(QuarterView, {
|
|
171
|
-
props: {
|
|
172
|
-
currentevents: [],
|
|
173
|
-
selectedDates,
|
|
174
|
-
saveStatus: 'saving',
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
const saveIndicator = container.querySelector('.save-indicator-overlay');
|
|
178
|
-
expect(saveIndicator).toBeTruthy();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('shows saved indicator', () => {
|
|
182
|
-
const { container } = render(QuarterView, {
|
|
183
|
-
props: {
|
|
184
|
-
currentevents: [],
|
|
185
|
-
selectedDates,
|
|
186
|
-
saveStatus: 'saved',
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
const saveIndicator = container.querySelector('.save-indicator-overlay');
|
|
190
|
-
expect(saveIndicator).toBeTruthy();
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('disables non-event days', () => {
|
|
194
|
-
const { container } = render(QuarterView, {
|
|
195
|
-
props: {
|
|
196
|
-
currentevents: [],
|
|
197
|
-
selectedDates,
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
const disabledCells = container.querySelectorAll('.day-cell.disabled');
|
|
201
|
-
// All days should be disabled when no events
|
|
202
|
-
expect(disabledCells.length).toBe(30);
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it('enables event days', () => {
|
|
206
|
-
const { container } = render(QuarterView, {
|
|
207
|
-
props: {
|
|
208
|
-
currentevents: [{ date: '2024-06-20' }],
|
|
209
|
-
selectedDates,
|
|
210
|
-
},
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
const dayCells = container.querySelectorAll('.day-cell');
|
|
214
|
-
// Find the cell for day 20
|
|
215
|
-
const day20Cell = Array.from(dayCells).find(
|
|
216
|
-
(cell) => cell.querySelector('.day-number')?.textContent === '20'
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
// Day 20 (future event) should not be disabled
|
|
220
|
-
expect(day20Cell.classList.contains('disabled')).toBe(false);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it('marks selected dates', async () => {
|
|
224
|
-
selectedDates.set(['2024-06-20']);
|
|
225
|
-
|
|
226
|
-
const { container } = render(QuarterView, {
|
|
227
|
-
props: {
|
|
228
|
-
currentevents: [{ date: '2024-06-20' }],
|
|
229
|
-
selectedDates,
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
const dayCells = container.querySelectorAll('.day-cell');
|
|
234
|
-
const day20Cell = Array.from(dayCells).find(
|
|
235
|
-
(cell) => cell.querySelector('.day-number')?.textContent === '20'
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
expect(day20Cell.classList.contains('selected')).toBe(true);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('toggles date selection on click', async () => {
|
|
242
|
-
const { container } = render(QuarterView, {
|
|
243
|
-
props: {
|
|
244
|
-
currentevents: [{ date: '2024-06-20' }],
|
|
245
|
-
selectedDates,
|
|
246
|
-
},
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
const dayCells = container.querySelectorAll('.day-cell');
|
|
250
|
-
const day20Cell = Array.from(dayCells).find(
|
|
251
|
-
(cell) => cell.querySelector('.day-number')?.textContent === '20'
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
await fireEvent.click(day20Cell);
|
|
255
|
-
|
|
256
|
-
// Check that selectedDates store was updated
|
|
257
|
-
const dates = get(selectedDates);
|
|
258
|
-
expect(dates).toContain('2024-06-20');
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
it('removes date from selection on second click', async () => {
|
|
262
|
-
selectedDates.set(['2024-06-20']);
|
|
263
|
-
|
|
264
|
-
const { container } = render(QuarterView, {
|
|
265
|
-
props: {
|
|
266
|
-
currentevents: [{ date: '2024-06-20' }],
|
|
267
|
-
selectedDates,
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
const dayCells = container.querySelectorAll('.day-cell');
|
|
272
|
-
const day20Cell = Array.from(dayCells).find(
|
|
273
|
-
(cell) => cell.querySelector('.day-number')?.textContent === '20'
|
|
274
|
-
);
|
|
275
|
-
|
|
276
|
-
await fireEvent.click(day20Cell);
|
|
277
|
-
|
|
278
|
-
const dates = get(selectedDates);
|
|
279
|
-
expect(dates).not.toContain('2024-06-20');
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
it('has aria-pressed attribute on day buttons', () => {
|
|
283
|
-
const { container } = render(QuarterView, {
|
|
284
|
-
props: {
|
|
285
|
-
currentevents: [],
|
|
286
|
-
selectedDates,
|
|
287
|
-
},
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
const dayCell = container.querySelector('.day-cell');
|
|
291
|
-
expect(dayCell.hasAttribute('aria-pressed')).toBe(true);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it('has aria-label for day buttons', () => {
|
|
295
|
-
const { container } = render(QuarterView, {
|
|
296
|
-
props: {
|
|
297
|
-
currentevents: [],
|
|
298
|
-
selectedDates,
|
|
299
|
-
},
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
const dayCell = container.querySelector('.day-cell');
|
|
303
|
-
expect(dayCell.getAttribute('aria-label')).toMatch(/Day \d+/);
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
it('handles touch swipe events', async () => {
|
|
307
|
-
const { container } = render(QuarterView, {
|
|
308
|
-
props: {
|
|
309
|
-
currentevents: [],
|
|
310
|
-
selectedDates,
|
|
311
|
-
},
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
const grid = container.querySelector('.calendar-grid');
|
|
315
|
-
|
|
316
|
-
// Simulate touch swipe
|
|
317
|
-
await fireEvent.touchStart(grid, {
|
|
318
|
-
touches: [{ clientX: 200, clientY: 100 }],
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
await fireEvent.touchMove(grid, {
|
|
322
|
-
touches: [{ clientX: 100, clientY: 100 }],
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
await fireEvent.touchEnd(grid, {
|
|
326
|
-
changedTouches: [{ clientX: 50, clientY: 100 }],
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
vi.advanceTimersByTime(300);
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
it('calls haptic feedback via vibration API', async () => {
|
|
333
|
-
const { container } = render(QuarterView, {
|
|
334
|
-
props: {
|
|
335
|
-
currentevents: [{ date: '2024-06-20' }],
|
|
336
|
-
selectedDates,
|
|
337
|
-
},
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
const dayCells = container.querySelectorAll('.day-cell');
|
|
341
|
-
const day20Cell = Array.from(dayCells).find(
|
|
342
|
-
(cell) => cell.querySelector('.day-number')?.textContent === '20'
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
await fireEvent.click(day20Cell);
|
|
346
|
-
|
|
347
|
-
// vibrate should have been called
|
|
348
|
-
expect(navigator.vibrate).toHaveBeenCalled();
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it('navigates months correctly across year boundary (December to January)', async () => {
|
|
352
|
-
vi.setSystemTime(new Date(2024, 11, 15)); // December 15, 2024
|
|
353
|
-
|
|
354
|
-
const { container, getByText } = render(QuarterView, {
|
|
355
|
-
props: {
|
|
356
|
-
currentevents: [],
|
|
357
|
-
selectedDates,
|
|
358
|
-
},
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
expect(getByText('December')).toBeTruthy();
|
|
362
|
-
expect(getByText('2024')).toBeTruthy();
|
|
363
|
-
|
|
364
|
-
const nextButton = container.querySelector('[aria-label="Next month"]');
|
|
365
|
-
await fireEvent.click(nextButton);
|
|
366
|
-
|
|
367
|
-
vi.advanceTimersByTime(300);
|
|
368
|
-
|
|
369
|
-
expect(getByText('January')).toBeTruthy();
|
|
370
|
-
expect(getByText('2025')).toBeTruthy();
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
it('navigates months correctly across year boundary (January to December)', async () => {
|
|
374
|
-
vi.setSystemTime(new Date(2024, 0, 15)); // January 15, 2024
|
|
375
|
-
|
|
376
|
-
const { container, getByText } = render(QuarterView, {
|
|
377
|
-
props: {
|
|
378
|
-
currentevents: [],
|
|
379
|
-
selectedDates,
|
|
380
|
-
},
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
expect(getByText('January')).toBeTruthy();
|
|
384
|
-
expect(getByText('2024')).toBeTruthy();
|
|
385
|
-
|
|
386
|
-
const prevButton = container.querySelector('[aria-label="Previous month"]');
|
|
387
|
-
await fireEvent.click(prevButton);
|
|
388
|
-
|
|
389
|
-
vi.advanceTimersByTime(300);
|
|
390
|
-
|
|
391
|
-
expect(getByText('December')).toBeTruthy();
|
|
392
|
-
expect(getByText('2023')).toBeTruthy();
|
|
393
|
-
});
|
|
394
|
-
});
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
<script context="module">
|
|
2
|
-
import { Story, Template } from "@storybook/addon-svelte-csf";
|
|
3
|
-
import QuarterView from "./QuarterView.svelte";
|
|
4
|
-
import { writable } from "svelte/store";
|
|
5
|
-
|
|
6
|
-
export const meta = {
|
|
7
|
-
title: "Components/Calendar/QuarterView",
|
|
8
|
-
component: QuarterView,
|
|
9
|
-
argTypes: {
|
|
10
|
-
currentevents: { control: "object" },
|
|
11
|
-
selectedDates: { control: "object" },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// Helper to generate dates for the current month
|
|
16
|
-
function generateEventDates(count = 10) {
|
|
17
|
-
const events = [];
|
|
18
|
-
const today = new Date();
|
|
19
|
-
const year = today.getFullYear();
|
|
20
|
-
const month = today.getMonth();
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < count; i++) {
|
|
23
|
-
const day = Math.floor(Math.random() * 28) + 1;
|
|
24
|
-
events.push({
|
|
25
|
-
date: new Date(year, month, day).toISOString(),
|
|
26
|
-
title: `Event ${i + 1}`
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return events;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Generate future event dates for next month
|
|
33
|
-
function generateFutureEventDates(count = 8) {
|
|
34
|
-
const events = [];
|
|
35
|
-
const today = new Date();
|
|
36
|
-
const year = today.getFullYear();
|
|
37
|
-
const month = today.getMonth() + 1;
|
|
38
|
-
|
|
39
|
-
for (let i = 0; i < count; i++) {
|
|
40
|
-
const day = Math.floor(Math.random() * 28) + 1;
|
|
41
|
-
events.push({
|
|
42
|
-
date: new Date(year, month, day).toISOString(),
|
|
43
|
-
title: `Future Event ${i + 1}`
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return events;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Generate specific dates
|
|
50
|
-
function generateSpecificDates() {
|
|
51
|
-
const today = new Date();
|
|
52
|
-
const year = today.getFullYear();
|
|
53
|
-
const month = today.getMonth();
|
|
54
|
-
|
|
55
|
-
return [
|
|
56
|
-
{ date: new Date(year, month, 5).toISOString(), title: "Comedy Night" },
|
|
57
|
-
{ date: new Date(year, month, 12).toISOString(), title: "Jazz Evening" },
|
|
58
|
-
{ date: new Date(year, month, 18).toISOString(), title: "Rock Concert" },
|
|
59
|
-
{ date: new Date(year, month, 25).toISOString(), title: "Open Mic" },
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<Template let:args>
|
|
65
|
-
<div style="max-width: 600px; margin: 0 auto;">
|
|
66
|
-
<QuarterView {...args} />
|
|
67
|
-
</div>
|
|
68
|
-
</Template>
|
|
69
|
-
|
|
70
|
-
<Story
|
|
71
|
-
name="With Random Events"
|
|
72
|
-
args={{
|
|
73
|
-
currentevents: generateEventDates(10),
|
|
74
|
-
selectedDates: writable([])
|
|
75
|
-
}}
|
|
76
|
-
/>
|
|
77
|
-
|
|
78
|
-
<Story name="With Specific Events">
|
|
79
|
-
<div style="max-width: 600px; margin: 0 auto;">
|
|
80
|
-
<QuarterView
|
|
81
|
-
currentevents={generateSpecificDates()}
|
|
82
|
-
selectedDates={writable([])}
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</Story>
|
|
86
|
-
|
|
87
|
-
<Story name="With Pre-selected Dates">
|
|
88
|
-
<div style="max-width: 600px; margin: 0 auto;">
|
|
89
|
-
<QuarterView
|
|
90
|
-
currentevents={generateEventDates(12)}
|
|
91
|
-
selectedDates={writable([
|
|
92
|
-
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-05`,
|
|
93
|
-
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-12`,
|
|
94
|
-
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-18`,
|
|
95
|
-
])}
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
</Story>
|
|
99
|
-
|
|
100
|
-
<Story name="With Many Events">
|
|
101
|
-
<div style="max-width: 600px; margin: 0 auto;">
|
|
102
|
-
<QuarterView
|
|
103
|
-
currentevents={generateEventDates(20)}
|
|
104
|
-
selectedDates={writable([])}
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
</Story>
|
|
108
|
-
|
|
109
|
-
<Story name="With Few Events">
|
|
110
|
-
<div style="max-width: 600px; margin: 0 auto;">
|
|
111
|
-
<QuarterView
|
|
112
|
-
currentevents={generateSpecificDates().slice(0, 2)}
|
|
113
|
-
selectedDates={writable([])}
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
</Story>
|
|
117
|
-
|
|
118
|
-
<Story name="Empty Calendar">
|
|
119
|
-
<div style="max-width: 600px; margin: 0 auto;">
|
|
120
|
-
<QuarterView
|
|
121
|
-
currentevents={[]}
|
|
122
|
-
selectedDates={writable([])}
|
|
123
|
-
/>
|
|
124
|
-
</div>
|
|
125
|
-
</Story>
|
|
126
|
-
|
|
127
|
-
<Story name="Next Month Events">
|
|
128
|
-
<div style="max-width: 600px; margin: 0 auto;">
|
|
129
|
-
<QuarterView
|
|
130
|
-
currentevents={generateFutureEventDates(8)}
|
|
131
|
-
selectedDates={writable([])}
|
|
132
|
-
/>
|
|
133
|
-
</div>
|
|
134
|
-
</Story>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuarterView.stories.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Calendar/QuarterView.stories.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+HA;;;;mBAAuH;wBA3H7F,sBAAsB;6CAkHH,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,eAAe,QAAQ,CAAC"}
|