@dcrackel/hematournamentui 1.0.707 → 1.0.709
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/AGENTS.md +118 -118
- package/README.md +132 -106
- package/dist/HemaTournamentUI-lib.es.js +7111 -7006
- package/dist/HemaTournamentUI-lib.umd.js +27 -27
- package/dist/hematournamentui-tailwind.css +198 -412
- package/package.json +10 -10
- package/src/index.js +2 -0
- package/src/mocks/getDEBouts-42Fencers.js +4 -4
- package/src/mocks/getDEBouts-TableOf128.js +37 -0
- package/src/mocks/getDEBouts-TableOf64.js +35 -0
- package/src/stories/Atoms/Input/BaseInput.test.js +97 -85
- package/src/stories/Atoms/Input/BaseInput.vue +149 -150
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -0
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +3 -2
- package/src/stories/Molecules/Modals/EditBoutModal/EditBoutModal.vue +1 -1
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -0
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -0
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -0
- package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -278
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +60 -98
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +103 -4
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +256 -215
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -92
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -128
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +14 -4
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -20
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -0
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -133
- package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +2 -2
- package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +131 -3
- package/src/stories/Organisms/Containers/Tableau/Tableau.vue +287 -89
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -0
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -0
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -0
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -0
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -0
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -0
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +57 -0
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +65 -0
- package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +31 -29
- package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +146 -18
- package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +52 -2
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +53 -17
- package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +39 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -0
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +14 -0
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -0
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +13 -3
- package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -172
- package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -103
- package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -0
- package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -213
- package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -0
- package/src/stories/Util/Validations/PersonManagementValidations.js +45 -29
- package/src/stories/Organisms/Cards/TableauBoutCard/SpacingConfig.js +0 -111
- package/src/stories/Organisms/Containers/TableauLines/SpacingConfig.js +0 -162
- package/src/stories/Organisms/Containers/TableauLines/TableauLines.stories.js +0 -21
- package/src/stories/Organisms/Containers/TableauLines/TableauLines.vue +0 -78
|
@@ -1,133 +1,192 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="flex w-full justify-center">
|
|
3
|
-
<
|
|
4
|
-
v-if="!uploading"
|
|
5
|
-
|
|
6
|
-
:
|
|
7
|
-
:
|
|
8
|
-
|
|
9
|
-
@
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<section class="flex w-full justify-center" :aria-busy="uploading" :inert="disabled">
|
|
3
|
+
<button
|
|
4
|
+
v-if="!uploading"
|
|
5
|
+
type="button"
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
:aria-label="isProfile ? 'Change profile image' : 'Change image'"
|
|
8
|
+
class="flex items-center justify-center"
|
|
9
|
+
@click="setShowCropper"
|
|
10
|
+
>
|
|
11
|
+
<img
|
|
12
|
+
:src="displayedUrl"
|
|
13
|
+
:class="getClasses"
|
|
14
|
+
:style="customStyle"
|
|
15
|
+
:alt="isProfile ? 'Profile image' : 'Uploaded image'"
|
|
16
|
+
@error="onImageError"
|
|
17
|
+
/>
|
|
18
|
+
</button>
|
|
19
|
+
<div v-if="uploading" :class="getSkeletonClass" role="status" aria-label="Uploading image" />
|
|
20
|
+
<avatar-cropper
|
|
21
|
+
v-model="showCropper"
|
|
22
|
+
:upload-url="`${uploadServer}${uploadImageName}`"
|
|
23
|
+
:cropper-options="cropperOptions"
|
|
24
|
+
@uploading="handleUploading"
|
|
25
|
+
@uploaded="handleUploaded"
|
|
26
|
+
@completed="handleCompleted"
|
|
27
|
+
@error="handlerError"
|
|
28
|
+
/>
|
|
29
|
+
</section>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import AvatarCropper from 'vue-avatar-cropper';
|
|
34
|
+
import SelectAnProfile from '../../../../assets/select-profile.png';
|
|
35
|
+
import SelectAnImage from '../../../../assets/select-tournament.png';
|
|
36
|
+
import loading from '../../../../assets/loading-spinner.gif';
|
|
37
|
+
|
|
38
|
+
function getImageErrorStatus(error, xhr) {
|
|
39
|
+
return error?.context?.response?.status ?? xhr?.status;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
name: 'GenericImageCropper',
|
|
44
|
+
emits: ['update:url', 'update:uploading', 'error:load', 'error:upload'],
|
|
45
|
+
props: {
|
|
46
|
+
urlToImage: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: SelectAnImage
|
|
49
|
+
},
|
|
50
|
+
customClass: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ''
|
|
53
|
+
},
|
|
54
|
+
customSkeletonClass: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
customStyle: {
|
|
59
|
+
type: Object,
|
|
60
|
+
default: () => ({})
|
|
61
|
+
},
|
|
62
|
+
uploadImageName: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'default-image'
|
|
65
|
+
},
|
|
66
|
+
uploadServer: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: ''
|
|
69
|
+
},
|
|
70
|
+
imageServer: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: ''
|
|
73
|
+
},
|
|
74
|
+
isProfile: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
disabled: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
cropperOptions: {
|
|
83
|
+
type: Object,
|
|
84
|
+
default: () => ({
|
|
85
|
+
aspectRatio: 3 / 2,
|
|
86
|
+
autoCropArea: 1,
|
|
87
|
+
viewMode: 1,
|
|
88
|
+
movable: true,
|
|
89
|
+
zoomable: true
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
components: {
|
|
94
|
+
AvatarCropper
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
loading,
|
|
99
|
+
showCropper: false,
|
|
100
|
+
uploading: false,
|
|
101
|
+
localImageUrl: this.urlToImage,
|
|
102
|
+
imageLoadFailed: false,
|
|
103
|
+
previewVersion: 0,
|
|
104
|
+
message: ''
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
displayedUrl() {
|
|
109
|
+
const fallback = this.isProfile ? SelectAnProfile : SelectAnImage;
|
|
110
|
+
if (this.imageLoadFailed || !this.localImageUrl) return fallback;
|
|
111
|
+
if (!this.previewVersion) return this.localImageUrl;
|
|
112
|
+
const preview = new URL(this.localImageUrl, document.baseURI);
|
|
113
|
+
preview.searchParams.set('preview', this.previewVersion);
|
|
114
|
+
return preview.href;
|
|
115
|
+
},
|
|
116
|
+
getClasses() {
|
|
117
|
+
return this.customClass
|
|
118
|
+
? this.customClass
|
|
119
|
+
: 'h-52 w-80 border-2 border-dashed rounded-lg bg-contain bg-contain bg-center bg-no-repeat';
|
|
120
|
+
},
|
|
121
|
+
getSkeletonClass() {
|
|
122
|
+
return this.customSkeletonClass
|
|
123
|
+
? this.customSkeletonClass
|
|
124
|
+
: 'border-2 h-52 w-80 border-dashed rounded-lg bg-quaternaryHighlight animate-pulse';
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
watch: {
|
|
128
|
+
urlToImage(url) {
|
|
129
|
+
if (url === this.localImageUrl) return;
|
|
130
|
+
this.localImageUrl = url;
|
|
131
|
+
this.imageLoadFailed = false;
|
|
132
|
+
this.previewVersion = 0;
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
methods: {
|
|
136
|
+
setShowCropper() {
|
|
137
|
+
if (this.disabled || this.uploading) return;
|
|
138
|
+
this.showCropper = true;
|
|
139
|
+
},
|
|
140
|
+
setUploading(uploading) {
|
|
141
|
+
this.uploading = uploading;
|
|
142
|
+
this.$emit('update:uploading', uploading);
|
|
143
|
+
},
|
|
144
|
+
handleUploading(event) {
|
|
145
|
+
this.setUploading(true);
|
|
146
|
+
// The cropper exposes the request promise but does not emit rejected fetches.
|
|
147
|
+
event?.response?.catch?.(error => {
|
|
148
|
+
this.handlerError({ type: 'upload', message: error?.message || 'Image upload failed.' });
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
handleUploaded(response) {
|
|
152
|
+
const status = response?.response?.status;
|
|
153
|
+
if (!(status >= 200 && status < 300)) {
|
|
154
|
+
this.handlerError({ message: 'Image upload failed.', context: { response: response?.response } });
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const url = `${this.imageServer}${this.uploadImageName}.png`;
|
|
158
|
+
if (!this.isValidImageUrl(url)) {
|
|
159
|
+
this.handlerError({ message: 'The upload did not provide a valid image URL.' });
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.localImageUrl = url;
|
|
163
|
+
this.imageLoadFailed = false;
|
|
164
|
+
this.previewVersion = Date.now();
|
|
165
|
+
this.$emit('update:url', url);
|
|
166
|
+
this.setUploading(false);
|
|
167
|
+
},
|
|
168
|
+
handleCompleted() {
|
|
169
|
+
this.message = 'Upload completed.';
|
|
170
|
+
},
|
|
171
|
+
handlerError(message, type, xhr) {
|
|
172
|
+
this.setUploading(false);
|
|
173
|
+
this.message = typeof message === 'string' ? message : message?.message || 'Image upload failed.';
|
|
174
|
+
const eventName = (message?.type ?? type) === 'load' ? 'error:load' : 'error:upload';
|
|
175
|
+
this.$emit(eventName, { message: this.message, status: getImageErrorStatus(message, xhr) });
|
|
176
|
+
},
|
|
177
|
+
isValidImageUrl(url) {
|
|
178
|
+
if (typeof url !== 'string' || !url.trim()) return false;
|
|
179
|
+
try {
|
|
180
|
+
return ['http:', 'https:'].includes(new URL(url, document.baseURI).protocol);
|
|
181
|
+
} catch {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
onImageError() {
|
|
186
|
+
if (this.imageLoadFailed) return;
|
|
187
|
+
this.imageLoadFailed = true;
|
|
188
|
+
this.$emit('error:load', { message: 'Could not load the image.', url: this.localImageUrl });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
</script>
|
|
@@ -11,12 +11,12 @@ export default {
|
|
|
11
11
|
},
|
|
12
12
|
argTypes: {
|
|
13
13
|
bouts: {
|
|
14
|
-
control: '
|
|
14
|
+
control: 'object',
|
|
15
15
|
description: 'Array of bracket objects to display'
|
|
16
16
|
},
|
|
17
17
|
bracketSize: {
|
|
18
18
|
control: 'string',
|
|
19
|
-
description: '
|
|
19
|
+
description: 'Name of the opening bracket round'
|
|
20
20
|
},
|
|
21
21
|
hostingClubColors: {
|
|
22
22
|
control: 'object'
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import getDEWithBouts42Fencers from '../../../../mocks/getDEBouts-42Fencers.js';
|
|
4
|
+
import getDEBoutsTableOf128 from '../../../../mocks/getDEBouts-TableOf128.js';
|
|
5
|
+
import getDEBoutsTableOf64 from '../../../../mocks/getDEBouts-TableOf64.js';
|
|
3
6
|
import BoutCard from '../../Cards/BoutCard/BoutCard.vue';
|
|
4
7
|
import TableauColumn from '../TableauColumn/TableauColumn.vue';
|
|
5
8
|
import Tableau from './Tableau.vue';
|
|
@@ -19,7 +22,6 @@ const mountListView = () =>
|
|
|
19
22
|
bouts: [bout],
|
|
20
23
|
bracketSize: 'Final',
|
|
21
24
|
hostingClubColors: {},
|
|
22
|
-
largeCards: true,
|
|
23
25
|
listView: true
|
|
24
26
|
}
|
|
25
27
|
});
|
|
@@ -44,7 +46,6 @@ describe('Tableau list view', () => {
|
|
|
44
46
|
bouts: [activeBout],
|
|
45
47
|
bracketSize: 'Final',
|
|
46
48
|
hostingClubColors: {},
|
|
47
|
-
largeCards: true,
|
|
48
49
|
listView: true
|
|
49
50
|
}
|
|
50
51
|
});
|
|
@@ -54,6 +55,35 @@ describe('Tableau list view', () => {
|
|
|
54
55
|
|
|
55
56
|
expect(wrapper.emitted('action:directingBout')).toEqual([[activeBout]]);
|
|
56
57
|
});
|
|
58
|
+
|
|
59
|
+
it('bubbles the viewer suggestions to the top without removing other scheduled bouts', () => {
|
|
60
|
+
const viewerBout = { ...bout, BoutId: 43, DEBoutId: 2 };
|
|
61
|
+
const wrapper = shallowMount(Tableau, {
|
|
62
|
+
props: {
|
|
63
|
+
bouts: [bout, viewerBout],
|
|
64
|
+
bracketSize: 'Final',
|
|
65
|
+
hostingClubColors: {},
|
|
66
|
+
listView: true,
|
|
67
|
+
plannedDirectingStations: [
|
|
68
|
+
{
|
|
69
|
+
RingId: 7,
|
|
70
|
+
RingName: 'Ring 7',
|
|
71
|
+
Color: '#2563eb',
|
|
72
|
+
Director: { PersonId: 99, DisplayName: 'Viewer Director' }
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
plannedBoutAssignments: [{ DEBoutId: viewerBout.DEBoutId, RingId: 7 }],
|
|
76
|
+
viewerPersonId: '99'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
expect(wrapper.vm.listSections[0]).toMatchObject({
|
|
81
|
+
key: 'suggested-for-viewer',
|
|
82
|
+
label: 'Suggested for You',
|
|
83
|
+
bouts: [viewerBout]
|
|
84
|
+
});
|
|
85
|
+
expect(wrapper.vm.listSections.flatMap(section => section.bouts)).toEqual([viewerBout, bout]);
|
|
86
|
+
});
|
|
57
87
|
});
|
|
58
88
|
|
|
59
89
|
describe('Tableau bracket view', () => {
|
|
@@ -63,7 +93,6 @@ describe('Tableau bracket view', () => {
|
|
|
63
93
|
bouts: [bout],
|
|
64
94
|
bracketSize: 'Final',
|
|
65
95
|
hostingClubColors: {},
|
|
66
|
-
largeCards: true,
|
|
67
96
|
listView: false
|
|
68
97
|
}
|
|
69
98
|
});
|
|
@@ -73,4 +102,103 @@ describe('Tableau bracket view', () => {
|
|
|
73
102
|
|
|
74
103
|
expect(wrapper.emitted('action:directingBout')).toEqual([[bout]]);
|
|
75
104
|
});
|
|
105
|
+
|
|
106
|
+
it('spaces each rendered round by its actual column depth', () => {
|
|
107
|
+
const wrapper = shallowMount(Tableau, {
|
|
108
|
+
props: {
|
|
109
|
+
bouts: [bout],
|
|
110
|
+
bracketSize: 'Table of 8',
|
|
111
|
+
hostingClubColors: {},
|
|
112
|
+
listView: false
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
expect(wrapper.vm.getRoundLayout(0)).toEqual({ gapPx: 16, padTopPx: 0 });
|
|
117
|
+
expect(wrapper.vm.getRoundLayout(1)).toEqual({ gapPx: 89, padTopPx: 36.5 });
|
|
118
|
+
expect(wrapper.vm.getRoundLayout(2)).toEqual({ gapPx: 235, padTopPx: 109.5 });
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('orders the current 42-fencer fixture through Table of 8 without a legacy quarterfinal', () => {
|
|
122
|
+
const wrapper = shallowMount(Tableau, {
|
|
123
|
+
props: {
|
|
124
|
+
bouts: getDEWithBouts42Fencers.pools[0].Bouts,
|
|
125
|
+
bracketSize: 'Table of 64',
|
|
126
|
+
hostingClubColors: getDEWithBouts42Fencers.hostingClubColors,
|
|
127
|
+
listView: false
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
expect(wrapper.vm.winnerRoundEntries.map(([roundName]) => roundName)).toEqual([
|
|
132
|
+
'Table of 64',
|
|
133
|
+
'Table of 32',
|
|
134
|
+
'Table of 16',
|
|
135
|
+
'Table of 8',
|
|
136
|
+
'Semifinal',
|
|
137
|
+
'Final'
|
|
138
|
+
]);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('renders a current Table of 64 fixture with the expected bout count per round', () => {
|
|
142
|
+
const wrapper = shallowMount(Tableau, {
|
|
143
|
+
props: {
|
|
144
|
+
bouts: getDEBoutsTableOf64.pools[0].Bouts,
|
|
145
|
+
bracketSize: 'Table of 64',
|
|
146
|
+
hostingClubColors: getDEBoutsTableOf64.hostingClubColors,
|
|
147
|
+
listView: false
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
expect(wrapper.vm.winnerRoundEntries.map(([roundName, roundBouts]) => [roundName, roundBouts.length])).toEqual([
|
|
152
|
+
['Table of 64', 32],
|
|
153
|
+
['Table of 32', 16],
|
|
154
|
+
['Table of 16', 8],
|
|
155
|
+
['Table of 8', 4],
|
|
156
|
+
['Semifinal', 2],
|
|
157
|
+
['Final', 1]
|
|
158
|
+
]);
|
|
159
|
+
|
|
160
|
+
const openingRound = wrapper.vm.winnerRoundEntries[0][1];
|
|
161
|
+
const openingFencers = openingRound.flatMap(roundBout => [roundBout.Person1, roundBout.Person2]);
|
|
162
|
+
const assignedFencerIds = new Set(openingFencers.filter(fencer => fencer.PersonId).map(fencer => fencer.PersonId));
|
|
163
|
+
|
|
164
|
+
expect(assignedFencerIds.size).toBe(61);
|
|
165
|
+
expect(openingFencers.filter(fencer => fencer.DisplayName === 'BYE')).toHaveLength(3);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('renders a complete Table of 128 fixture for large-bracket layout coverage', () => {
|
|
169
|
+
const wrapper = shallowMount(Tableau, {
|
|
170
|
+
props: {
|
|
171
|
+
bouts: getDEBoutsTableOf128.pools[0].Bouts,
|
|
172
|
+
bracketSize: 'Table of 128',
|
|
173
|
+
hostingClubColors: getDEBoutsTableOf128.hostingClubColors,
|
|
174
|
+
listView: false
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
expect(wrapper.vm.winnerRoundEntries.map(([roundName, roundBouts]) => [roundName, roundBouts.length])).toEqual([
|
|
179
|
+
['Table of 128', 64],
|
|
180
|
+
['Table of 64', 32],
|
|
181
|
+
['Table of 32', 16],
|
|
182
|
+
['Table of 16', 8],
|
|
183
|
+
['Table of 8', 4],
|
|
184
|
+
['Semifinal', 2],
|
|
185
|
+
['Final', 1]
|
|
186
|
+
]);
|
|
187
|
+
|
|
188
|
+
const allBouts = getDEBoutsTableOf128.pools[0].Bouts;
|
|
189
|
+
const openingFencers = wrapper.vm.winnerRoundEntries[0][1].flatMap(roundBout => [
|
|
190
|
+
roundBout.Person1,
|
|
191
|
+
roundBout.Person2
|
|
192
|
+
]);
|
|
193
|
+
const assignedFencerIds = new Set(openingFencers.filter(fencer => fencer.PersonId).map(fencer => fencer.PersonId));
|
|
194
|
+
const boutIds = new Set(allBouts.map(roundBout => roundBout.DEBoutId));
|
|
195
|
+
const missingNextBouts = allBouts.filter(
|
|
196
|
+
roundBout => roundBout.DENextBoutId && !boutIds.has(roundBout.DENextBoutId)
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
expect(allBouts).toHaveLength(127);
|
|
200
|
+
expect(assignedFencerIds.size).toBe(67);
|
|
201
|
+
expect(openingFencers.filter(fencer => fencer.DisplayName === 'BYE')).toHaveLength(61);
|
|
202
|
+
expect(missingNextBouts).toEqual([]);
|
|
203
|
+
});
|
|
76
204
|
});
|