@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,128 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
highLight: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
default: false
|
|
84
|
-
},
|
|
85
|
-
faded: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: false
|
|
88
|
-
},
|
|
89
|
-
isCountingBackwardsMaxScore: {
|
|
90
|
-
type: Number,
|
|
91
|
-
default: 0
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
computed: {
|
|
95
|
-
portraitURL() {
|
|
96
|
-
const images = this.fencer.Images || [];
|
|
97
|
-
const portrait = images.find(image => image.URL);
|
|
98
|
-
return portrait ? portrait.URL : '';
|
|
99
|
-
},
|
|
100
|
-
fencerScore() {
|
|
101
|
-
const rawScore = this.score;
|
|
102
|
-
return this.isCountingBackwardsMaxScore > 0 ? this.isCountingBackwardsMaxScore - rawScore : rawScore;
|
|
103
|
-
},
|
|
104
|
-
name() {
|
|
105
|
-
//if (this.fencer.DisplayName === "BYE") return "";
|
|
106
|
-
return this.fencer.DisplayName;
|
|
107
|
-
},
|
|
108
|
-
club() {
|
|
109
|
-
if (this.fencer.DisplayName === 'BYE' || this.fencer.DisplayName === '') return '';
|
|
110
|
-
return this.fencer.Club.Name;
|
|
111
|
-
},
|
|
112
|
-
width() {
|
|
113
|
-
return this.large ? ' w-72' : ' w-40';
|
|
114
|
-
},
|
|
115
|
-
highLighted() {
|
|
116
|
-
return this.highLight ? 'border-bright' : 'border-poolSetup';
|
|
117
|
-
},
|
|
118
|
-
opacity() {
|
|
119
|
-
return this.faded ? 'opacity-60 shadow-md' : 'shadow-xl';
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
methods: {
|
|
123
|
-
handleHighLight(value) {
|
|
124
|
-
this.$emit('action:highLight', value);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<section class="flex h-7 w-40 overflow-hidden border border-poolSetup bg-poolSetup" :class="cornerClass">
|
|
3
|
+
<div class="flex w-5 shrink-0 items-center justify-center px-1" :class="positionColorClass">
|
|
4
|
+
<BaseText :text="position" size="xs" color="neutral" />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="flex min-w-0 flex-1 items-center px-2">
|
|
8
|
+
<BaseText :text="name" size="xs" color="quaternary" class="truncate whitespace-nowrap" />
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="flex w-7 shrink-0 items-center justify-center border-l border-poolSetup" :class="scoreColor">
|
|
12
|
+
<BaseText v-if="showScore" :text="displayedScore" size="xs" color="neutral" />
|
|
13
|
+
</div>
|
|
14
|
+
</section>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import BaseText from '../../../Atoms/Text/BaseText.vue';
|
|
19
|
+
|
|
20
|
+
const cornerClasses = {
|
|
21
|
+
none: '',
|
|
22
|
+
top: 'rounded-t',
|
|
23
|
+
bottom: 'rounded-b'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'TableauFencerCard',
|
|
28
|
+
components: { BaseText },
|
|
29
|
+
props: {
|
|
30
|
+
fencer: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
score: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
position: {
|
|
39
|
+
type: [String, Number],
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
color: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ''
|
|
45
|
+
},
|
|
46
|
+
scoreColor: {
|
|
47
|
+
type: String,
|
|
48
|
+
required: true
|
|
49
|
+
},
|
|
50
|
+
showScore: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true
|
|
53
|
+
},
|
|
54
|
+
isCountingBackwardsMaxScore: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 0
|
|
57
|
+
},
|
|
58
|
+
corners: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'none',
|
|
61
|
+
validator: value => Object.hasOwn(cornerClasses, value)
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
computed: {
|
|
65
|
+
cornerClass() {
|
|
66
|
+
return cornerClasses[this.corners];
|
|
67
|
+
},
|
|
68
|
+
displayedScore() {
|
|
69
|
+
const score = Number(this.score || 0);
|
|
70
|
+
return this.isCountingBackwardsMaxScore > 0 ? this.isCountingBackwardsMaxScore - score : score;
|
|
71
|
+
},
|
|
72
|
+
name() {
|
|
73
|
+
return String(this.fencer?.DisplayName || '');
|
|
74
|
+
},
|
|
75
|
+
positionColorClass() {
|
|
76
|
+
return this.color ? `bg-${this.color}` : 'bg-dropdownSelect';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
@@ -18,9 +18,18 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<div class="flex flex-col w-3/4 md:w-4/12 justify-start">
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
21
|
+
<div class="flex items-center justify-start gap-2 min-w-0">
|
|
22
|
+
<button class="min-w-0 text-left" type="button" @click="handleForwardToProfile">
|
|
23
|
+
<BaseText
|
|
24
|
+
:text="displayName"
|
|
25
|
+
size="md"
|
|
26
|
+
color="quaternary"
|
|
27
|
+
weight="bold"
|
|
28
|
+
class="text-sm md:text-xl truncate"
|
|
29
|
+
/>
|
|
30
|
+
</button>
|
|
31
|
+
<MissingHemaRatingsId :person="person.Person" />
|
|
32
|
+
</div>
|
|
24
33
|
<span class="w-full flex justify-start">
|
|
25
34
|
<BaseText :text="clubName" size="md" color="quinary" weight="normal" class="hidden md:block" />
|
|
26
35
|
<BaseText :text="clubShortName" size="xs" color="quinary" weight="normal" class="block md:hidden" />
|
|
@@ -86,10 +95,11 @@
|
|
|
86
95
|
import BaseIcon from '../../../Atoms/Icon/BaseIcon.vue';
|
|
87
96
|
import BaseText from '../../../Atoms/Text/BaseText.vue';
|
|
88
97
|
import BaseButton from '../../../Molecules/Buttons/BaseButton/BaseButton.vue';
|
|
98
|
+
import MissingHemaRatingsId from '../../../Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue';
|
|
89
99
|
|
|
90
100
|
export default {
|
|
91
101
|
name: 'WaitlistFencerCard',
|
|
92
|
-
components: { BaseButton, BaseIcon, BaseText },
|
|
102
|
+
components: { BaseButton, BaseIcon, BaseText, MissingHemaRatingsId },
|
|
93
103
|
emits: ['forward:toProfile', 'move:active', 'remove:fencer'],
|
|
94
104
|
props: {
|
|
95
105
|
person: {
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import GenericImageCropper from './ImageCropper.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Organisms/ComplexInputs/ImageCropper',
|
|
5
|
-
component: GenericImageCropper,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
args: {},
|
|
8
|
-
argTypes: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
};
|
|
1
|
+
import GenericImageCropper from './ImageCropper.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Organisms/ComplexInputs/ImageCropper',
|
|
5
|
+
component: GenericImageCropper,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
args: { urlToImage: '', isProfile: true, disabled: false },
|
|
8
|
+
argTypes: {
|
|
9
|
+
urlToImage: { control: 'text' },
|
|
10
|
+
uploadImageName: { control: 'text' },
|
|
11
|
+
uploadServer: { control: 'text' },
|
|
12
|
+
imageServer: { control: 'text' },
|
|
13
|
+
isProfile: { control: 'boolean' },
|
|
14
|
+
disabled: { control: 'boolean' },
|
|
15
|
+
'update:url': { action: 'update:url' },
|
|
16
|
+
'update:uploading': { action: 'update:uploading' },
|
|
17
|
+
'error:load': { action: 'error:load' },
|
|
18
|
+
'error:upload': { action: 'error:upload' }
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Default = {
|
|
23
|
+
args: {
|
|
24
|
+
urlToImage: '',
|
|
25
|
+
isProfile: true
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Disabled = {
|
|
30
|
+
args: { urlToImage: '', isProfile: true, disabled: true }
|
|
31
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
2
|
+
import { enableAutoUnmount, mount } from '@vue/test-utils';
|
|
3
|
+
import ImageCropper from './ImageCropper.vue';
|
|
4
|
+
|
|
5
|
+
enableAutoUnmount(afterEach);
|
|
6
|
+
|
|
7
|
+
const mountCropper = props =>
|
|
8
|
+
mount(ImageCropper, {
|
|
9
|
+
props: {
|
|
10
|
+
urlToImage: 'https://images.example/profile.png',
|
|
11
|
+
imageServer: 'https://images.example/',
|
|
12
|
+
uploadImageName: 'profile',
|
|
13
|
+
isProfile: true,
|
|
14
|
+
...props
|
|
15
|
+
},
|
|
16
|
+
global: { stubs: { AvatarCropper: true } }
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe('ImageCropper upload draft events', () => {
|
|
20
|
+
it('emits a successful upload URL and previews it with a fresh cache key', async () => {
|
|
21
|
+
const wrapper = mountCropper({ uploadImageName: 'new-profile' });
|
|
22
|
+
wrapper.vm.handleUploading();
|
|
23
|
+
wrapper.vm.handleUploaded({ response: { status: 201 } });
|
|
24
|
+
await wrapper.vm.$nextTick();
|
|
25
|
+
|
|
26
|
+
expect(wrapper.emitted('update:url')).toEqual([['https://images.example/new-profile.png']]);
|
|
27
|
+
expect(wrapper.emitted('update:uploading')).toEqual([[true], [false]]);
|
|
28
|
+
const preview = new URL(wrapper.find('img').attributes('src'));
|
|
29
|
+
expect(preview.pathname).toBe('/new-profile.png');
|
|
30
|
+
expect(preview.searchParams.has('preview')).toBe(true);
|
|
31
|
+
await wrapper.setProps({ urlToImage: 'https://images.example/new-profile.png' });
|
|
32
|
+
expect(wrapper.find('img').attributes('src')).toBe(preview.href);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('refreshes the preview even when an upload overwrites the existing URL', async () => {
|
|
36
|
+
const wrapper = mountCropper();
|
|
37
|
+
wrapper.vm.handleUploaded({ response: { status: 200 } });
|
|
38
|
+
await wrapper.vm.$nextTick();
|
|
39
|
+
expect(wrapper.find('img').attributes('src')).toContain('/profile.png?preview=');
|
|
40
|
+
expect(wrapper.emitted('update:url')).toEqual([['https://images.example/profile.png']]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('keeps the previous image and reports unsuccessful responses separately', () => {
|
|
44
|
+
const wrapper = mountCropper();
|
|
45
|
+
wrapper.vm.handleUploading();
|
|
46
|
+
wrapper.vm.handleUploaded({ response: { status: 500 } });
|
|
47
|
+
expect(wrapper.vm.uploading).toBe(false);
|
|
48
|
+
expect(wrapper.vm.localImageUrl).toBe('https://images.example/profile.png');
|
|
49
|
+
expect(wrapper.emitted('update:url')).toBeUndefined();
|
|
50
|
+
expect(wrapper.emitted('error:upload')[0][0]).toMatchObject({ message: 'Image upload failed.', status: 500 });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('reports malformed upload responses without crashing or emitting an edit', () => {
|
|
54
|
+
const wrapper = mountCropper();
|
|
55
|
+
wrapper.vm.handleUploaded(undefined);
|
|
56
|
+
expect(wrapper.emitted('update:url')).toBeUndefined();
|
|
57
|
+
expect(wrapper.emitted('error:upload')).toHaveLength(1);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('rejects unsafe uploaded URLs', () => {
|
|
61
|
+
const wrapper = mountCropper({ imageServer: 'javascript:' });
|
|
62
|
+
wrapper.vm.handleUploaded({ response: { status: 200 } });
|
|
63
|
+
expect(wrapper.emitted('update:url')).toBeUndefined();
|
|
64
|
+
expect(wrapper.emitted('error:upload')[0][0].message).toContain('valid image URL');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('shows a placeholder on image-load failure and leaves the draft URL intact', async () => {
|
|
68
|
+
const wrapper = mountCropper();
|
|
69
|
+
await wrapper.find('img').trigger('error');
|
|
70
|
+
expect(wrapper.emitted('update:url')).toBeUndefined();
|
|
71
|
+
expect(wrapper.emitted('error:load')[0][0]).toMatchObject({ url: 'https://images.example/profile.png' });
|
|
72
|
+
expect(wrapper.find('img').attributes('src')).not.toBe('https://images.example/profile.png');
|
|
73
|
+
expect(wrapper.vm.localImageUrl).toBe('https://images.example/profile.png');
|
|
74
|
+
expect(wrapper.vm.showCropper).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('reconciles authoritative URL changes after a failed preview', async () => {
|
|
78
|
+
const wrapper = mountCropper();
|
|
79
|
+
await wrapper.find('img').trigger('error');
|
|
80
|
+
await wrapper.setProps({ urlToImage: 'https://images.example/confirmed.png' });
|
|
81
|
+
expect(wrapper.find('img').attributes('src')).toBe('https://images.example/confirmed.png');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('reports the cropper upload error and releases the busy state', () => {
|
|
85
|
+
const wrapper = mountCropper();
|
|
86
|
+
wrapper.vm.handleUploading();
|
|
87
|
+
wrapper.vm.handlerError({ type: 'upload', message: 'Upload rejected', context: { response: { status: 413 } } });
|
|
88
|
+
expect(wrapper.emitted('error:upload')).toEqual([[{ message: 'Upload rejected', status: 413 }]]);
|
|
89
|
+
expect(wrapper.vm.uploading).toBe(false);
|
|
90
|
+
expect(wrapper.emitted('update:url')).toBeUndefined();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('reports rejected upload requests and releases the busy state', async () => {
|
|
94
|
+
const wrapper = mountCropper();
|
|
95
|
+
const response = Promise.reject(new Error('Network unavailable'));
|
|
96
|
+
wrapper.vm.handleUploading({ response });
|
|
97
|
+
await wrapper.vm.$nextTick();
|
|
98
|
+
expect(wrapper.vm.uploading).toBe(false);
|
|
99
|
+
expect(wrapper.emitted('error:upload')[0][0].message).toBe('Network unavailable');
|
|
100
|
+
expect(wrapper.emitted('update:url')).toBeUndefined();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('disables the native image selector and guards programmatic opening', () => {
|
|
104
|
+
const wrapper = mountCropper({ disabled: true });
|
|
105
|
+
expect(wrapper.find('button').attributes('disabled')).toBeDefined();
|
|
106
|
+
wrapper.vm.setShowCropper();
|
|
107
|
+
expect(wrapper.vm.showCropper).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
});
|