@dcrackel/hematournamentui 1.0.712 → 1.0.714

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/.prettierignore +7 -7
  2. package/.storybook/main.js +3 -1
  3. package/README.md +42 -0
  4. package/dist/HemaTournamentUI-lib.es.js +6856 -6243
  5. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  6. package/dist/hematournamentui-tailwind.css +79 -9
  7. package/package.json +96 -96
  8. package/prettier.config.js +16 -16
  9. package/src/index.js +43 -42
  10. package/src/main.js +1 -1
  11. package/src/mocks/getDEBouts-TableOf128.js +37 -37
  12. package/src/mocks/getDEBouts-TableOf64.js +35 -35
  13. package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
  14. package/src/stories/Atoms/Input/BaseInput.vue +149 -149
  15. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
  16. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
  17. package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -30
  18. package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
  19. package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
  20. package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.stories.js +49 -0
  21. package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.test.js +129 -0
  22. package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.vue +165 -0
  23. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
  24. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
  25. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
  26. package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
  27. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
  28. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
  29. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +42 -33
  30. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +76 -45
  31. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +122 -103
  32. package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
  33. package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
  34. package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
  35. package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -106
  36. package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
  37. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
  38. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
  39. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
  40. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
  41. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
  42. package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
  43. package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
  44. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
  45. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
  46. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
  47. package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
  48. package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
  49. package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
  50. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +51 -29
  51. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +63 -46
  52. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
  53. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
  54. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
  55. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
  56. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
  57. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
  58. package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
  59. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -52
  60. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +10 -3
  61. package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
  62. package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
  63. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -137
  64. package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
  65. package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
  66. package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
  67. package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -29
  68. package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
  69. package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +149 -9
  70. package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +54 -2
  71. package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +77 -8
  72. package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
  73. package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
  74. package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +50 -39
  75. package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +201 -0
  76. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
  77. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
  78. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
  79. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
  80. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
  81. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
  82. package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
  83. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
  84. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
  85. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
  86. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
  87. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
  88. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
  89. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
  90. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
  91. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
  92. package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
  93. package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
  94. package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
  95. package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
  96. package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
  97. package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
  98. package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
  99. package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
  100. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
  101. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
  102. package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
  103. package/src/stories/Util/Validations/PriceValidation.js +6 -6
  104. package/src/stories/Util/boutDirectorAssignment.js +46 -0
  105. package/src/stories/Util/bracketDirectors.js +86 -0
  106. package/src/stories/Util/registrationStatus.js +11 -11
  107. package/src/stories/Util/tabs.js +19 -47
