@dcrackel/hematournamentui 1.0.711 → 1.0.712

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.
@@ -0,0 +1,29 @@
1
+ import { afterEach, expect, it } from 'vitest';
2
+ import { shallowMount } from '@vue/test-utils';
3
+ import EditEventWizard from './EditEventWizard.vue';
4
+
5
+ const wrappers = [];
6
+ afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()));
7
+
8
+ it.each([
9
+ ['CutOffNumber', '32', 14, '32'],
10
+ ['poolTime', '180', 1, '180'],
11
+ ['DEType', 'single', 15, 'single'],
12
+ ['DEType', 'double', 15, 'double'],
13
+ ['DEPromoteBy', 'Percent', 17, 'Percent'],
14
+ ['seedWith', 'HR - Hema Rating', 11, 'HR - Hema Rating'],
15
+ ['CutOffNumber', 0, 14, '0'],
16
+ ['thirdPlaceBout', false, 5, 'false'],
17
+ ['DEPromotionOrder', ['Win Percent', 'Indicator'], 9, 'Win Percent,Indicator'],
18
+ ['seedWith', { text: 'Manual', link: 'MN' }, 11, 'MN']
19
+ ])('serializes %s value %j without accessing inherited string methods', (field, value, ruleId, expected) => {
20
+ const wrapper = shallowMount(EditEventWizard, {
21
+ props: { event: { EventId: 12, EventName: 'Example Event', EventPrice: 0, rules: [] }, weapons: [], editMode: true }
22
+ });
23
+ wrappers.push(wrapper);
24
+ wrapper.vm.handleValueChange({ poolTimer: true, [field]: value });
25
+ wrapper.vm.handleUpdate();
26
+ const payload = wrapper.emitted('save:step')[0][0].event;
27
+ expect(payload.rules.find(rule => rule.RuleId === ruleId).RuleValue).toBe(expected);
28
+ expect(payload.rules.some(rule => rule.RuleValue.includes('[native code]'))).toBe(false);
29
+ });
@@ -110,6 +110,36 @@ export const WithWaitlist = {
110
110
  personsInTournament: [...activeRoster, ...waitlistedPersons],
111
111
  personsAll: personsAllMock,
112
112
  fencingClubs: clubsMock,
113
- event: makeEventWithCapacity(eventPersonGetEventById.event, activeRoster.length)
113
+ event: {
114
+ ...makeEventWithCapacity(eventPersonGetEventById.event, activeRoster.length),
115
+ RegistrationStatus: 'waitlist'
116
+ }
117
+ }
118
+ };
119
+
120
+ export const RegistrationOpen = {
121
+ args: {
122
+ personsInTournament: eventPersonGetEventById.persons,
123
+ personsAll: personsAllMock,
124
+ fencingClubs: clubsMock,
125
+ event: { ...eventPersonGetEventById.event, RegistrationStatus: 'open' }
126
+ }
127
+ };
128
+
129
+ export const RegistrationFull = {
130
+ args: {
131
+ personsInTournament: eventPersonGetEventById.persons,
132
+ personsAll: personsAllMock,
133
+ fencingClubs: clubsMock,
134
+ event: { ...eventPersonGetEventById.event, RegistrationStatus: 'full' }
135
+ }
136
+ };
137
+
138
+ export const RegistrationClosed = {
139
+ args: {
140
+ personsInTournament: eventPersonGetEventById.persons,
141
+ personsAll: personsAllMock,
142
+ fencingClubs: clubsMock,
143
+ event: { ...eventPersonGetEventById.event, RegistrationStatus: 'closed' }
114
144
  }
115
145
  };
@@ -1,45 +1,58 @@
1
- import ListEvents from './ListEvents.vue';
2
- import eventMockData from '../../../../mocks/eventMock.js';
3
-
4
- export default {
5
- title: 'Templates/TournamentManagement/ListEvents',
6
- component: ListEvents,
7
- tags: ['autodocs'],
8
- args: {
9
- tournamentId: 8,
10
- events: eventMockData
11
- },
12
- argTypes: {
13
- tournamentId: { control: { type: 'number' } },
14
- events: { control: { type: 'object' } },
15
- 'tab:menu-click': { action: 'tab:menu-click' },
16
- manageEvent: { action: 'manageEvent' },
17
- editEvent: { action: 'editEvent' },
18
- addEvent: { action: 'addEvent' },
19
- 'delete:Event': { action: 'delete:Event' }
20
- }
21
- };
22
-
23
- export const Default = {
24
- args: {
25
- tournamentId: 8,
26
- events: eventMockData
27
- }
28
- };
29
-
30
- export const NoEvents = {
31
- args: {
32
- tournamentId: 8,
33
- events: []
34
- }
35
- };
36
-
37
- export const CompletedEvents = {
38
- args: {
39
- tournamentId: 8,
40
- events: eventMockData.map(event => ({
41
- ...event,
42
- Status: 'completed'
43
- }))
44
- }
45
- };
1
+ import ListEvents from './ListEvents.vue';
2
+ import eventMockData from '../../../../mocks/eventMock.js';
3
+
4
+ export default {
5
+ title: 'Templates/TournamentManagement/ListEvents',
6
+ component: ListEvents,
7
+ tags: ['autodocs'],
8
+ args: {
9
+ tournamentId: 8,
10
+ events: eventMockData
11
+ },
12
+ argTypes: {
13
+ tournamentId: { control: { type: 'number' } },
14
+ events: { control: { type: 'object' } },
15
+ 'tab:menu-click': { action: 'tab:menu-click' },
16
+ manageEvent: { action: 'manageEvent' },
17
+ editEvent: { action: 'editEvent' },
18
+ addEvent: { action: 'addEvent' },
19
+ 'delete:Event': { action: 'delete:Event' }
20
+ }
21
+ };
22
+
23
+ export const Default = {
24
+ args: {
25
+ tournamentId: 8,
26
+ events: eventMockData
27
+ }
28
+ };
29
+
30
+ export const NoEvents = {
31
+ args: {
32
+ tournamentId: 8,
33
+ events: []
34
+ }
35
+ };
36
+
37
+ export const RegistrationStatuses = {
38
+ args: {
39
+ tournamentId: 8,
40
+ events: ['open', 'waitlist', 'full', 'closed'].map((RegistrationStatus, index) => ({
41
+ ...eventMockData[0],
42
+ EventId: index + 1,
43
+ EventName: ['Longsword Division 1', 'Rapier', 'Saber', 'Longsword Division 2'][index],
44
+ Status: 'registration',
45
+ RegistrationStatus
46
+ }))
47
+ }
48
+ };
49
+
50
+ export const CompletedEvents = {
51
+ args: {
52
+ tournamentId: 8,
53
+ events: eventMockData.map(event => ({
54
+ ...event,
55
+ Status: 'completed'
56
+ }))
57
+ }
58
+ };
@@ -0,0 +1,11 @@
1
+ const statusLabels = new Map([
2
+ ['open', 'Open'],
3
+ ['waitlist', 'Waitlist'],
4
+ ['full', 'Full'],
5
+ ['closed', 'Closed']
6
+ ]);
7
+
8
+ export function getRegistrationStatusLabel(status) {
9
+ const value = typeof status === 'string' ? status.trim().toLowerCase() : '';
10
+ return statusLabels.get(value) ?? '';
11
+ }