@dcrackel/hematournamentui 1.0.702 → 1.0.706

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcrackel/hematournamentui",
3
3
  "private": false,
4
- "version": "1.0.702",
4
+ "version": "1.0.706",
5
5
  "type": "module",
6
6
  "main": "dist/HemaTournamentUI-lib.umd.js",
7
7
  "module": "dist/HemaTournamentUI-lib.es.js",
@@ -63,19 +63,17 @@ export default {
63
63
  status,
64
64
  customStatus: b.customStatus || '',
65
65
  timeLeftSeconds,
66
- fencer1: {
67
- portrait: f1?.Images?.[0]?.URL || missingPortrait,
68
- name: f1?.DisplayName || 'Unknown Name',
69
- emits: ['action:assignBout', 'action:editBout', 'action:resumeBout', 'action:startBout', 'reorder:swap'],
70
- team: f1?.Club?.Name || 'Unknown Team',
71
- colorDot: this.hostingClubColors?.Color1 || 'red',
72
- },
73
- fencer2: {
74
- portrait: f2?.Images?.[0]?.URL || missingPortrait,
75
- name: f2?.DisplayName || 'Unknown Name',
76
- emits: ['action:assignBout', 'action:editBout', 'action:resumeBout', 'action:startBout', 'reorder:swap'],
77
- team: f2?.Club?.Name || 'Unknown Team',
78
- colorDot: this.hostingClubColors?.Color2 || 'blue',
66
+ fencer1: {
67
+ portrait: f1?.Images?.[0]?.URL || missingPortrait,
68
+ name: f1?.DisplayName || 'Unknown Name',
69
+ team: f1?.Club?.Name || 'Unknown Team',
70
+ colorDot: this.hostingClubColors?.Color1 || 'red',
71
+ },
72
+ fencer2: {
73
+ portrait: f2?.Images?.[0]?.URL || missingPortrait,
74
+ name: f2?.DisplayName || 'Unknown Name',
75
+ team: f2?.Club?.Name || 'Unknown Team',
76
+ colorDot: this.hostingClubColors?.Color2 || 'blue',
79
77
  },
80
78
  score1,
81
79
  score2,
@@ -0,0 +1,37 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { describe, expect, it } from 'vitest';
3
+ import BoutCard from '../../Cards/BoutCard/BoutCard.vue';
4
+ import Tableau from './Tableau.vue';
5
+
6
+ const bout = {
7
+ BoutId: 42,
8
+ DEBoutId: 1,
9
+ RoundLabel: 'Final',
10
+ Status: 'Scheduled',
11
+ Person1: { PersonId: 1, DisplayName: 'Fencer One' },
12
+ Person2: { PersonId: 2, DisplayName: 'Fencer Two' },
13
+ };
14
+
15
+ const mountListView = () => shallowMount(Tableau, {
16
+ props: {
17
+ bouts: [bout],
18
+ bracketSize: 'Final',
19
+ hostingClubColors: {},
20
+ largeCards: true,
21
+ listView: true,
22
+ },
23
+ });
24
+
25
+ describe('Tableau list view', () => {
26
+ it('enables bout interaction and emits the full bout when starting', async () => {
27
+ const wrapper = mountListView();
28
+ const boutCard = wrapper.findComponent(BoutCard);
29
+
30
+ expect(boutCard.props('editMode')).toBe(true);
31
+
32
+ boutCard.vm.$emit('action:startBout', { BoutId: bout.BoutId });
33
+ await wrapper.vm.$nextTick();
34
+
35
+ expect(wrapper.emitted('action:directingBout')).toEqual([[bout]]);
36
+ });
37
+ });
@@ -19,12 +19,12 @@
19
19
  <div class="border-b border-dropdownSelect mb-5"></div>
20
20
 
21
21
  <div v-for="bout in assignedBoutsToMe" :key="bout.BoutId" class="mb-4">
22
- <BoutCard
23
- :bout="bout"
24
- :hostingClubColors="hostingClubColors"
25
- :editMode="false"
26
- :reorderMode="false"
27
- :isAdmin="isAdmin"
22
+ <BoutCard
23
+ :bout="bout"
24
+ :hostingClubColors="hostingClubColors"
25
+ :editMode="true"
26
+ :reorderMode="false"
27
+ :isAdmin="isAdmin"
28
28
  @action:startBout="handleDirectingFromIds"
29
29
  @action:resumeBout="handleDirectingFromIds"
30
30
  @action:editBout="handleEditFromIds"
@@ -42,12 +42,12 @@
42
42
  <BaseText class="my-5" color="primaryHighlight" size="sm" :text="roundName" weight="bold"/>
43
43
 
44
44
  <div v-for="bout in bouts" :key="bout.BoutId" class="mb-4">
45
- <BoutCard
46
- :bout="bout"
47
- :hostingClubColors="hostingClubColors"
48
- :editMode="false"
49
- :reorderMode="false"
50
- :isAdmin="isAdmin"
45
+ <BoutCard
46
+ :bout="bout"
47
+ :hostingClubColors="hostingClubColors"
48
+ :editMode="true"
49
+ :reorderMode="false"
50
+ :isAdmin="isAdmin"
51
51
  @action:startBout="handleDirectingFromIds"
52
52
  @action:resumeBout="handleDirectingFromIds"
53
53
  @action:editBout="handleEditFromIds"
@@ -0,0 +1,71 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { describe, expect, it } from 'vitest';
3
+ import AssignDirectorModal from '../../../Molecules/Modals/AssignDirectorModal/AssignDirectorModal.vue';
4
+ import Tableau from '../../../Organisms/Containers/Tableau/Tableau.vue';
5
+ import Bracket from './Bracket.vue';
6
+
7
+ const bout = {
8
+ BoutId: 42,
9
+ DEBoutId: 1,
10
+ RoundLabel: 'Final',
11
+ Status: 'Scheduled',
12
+ Person1: { PersonId: 1, DisplayName: 'Fencer One' },
13
+ Person2: { PersonId: 2, DisplayName: 'Fencer Two' },
14
+ };
15
+
16
+ const director = {
17
+ PersonId: 7,
18
+ DisplayName: 'Director One',
19
+ PortraitUrl: '/director-one.png',
20
+ Ring: {
21
+ PoolId: 12,
22
+ RingName: 'Ring One',
23
+ },
24
+ };
25
+
26
+ const mountBracket = () => shallowMount(Bracket, {
27
+ props: {
28
+ bouts: [bout],
29
+ eventRules: [],
30
+ hostingClubColors: {},
31
+ connectedToServer: true,
32
+ directors: [director],
33
+ currentUserId: director.PersonId,
34
+ },
35
+ });
36
+
37
+ describe('Bracket director assignment', () => {
38
+ it('opens the assignment modal for the selected bout', async () => {
39
+ const wrapper = mountBracket();
40
+
41
+ wrapper.findComponent(Tableau).vm.$emit('action:assignBout', bout);
42
+ await wrapper.vm.$nextTick();
43
+
44
+ const modal = wrapper.findComponent(AssignDirectorModal);
45
+ expect(modal.props('show')).toBe(true);
46
+ expect(modal.props('bout')).toEqual(bout);
47
+ expect(modal.props('directors')).toEqual([director]);
48
+
49
+ wrapper.unmount();
50
+ });
51
+
52
+ it('emits cloned assignment intent without using the live-score event', async () => {
53
+ const wrapper = mountBracket();
54
+ const tableau = wrapper.findComponent(Tableau);
55
+
56
+ tableau.vm.$emit('action:assignBout', bout);
57
+ await wrapper.vm.$nextTick();
58
+
59
+ wrapper.findComponent(AssignDirectorModal).vm.$emit('assign', { bout, director });
60
+ await wrapper.vm.$nextTick();
61
+
62
+ const payload = wrapper.emitted('assign:director')[0][0];
63
+ expect(payload).toEqual({ bout, director });
64
+ expect(payload.bout).not.toBe(bout);
65
+ expect(payload.director).not.toBe(director);
66
+ expect(wrapper.emitted('update:bout')).toBeUndefined();
67
+ expect(wrapper.findComponent(AssignDirectorModal).props('show')).toBe(false);
68
+
69
+ wrapper.unmount();
70
+ });
71
+ });
@@ -77,8 +77,8 @@ import emptyDesertIcon from "../../../../assets/empty_desert_icon.png";
77
77
  import { tabs } from '../../../Util/tabs.js';
78
78
  import AssignDirectorModal from "../../../Molecules/Modals/AssignDirectorModal/AssignDirectorModal.vue";
79
79
 
80
- export default {
81
- emits: ['penalty:add', 'penalty:remove', 'penalty:update', 'submit:bout', 'tab:menu-click', 'update:bout', 'update:directing-bout'],
80
+ export default {
81
+ emits: ['assign:director', 'penalty:add', 'penalty:remove', 'penalty:update', 'submit:bout', 'tab:menu-click', 'update:bout', 'update:directing-bout'],
82
82
  components: {
83
83
  AssignDirectorModal,
84
84
  Tableau,
@@ -193,24 +193,15 @@ export default {
193
193
  window.removeEventListener('resize', this.updateViewBasedOnScreenSize);
194
194
  },
195
195
  methods: {
196
- handleAssignDirector({ bout, director }) {
197
- const boutId = bout?.BoutId;
198
- if (!boutId) return;
199
-
200
- const patched = {
201
- ...bout,
202
- RefereeId: director.PersonId,
203
- RefName: director.DisplayName,
204
- };
205
-
206
- this.boutsData = this.boutsData.map(b =>
207
- b.BoutId === boutId ? { ...b, ...patched } : b
208
- );
209
-
210
- // bubble up so the real app persists it
211
- this.$emit('update:bout', patched);
212
-
213
- this.closeAssignDirectorModal();
196
+ handleAssignDirector({ bout, director }) {
197
+ if (!bout?.BoutId || !director?.PersonId) return;
198
+
199
+ this.$emit('assign:director', {
200
+ bout: { ...bout },
201
+ director: { ...director }
202
+ });
203
+
204
+ this.closeAssignDirectorModal();
214
205
  },
215
206
  openAssignDirector(bout) {
216
207
  this.assigningBout = bout;