@@ -5,6 +5,7 @@ export default {
5
5
  title: 'Organisms/Containers/Tableau',
6
6
  component: Tableau,
7
7
  args: {
8
+ showBoutDirectorAssignment: true,
8
9
  bouts: getDEWithBouts.pools[0].Bouts,
9
10
  bracketSize: getDEWithBouts.pools[0].Bouts[0].RoundLabel,
10
11
  hostingClubColors: getDEWithBouts.hostingClubColors
@@ -1,204 +1,247 @@
1
- import { shallowMount } from '@vue/test-utils';
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';
6
- import BoutCard from '../../Cards/BoutCard/BoutCard.vue';
7
- import TableauColumn from '../TableauColumn/TableauColumn.vue';
8
- import Tableau from './Tableau.vue';
9
-
10
- const bout = {
11
- BoutId: 42,
12
- DEBoutId: 1,
13
- RoundLabel: 'Final',
14
- Status: 'Scheduled',
15
- Person1: { PersonId: 1, DisplayName: 'Fencer One' },
16
- Person2: { PersonId: 2, DisplayName: 'Fencer Two' }
17
- };
18
-
19
- const mountListView = () =>
20
- shallowMount(Tableau, {
21
- props: {
22
- bouts: [bout],
23
- bracketSize: 'Final',
24
- hostingClubColors: {},
25
- listView: true
26
- }
27
- });
28
-
29
- describe('Tableau list view', () => {
30
- it('enables bout interaction and emits the full bout when starting', async () => {
31
- const wrapper = mountListView();
32
- const boutCard = wrapper.findComponent(BoutCard);
33
-
34
- expect(boutCard.props('editMode')).toBe(true);
35
-
36
- boutCard.vm.$emit('action:startBout', { BoutId: bout.BoutId });
37
- await wrapper.vm.$nextTick();
38
-
39
- expect(wrapper.emitted('action:directingBout')).toEqual([[bout]]);
40
- });
41
-
42
- it('routes active bout resume through the directing event', async () => {
43
- const activeBout = { ...bout, Status: 'Active' };
44
- const wrapper = shallowMount(Tableau, {
45
- props: {
46
- bouts: [activeBout],
47
- bracketSize: 'Final',
48
- hostingClubColors: {},
49
- listView: true
50
- }
51
- });
52
-
53
- wrapper.findComponent(BoutCard).vm.$emit('action:resumeBout', { BoutId: activeBout.BoutId });
54
- await wrapper.vm.$nextTick();
55
-
56
- expect(wrapper.emitted('action:directingBout')).toEqual([[activeBout]]);
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
- });
87
- });
88
-
89
- describe('Tableau bracket view', () => {
90
- it('routes a scheduled tableau bout through the same directing event', async () => {
91
- const wrapper = shallowMount(Tableau, {
92
- props: {
93
- bouts: [bout],
94
- bracketSize: 'Final',
95
- hostingClubColors: {},
96
- listView: false
97
- }
98
- });
99
-
100
- wrapper.findComponent(TableauColumn).vm.$emit('action:directingBout', bout);
101
- await wrapper.vm.$nextTick();
102
-
103
- expect(wrapper.emitted('action:directingBout')).toEqual([[bout]]);
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
- });
204
- });
1
+ import { shallowMount } from '@vue/test-utils';
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';
6
+ import BoutCard from '../../Cards/BoutCard/BoutCard.vue';
7
+ import TableauColumn from '../TableauColumn/TableauColumn.vue';
8
+ import Tableau from './Tableau.vue';
9
+
10
+ const bout = {
11
+ BoutId: 42,
12
+ DEBoutId: 1,
13
+ RoundLabel: 'Final',
14
+ Status: 'Scheduled',
15
+ Person1: { PersonId: 1, DisplayName: 'Fencer One' },
16
+ Person2: { PersonId: 2, DisplayName: 'Fencer Two' }
17
+ };
18
+
19
+ const mountListView = () =>
20
+ shallowMount(Tableau, {
21
+ global: { renderStubDefaultSlot: true },
22
+ props: {
23
+ bouts: [bout],
24
+ bracketSize: 'Final',
25
+ hostingClubColors: {},
26
+ listView: true,
27
+ showBoutDirectorAssignment: false
28
+ }
29
+ });
30
+
31
+ describe('Tableau list view', () => {
32
+ it('enables bout interaction and emits the full bout when starting', async () => {
33
+ const wrapper = mountListView();
34
+ const boutCard = wrapper.findComponent(BoutCard);
35
+
36
+ expect(boutCard.props('editMode')).toBe(true);
37
+
38
+ boutCard.vm.$emit('action:startBout', { BoutId: bout.BoutId });
39
+ await wrapper.vm.$nextTick();
40
+
41
+ expect(wrapper.emitted('action:directingBout')).toEqual([[bout]]);
42
+ });
43
+
44
+ it('routes active bout resume through the directing event', async () => {
45
+ const activeBout = { ...bout, Status: 'Active' };
46
+ const wrapper = shallowMount(Tableau, {
47
+ global: { renderStubDefaultSlot: true },
48
+ props: {
49
+ bouts: [activeBout],
50
+ bracketSize: 'Final',
51
+ hostingClubColors: {},
52
+ listView: true
53
+ }
54
+ });
55
+
56
+ wrapper.findComponent(BoutCard).vm.$emit('action:resumeBout', { BoutId: activeBout.BoutId });
57
+ await wrapper.vm.$nextTick();
58
+
59
+ expect(wrapper.emitted('action:directingBout')).toEqual([[activeBout]]);
60
+ });
61
+
62
+ it('bubbles the viewer suggestions to the top without removing other scheduled bouts', () => {
63
+ const viewerBout = { ...bout, BoutId: 43, DEBoutId: 2 };
64
+ const wrapper = shallowMount(Tableau, {
65
+ global: { renderStubDefaultSlot: true },
66
+ props: {
67
+ bouts: [bout, viewerBout],
68
+ bracketSize: 'Final',
69
+ hostingClubColors: {},
70
+ listView: true,
71
+ plannedDirectingStations: [
72
+ {
73
+ RingId: 7,
74
+ RingName: 'Ring 7',
75
+ Color: '#2563eb',
76
+ Director: { PersonId: 99, DisplayName: 'Viewer Director' }
77
+ }
78
+ ],
79
+ plannedBoutAssignments: [{ DEBoutId: viewerBout.DEBoutId, RingId: 7 }],
80
+ viewerPersonId: '99'
81
+ }
82
+ });
83
+
84
+ expect(wrapper.vm.listSections[0]).toMatchObject({
85
+ key: 'suggested-for-viewer',
86
+ label: 'Suggested for You',
87
+ bouts: [viewerBout]
88
+ });
89
+ expect(wrapper.vm.listSections.flatMap(section => section.bouts)).toEqual([viewerBout, bout]);
90
+ });
91
+ });
92
+
93
+ describe('Tableau bracket view', () => {
94
+ it('routes a scheduled tableau bout through the same directing event', async () => {
95
+ const wrapper = shallowMount(Tableau, {
96
+ global: { renderStubDefaultSlot: true },
97
+ props: {
98
+ bouts: [bout],
99
+ bracketSize: 'Final',
100
+ hostingClubColors: {},
101
+ listView: false
102
+ }
103
+ });
104
+
105
+ wrapper.findComponent(TableauColumn).vm.$emit('action:directingBout', bout);
106
+ await wrapper.vm.$nextTick();
107
+
108
+ expect(wrapper.emitted('action:directingBout')).toEqual([[bout]]);
109
+ });
110
+
111
+ it('spaces each rendered round by its actual column depth', () => {
112
+ const wrapper = shallowMount(Tableau, {
113
+ global: { renderStubDefaultSlot: true },
114
+ props: {
115
+ bouts: [bout],
116
+ bracketSize: 'Table of 8',
117
+ hostingClubColors: {},
118
+ listView: false
119
+ }
120
+ });
121
+
122
+ expect(wrapper.vm.getRoundLayout(0)).toEqual({ gapPx: 16, padTopPx: 0 });
123
+ expect(wrapper.vm.getRoundLayout(1)).toEqual({ gapPx: 89, padTopPx: 36.5 });
124
+ expect(wrapper.vm.getRoundLayout(2)).toEqual({ gapPx: 235, padTopPx: 109.5 });
125
+ });
126
+
127
+ it('orders the current 42-fencer fixture through Table of 8 without a legacy quarterfinal', () => {
128
+ const wrapper = shallowMount(Tableau, {
129
+ global: { renderStubDefaultSlot: true },
130
+ props: {
131
+ bouts: getDEWithBouts42Fencers.pools[0].Bouts,
132
+ bracketSize: 'Table of 64',
133
+ hostingClubColors: getDEWithBouts42Fencers.hostingClubColors,
134
+ listView: false
135
+ }
136
+ });
137
+
138
+ expect(wrapper.vm.winnerRoundEntries.map(([roundName]) => roundName)).toEqual([
139
+ 'Table of 64',
140
+ 'Table of 32',
141
+ 'Table of 16',
142
+ 'Table of 8',
143
+ 'Semifinal',
144
+ 'Final'
145
+ ]);
146
+ });
147
+
148
+ it('renders a current Table of 64 fixture with the expected bout count per round', () => {
149
+ const wrapper = shallowMount(Tableau, {
150
+ global: { renderStubDefaultSlot: true },
151
+ props: {
152
+ bouts: getDEBoutsTableOf64.pools[0].Bouts,
153
+ bracketSize: 'Table of 64',
154
+ hostingClubColors: getDEBoutsTableOf64.hostingClubColors,
155
+ listView: false
156
+ }
157
+ });
158
+
159
+ expect(wrapper.vm.winnerRoundEntries.map(([roundName, roundBouts]) => [roundName, roundBouts.length])).toEqual([
160
+ ['Table of 64', 32],
161
+ ['Table of 32', 16],
162
+ ['Table of 16', 8],
163
+ ['Table of 8', 4],
164
+ ['Semifinal', 2],
165
+ ['Final', 1]
166
+ ]);
167
+
168
+ const openingRound = wrapper.vm.winnerRoundEntries[0][1];
169
+ const openingFencers = openingRound.flatMap(roundBout => [roundBout.Person1, roundBout.Person2]);
170
+ const assignedFencerIds = new Set(openingFencers.filter(fencer => fencer.PersonId).map(fencer => fencer.PersonId));
171
+
172
+ expect(assignedFencerIds.size).toBe(61);
173
+ expect(openingFencers.filter(fencer => fencer.DisplayName === 'BYE')).toHaveLength(3);
174
+ });
175
+
176
+ it('renders a complete Table of 128 fixture for large-bracket layout coverage', () => {
177
+ const wrapper = shallowMount(Tableau, {
178
+ global: { renderStubDefaultSlot: true },
179
+ props: {
180
+ bouts: getDEBoutsTableOf128.pools[0].Bouts,
181
+ bracketSize: 'Table of 128',
182
+ hostingClubColors: getDEBoutsTableOf128.hostingClubColors,
183
+ listView: false
184
+ }
185
+ });
186
+
187
+ expect(wrapper.vm.winnerRoundEntries.map(([roundName, roundBouts]) => [roundName, roundBouts.length])).toEqual([
188
+ ['Table of 128', 64],
189
+ ['Table of 64', 32],
190
+ ['Table of 32', 16],
191
+ ['Table of 16', 8],
192
+ ['Table of 8', 4],
193
+ ['Semifinal', 2],
194
+ ['Final', 1]
195
+ ]);
196
+
197
+ const allBouts = getDEBoutsTableOf128.pools[0].Bouts;
198
+ const openingFencers = wrapper.vm.winnerRoundEntries[0][1].flatMap(roundBout => [
199
+ roundBout.Person1,
200
+ roundBout.Person2
201
+ ]);
202
+ const assignedFencerIds = new Set(openingFencers.filter(fencer => fencer.PersonId).map(fencer => fencer.PersonId));
203
+ const boutIds = new Set(allBouts.map(roundBout => roundBout.DEBoutId));
204
+ const missingNextBouts = allBouts.filter(
205
+ roundBout => roundBout.DENextBoutId && !boutIds.has(roundBout.DENextBoutId)
206
+ );
207
+
208
+ expect(allBouts).toHaveLength(127);
209
+ expect(assignedFencerIds.size).toBe(67);
210
+ expect(openingFencers.filter(fencer => fencer.DisplayName === 'BYE')).toHaveLength(61);
211
+ expect(missingNextBouts).toEqual([]);
212
+ });
213
+ });
214
+
215
+ describe('Tableau completed bout disclosure', () => {
216
+ it('keeps completed bouts out of the main list and routes corrections to editing', async () => {
217
+ const completedBout = { ...bout, BoutId: 43, DEBoutId: 2, Status: 'Completed' };
218
+ const wrapper = mountListView();
219
+ await wrapper.setProps({ bouts: [bout, completedBout] });
220
+ expect(wrapper.vm.listSections.flatMap(section => section.bouts)).toEqual([bout]);
221
+ const disclosure = wrapper.get('details');
222
+ expect(disclosure.attributes('open')).toBeUndefined();
223
+ expect(disclosure.get('summary').text()).toBe('Completed bouts (1)');
224
+ disclosure.findComponent(BoutCard).vm.$emit('action:editBout', { BoutId: 43 });
225
+ await wrapper.vm.$nextTick();
226
+ expect(wrapper.emitted('action:editBout')).toEqual([[completedBout]]);
227
+ expect(wrapper.emitted('action:directingBout')).toBeUndefined();
228
+ await wrapper.setProps({ bouts: [bout] });
229
+ expect(wrapper.find('details').exists()).toBe(false);
230
+ wrapper.unmount();
231
+ });
232
+ });
233
+
234
+ describe('Tableau directing list eligibility', () => {
235
+ it('omits future and BYE pairings from the directing list', async () => {
236
+ const wrapper = mountListView();
237
+ await wrapper.setProps({
238
+ bouts: [
239
+ bout,
240
+ { ...bout, BoutId: 43, Person2: null },
241
+ { ...bout, BoutId: 44, Person1: { PersonId: 0, DisplayName: 'BYE' } }
242
+ ]
243
+ });
244
+ expect(wrapper.vm.listSections.flatMap(section => section.bouts)).toEqual([bout]);
245
+ wrapper.unmount();
246
+ });
247
+ });