@saooti/octopus-sdk 41.5.3 → 41.5.5
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/CHANGELOG.md +20 -0
- package/package.json +1 -1
- package/src/components/composable/player/usePlayerLive.ts +17 -7
- package/src/components/display/filter/AdvancedSearch.vue +1 -1
- package/src/components/display/sharing/SharePlayer.vue +2 -1
- package/src/components/display/sharing/SharePlayerRadio.vue +2 -1
- package/src/components/form/ClassicDatePicker.vue +14 -1
- package/src/components/form/ClassicRadio.vue +5 -10
- package/src/components/misc/HomeDropdown.vue +9 -5
- package/src/components/misc/TopBar.vue +7 -1
- package/src/components/misc/TopBarMainContent.vue +15 -6
- package/src/components/pages/PlaylistPage.vue +2 -0
- package/tests/components/display/sharing/SharePlayer.spec.ts +58 -0
- package/tests/components/display/sharing/SharePlayerRadio.spec.ts +54 -0
- package/tests/components/misc/HomeDropdown.spec.ts +43 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 41.5.5 (16/02/2026)
|
|
4
|
+
|
|
5
|
+
**Fix**
|
|
6
|
+
|
|
7
|
+
- Correctif pour la lecture de lives/radio sur Organisation sécurisée sous
|
|
8
|
+
chrome
|
|
9
|
+
- Correction affichage critère de filtrage pour épisodes à valider
|
|
10
|
+
|
|
11
|
+
**Misc**
|
|
12
|
+
|
|
13
|
+
- Ajout de `frameborder="0"` dans les iframes miniplayer
|
|
14
|
+
- Ajustements de composants génériques
|
|
15
|
+
|
|
16
|
+
## 41.5.4 (12/02/2026)
|
|
17
|
+
|
|
18
|
+
**Misc**
|
|
19
|
+
|
|
20
|
+
- Ajouts d'options pour customiser les éléments de `TopBar`
|
|
21
|
+
- Ajout d'un slot `bottom` pour `PlaylistPage`
|
|
22
|
+
|
|
3
23
|
## 41.5.3 (09/02/2026)
|
|
4
24
|
|
|
5
25
|
**Fix**
|
package/package.json
CHANGED
|
@@ -28,19 +28,23 @@ export const usePlayerLive = (hlsReady: Ref<boolean>)=>{
|
|
|
28
28
|
return authStore.authParam.accessToken && ("SECURED" === playerStore.playerLive?.organisation?.privacy || playerStore.playerRadio?.secured);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
function onPlay(): void {
|
|
32
32
|
playerStore.playerChangeStatus(PlayerStatus.PAUSED ===playerStore.playerStatus);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function playRadio() {
|
|
36
|
-
if (!playerStore.playerRadio)
|
|
36
|
+
if (!playerStore.playerRadio) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
37
39
|
handleSessionIdRadio();
|
|
38
40
|
playerStore.playerUpdatePlayerHlsUrl(playerStore.playerRadio.url+"?origin=octopus&sessionId="+playerStore.playerRadio.sessionId);
|
|
39
41
|
playHls();
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
function handleSessionIdRadio(){
|
|
43
|
-
if(!playerStore.playerRadio)
|
|
45
|
+
if(!playerStore.playerRadio) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
44
48
|
if(playerStore.playerRadio.sessionId && dayjs().diff(dayjs(playerStore.playerRadio.dateSessionId), 'm')<maxMinutesSessionId){
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
@@ -48,7 +52,9 @@ export const usePlayerLive = (hlsReady: Ref<boolean>)=>{
|
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
function playLive() {
|
|
51
|
-
if (!playerStore.playerHlsIdentifier)
|
|
55
|
+
if (!playerStore.playerHlsIdentifier) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
52
58
|
playerStore.playerUpdatePlayerHlsUrl(`${apiStore.hlsUrl}live/${playerStore.playerHlsIdentifier}/index.m3u8`);
|
|
53
59
|
playHls();
|
|
54
60
|
}
|
|
@@ -74,11 +80,15 @@ export const usePlayerLive = (hlsReady: Ref<boolean>)=>{
|
|
|
74
80
|
!isChrome &&
|
|
75
81
|
!isAndroid
|
|
76
82
|
) {
|
|
83
|
+
let url = playerStore.playerHlsUrl;
|
|
77
84
|
if(needToAddToken.value) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
if (url.includes('?')) {
|
|
86
|
+
url += "&access_token="+authStore.authParam.accessToken;
|
|
87
|
+
} else {
|
|
88
|
+
url += "?access_token="+authStore.authParam.accessToken;
|
|
89
|
+
}
|
|
81
90
|
}
|
|
91
|
+
audioElement.value.src = url;
|
|
82
92
|
await initLiveDownloadId();
|
|
83
93
|
hlsReady.value = true;
|
|
84
94
|
await audioElement.value.play();
|
|
@@ -233,7 +233,7 @@ const isSelectValidity = computed(() => {
|
|
|
233
233
|
undefined !== organisation.value &&
|
|
234
234
|
organisationRight.value &&
|
|
235
235
|
authStore.isRoleContribution &&
|
|
236
|
-
!isPodcastmaker &&
|
|
236
|
+
!isPodcastmaker.value &&
|
|
237
237
|
!props.isEmission &&
|
|
238
238
|
props.includeHidden
|
|
239
239
|
);
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
allowfullscreen="true"
|
|
21
21
|
allow="clipboard-read; clipboard-write; autoplay"
|
|
22
22
|
referrerpolicy="no-referrer-when-downgrade"
|
|
23
|
+
frameborder="0"
|
|
23
24
|
:src="iFrameSrc"
|
|
24
25
|
width="100%"
|
|
25
26
|
:height="iFrameHeight"
|
|
@@ -273,7 +274,7 @@ const iFrame = computed(() => {
|
|
|
273
274
|
const specialDigiteka = props.podcast?.video?.videoId
|
|
274
275
|
? 'allowfullscreen="true" referrerpolicy="no-referrer-when-downgrade"'
|
|
275
276
|
: "";
|
|
276
|
-
return `<iframe src="${iFrameSrc.value}" width="100%" height="${iFrameHeight.value}" scrolling="no" ${specialDigiteka} allow="clipboard-read; clipboard-write; autoplay"></iframe>`;
|
|
277
|
+
return `<iframe src="${iFrameSrc.value}" width="100%" height="${iFrameHeight.value}" frameborder="0" scrolling="no" ${specialDigiteka} allow="clipboard-read; clipboard-write; autoplay"></iframe>`;
|
|
277
278
|
});
|
|
278
279
|
const dataTitle = computed(() => {
|
|
279
280
|
if (props.podcast) return props.podcast.podcastId;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
id="miniplayerIframeRadio"
|
|
9
9
|
title="Miniplayer"
|
|
10
10
|
:src="iFrameSrc"
|
|
11
|
+
frameborder="0"
|
|
11
12
|
width="100%"
|
|
12
13
|
height="140px"
|
|
13
14
|
style="overflow: hidden"
|
|
@@ -90,7 +91,7 @@ const iFrameSrc = computed(() => {
|
|
|
90
91
|
return url;
|
|
91
92
|
});
|
|
92
93
|
const iFrame = computed(() => {
|
|
93
|
-
return `<iframe src="${iFrameSrc.value}" width="100%" height="140px" scrolling="no" allow="clipboard-read; clipboard-write; autoplay"></iframe>`;
|
|
94
|
+
return `<iframe src="${iFrameSrc.value}" width="100%" height="140px" frameborder="0" scrolling="no" allow="clipboard-read; clipboard-write; autoplay"></iframe>`;
|
|
94
95
|
});
|
|
95
96
|
|
|
96
97
|
|
|
@@ -82,7 +82,19 @@ const props = defineProps({
|
|
|
82
82
|
})
|
|
83
83
|
|
|
84
84
|
//Emits
|
|
85
|
-
const emit = defineEmits
|
|
85
|
+
const emit = defineEmits<{
|
|
86
|
+
/**
|
|
87
|
+
* Update the date
|
|
88
|
+
* @param value The new date
|
|
89
|
+
* @deprecated
|
|
90
|
+
*/
|
|
91
|
+
(e: "updateDate", value: Date): void;
|
|
92
|
+
/**
|
|
93
|
+
* Update the date
|
|
94
|
+
* @param value The new date
|
|
95
|
+
*/
|
|
96
|
+
(e: "update:date", value: Date): void;
|
|
97
|
+
}>();
|
|
86
98
|
|
|
87
99
|
//Data
|
|
88
100
|
const divContainerRef = useTemplateRef('divContainer');
|
|
@@ -147,6 +159,7 @@ function updateValue(date: Date) {
|
|
|
147
159
|
(divContainerRef?.value as HTMLElement)?.focus();
|
|
148
160
|
}
|
|
149
161
|
emit("updateDate", date);
|
|
162
|
+
emit("update:date", date);
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
function formatDate(value: Date): string {
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
Available slots:
|
|
5
5
|
`label-{option.value}`: Slot to replace the label of the current option.
|
|
6
6
|
Binding: `option`: the current option
|
|
7
|
+
`selected` : true if the option is selected
|
|
7
8
|
`after-{option.value}`: Slot after the radio button
|
|
8
9
|
Binding: `option`: the current option
|
|
10
|
+
`selected` : true if the option is selected
|
|
9
11
|
-->
|
|
10
12
|
<template>
|
|
11
13
|
<div role="radiogroup" class="d-flex" :class="isColumn ? 'flex-column' : ''">
|
|
@@ -33,20 +35,14 @@
|
|
|
33
35
|
</div>
|
|
34
36
|
</template>
|
|
35
37
|
|
|
36
|
-
<script setup lang="ts">
|
|
37
|
-
|
|
38
|
-
interface Option {
|
|
39
|
-
title: string;
|
|
40
|
-
value: string | undefined
|
|
41
|
-
};
|
|
42
|
-
|
|
38
|
+
<script setup generic="T extends { title: string; value: string|undefined; }" lang="ts">
|
|
43
39
|
//Props
|
|
44
40
|
const { textInit } = defineProps({
|
|
45
41
|
idRadio: { default: "", type: String },
|
|
46
42
|
isDisabled: { default: false, type: Boolean },
|
|
47
43
|
options: {
|
|
48
44
|
default: () => [],
|
|
49
|
-
type: Array as () => Array<
|
|
45
|
+
type: Array as () => Array<T>,
|
|
50
46
|
},
|
|
51
47
|
textInit: { default: undefined, type: String },
|
|
52
48
|
isColumn: { default: true, type: Boolean },
|
|
@@ -60,11 +56,10 @@ function onChange(value:string){
|
|
|
60
56
|
emit('update:textInit', value)
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
function slotBindings(option:
|
|
59
|
+
function slotBindings(option: T): { option: T; selected: boolean } {
|
|
64
60
|
return {
|
|
65
61
|
option,
|
|
66
62
|
selected: textInit === option.value
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
|
|
70
65
|
</script>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<AppsIcon :size="30" />
|
|
10
10
|
</button>
|
|
11
11
|
<router-link
|
|
12
|
-
v-if="
|
|
12
|
+
v-if="displayUpload"
|
|
13
13
|
:title="t('Upload')"
|
|
14
14
|
to="/main/priv/upload"
|
|
15
15
|
class="btn admin-button hide-small-screen m-1 text-blue-octopus"
|
|
@@ -48,11 +48,15 @@ import { computed } from "vue";
|
|
|
48
48
|
import { useI18n } from "vue-i18n";
|
|
49
49
|
import { useRoute, useRouter } from "vue-router";
|
|
50
50
|
|
|
51
|
+
export interface HomeDropdownProps {
|
|
52
|
+
isEducation?: boolean;
|
|
53
|
+
mobileMenuDisplay?: boolean;
|
|
54
|
+
/** Display the upload button */
|
|
55
|
+
displayUpload?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
51
58
|
//Props
|
|
52
|
-
defineProps(
|
|
53
|
-
isEducation: { default: false, type: Boolean },
|
|
54
|
-
mobileMenuDisplay: { default: false, type: Boolean },
|
|
55
|
-
})
|
|
59
|
+
defineProps<HomeDropdownProps>();
|
|
56
60
|
|
|
57
61
|
//Composables
|
|
58
62
|
const { t } = useI18n();
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
:title-display="titleToDisplay"
|
|
12
12
|
style="height: var(--header-size);"
|
|
13
13
|
:class="headerBackgroundImage.length ? 'header-opacity':''"
|
|
14
|
+
:options="options?.topBarMainContent"
|
|
14
15
|
/>
|
|
15
16
|
</header>
|
|
16
17
|
<div v-if="generalStore.contentToDisplay" class="header-content-bg" :style="headerBackgroundImage" :class="{ scrolled: scrolled, 'header-force-blur':needToBlur }" >
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
|
|
31
32
|
<script setup lang="ts">
|
|
32
33
|
import {useImageProxy} from "../composable/useImageProxy";
|
|
33
|
-
import TopBarMainContent from "./TopBarMainContent.vue";
|
|
34
|
+
import TopBarMainContent, { type TopBarMainContentOptions } from "./TopBarMainContent.vue";
|
|
34
35
|
import { computed, defineAsyncComponent, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
35
36
|
import { useAuthStore } from "../../stores/AuthStore";
|
|
36
37
|
import { useGeneralStore } from "../../stores/GeneralStore";
|
|
@@ -44,6 +45,11 @@ const SubscribeButtons = defineAsyncComponent(
|
|
|
44
45
|
() => import("../display/sharing/SubscribeButtons.vue"),
|
|
45
46
|
);
|
|
46
47
|
|
|
48
|
+
defineProps<{
|
|
49
|
+
options?: {
|
|
50
|
+
topBarMainContent?: TopBarMainContentOptions
|
|
51
|
+
}
|
|
52
|
+
}>();
|
|
47
53
|
|
|
48
54
|
//Data
|
|
49
55
|
const scrolled = ref(false);
|
|
@@ -138,6 +138,7 @@
|
|
|
138
138
|
<HomeDropdown
|
|
139
139
|
:is-education="generalStore.platformEducation"
|
|
140
140
|
:mobile-menu-display="mobileMenuDisplay"
|
|
141
|
+
v-bind="options?.homeDropdown"
|
|
141
142
|
/>
|
|
142
143
|
<router-link
|
|
143
144
|
v-show="!isPhone && !inContentDisplayPage"
|
|
@@ -160,7 +161,7 @@ import ChevronDownIcon from "vue-material-design-icons/ChevronDown.vue";
|
|
|
160
161
|
import MagnifyIcon from "vue-material-design-icons/Magnify.vue";
|
|
161
162
|
import { useRubriquesFilterComputed } from "../composable/route/useRubriquesFilterComputed";
|
|
162
163
|
import { state } from "../../stores/ParamSdkStore";
|
|
163
|
-
import HomeDropdown from "./HomeDropdown.vue";
|
|
164
|
+
import HomeDropdown, { type HomeDropdownProps } from "./HomeDropdown.vue";
|
|
164
165
|
import {useImageProxy} from "../composable/useImageProxy";
|
|
165
166
|
import { useFilterStore } from "../../stores/FilterStore";
|
|
166
167
|
import { useAuthStore } from "../../stores/AuthStore";
|
|
@@ -170,13 +171,21 @@ import { useGeneralStore } from "../../stores/GeneralStore";
|
|
|
170
171
|
import { useI18n } from "vue-i18n";
|
|
171
172
|
const MobileMenu = defineAsyncComponent(() => import("./MobileMenu.vue"));
|
|
172
173
|
|
|
174
|
+
export interface TopBarMainContentOptions {
|
|
175
|
+
homeDropdown?: HomeDropdownProps;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface TopBarMainContentProps {
|
|
179
|
+
isPhone?: boolean;
|
|
180
|
+
titleDisplay?: string;
|
|
181
|
+
scrolled?: boolean;
|
|
182
|
+
};
|
|
173
183
|
|
|
174
184
|
//Props
|
|
175
|
-
const props = defineProps
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
})
|
|
185
|
+
const props = defineProps<TopBarMainContentProps & {
|
|
186
|
+
/** Props for subcomponents */
|
|
187
|
+
options?: TopBarMainContentOptions;
|
|
188
|
+
}>();
|
|
180
189
|
|
|
181
190
|
|
|
182
191
|
//Composables
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import '@tests/mocks/useRouter';
|
|
2
|
+
import '@tests/mocks/i18n';
|
|
3
|
+
|
|
4
|
+
import SharePlayer from '@/components/display/sharing/SharePlayer.vue';
|
|
5
|
+
import { mount as testMount } from '@tests/utils';
|
|
6
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
7
|
+
import { useApiStore } from '@/stores/ApiStore';
|
|
8
|
+
import { useSaveFetchStore } from '@/stores/SaveFetchStore';
|
|
9
|
+
|
|
10
|
+
describe('SharePlayer', () => {
|
|
11
|
+
it('renders iframe with frameborder="0"', async () => {
|
|
12
|
+
const wrapper = await testMount(SharePlayer, {
|
|
13
|
+
props: {
|
|
14
|
+
podcast: {
|
|
15
|
+
podcastId: 123,
|
|
16
|
+
organisation: { id: 'org1' },
|
|
17
|
+
availability: { visibility: true }
|
|
18
|
+
},
|
|
19
|
+
organisationId: 'org1',
|
|
20
|
+
notExclusive: true
|
|
21
|
+
},
|
|
22
|
+
beforeMount: async () => {
|
|
23
|
+
const apiStore = useApiStore();
|
|
24
|
+
apiStore.miniplayerUrl = 'https://test.com/';
|
|
25
|
+
|
|
26
|
+
const saveFetchStore = useSaveFetchStore();
|
|
27
|
+
vi.spyOn(saveFetchStore, 'getOrgaAttributes').mockResolvedValue({});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const iframe = wrapper.find('#miniplayerIframe');
|
|
32
|
+
expect(iframe.attributes('frameborder')).toBe('0');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('includes frameborder="0" in generated iframe code', async () => {
|
|
36
|
+
const wrapper = await testMount(SharePlayer, {
|
|
37
|
+
props: {
|
|
38
|
+
podcast: {
|
|
39
|
+
podcastId: 123,
|
|
40
|
+
organisation: { id: 'org1' },
|
|
41
|
+
availability: { visibility: true }
|
|
42
|
+
},
|
|
43
|
+
organisationId: 'org1',
|
|
44
|
+
notExclusive: true
|
|
45
|
+
},
|
|
46
|
+
beforeMount: async () => {
|
|
47
|
+
const apiStore = useApiStore();
|
|
48
|
+
apiStore.miniplayerUrl = 'https://test.com/';
|
|
49
|
+
|
|
50
|
+
const saveFetchStore = useSaveFetchStore();
|
|
51
|
+
vi.spyOn(saveFetchStore, 'getOrgaAttributes').mockResolvedValue({});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const iFrameCode = (wrapper.vm as any).iFrame;
|
|
56
|
+
expect(iFrameCode).toContain('frameborder="0"');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import '@tests/mocks/useRouter';
|
|
2
|
+
import '@tests/mocks/i18n';
|
|
3
|
+
|
|
4
|
+
import SharePlayerRadio from '@/components/display/sharing/SharePlayerRadio.vue';
|
|
5
|
+
import { mount as testMount } from '@tests/utils';
|
|
6
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
7
|
+
import { useApiStore } from '@/stores/ApiStore';
|
|
8
|
+
import { useSaveFetchStore } from '@/stores/SaveFetchStore';
|
|
9
|
+
|
|
10
|
+
describe('SharePlayerRadio', () => {
|
|
11
|
+
it('renders iframe with frameborder="0"', async () => {
|
|
12
|
+
const wrapper = await testMount(SharePlayerRadio, {
|
|
13
|
+
props: {
|
|
14
|
+
canal: {
|
|
15
|
+
id: 'radio1',
|
|
16
|
+
organisationId: 'org1'
|
|
17
|
+
},
|
|
18
|
+
organisationId: 'org1'
|
|
19
|
+
},
|
|
20
|
+
beforeMount: async () => {
|
|
21
|
+
const apiStore = useApiStore();
|
|
22
|
+
apiStore.miniplayerUrl = 'https://test.com/';
|
|
23
|
+
|
|
24
|
+
const saveFetchStore = useSaveFetchStore();
|
|
25
|
+
vi.spyOn(saveFetchStore, 'getOrgaAttributes').mockResolvedValue({});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const iframe = wrapper.find('#miniplayerIframeRadio');
|
|
30
|
+
expect(iframe.attributes('frameborder')).toBe('0');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('includes frameborder="0" in generated iframe code', async () => {
|
|
34
|
+
const wrapper = await testMount(SharePlayerRadio, {
|
|
35
|
+
props: {
|
|
36
|
+
canal: {
|
|
37
|
+
id: 'radio1',
|
|
38
|
+
organisationId: 'org1'
|
|
39
|
+
},
|
|
40
|
+
organisationId: 'org1'
|
|
41
|
+
},
|
|
42
|
+
beforeMount: async () => {
|
|
43
|
+
const apiStore = useApiStore();
|
|
44
|
+
apiStore.miniplayerUrl = 'https://test.com/';
|
|
45
|
+
|
|
46
|
+
const saveFetchStore = useSaveFetchStore();
|
|
47
|
+
vi.spyOn(saveFetchStore, 'getOrgaAttributes').mockResolvedValue({});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const iFrameCode = (wrapper.vm as any).iFrame;
|
|
52
|
+
expect(iFrameCode).toContain('frameborder="0"');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import '@tests/mocks/useRouter';
|
|
2
|
+
import '@tests/mocks/i18n';
|
|
3
|
+
|
|
4
|
+
import HomeDropdown from '@/components/misc/HomeDropdown.vue';
|
|
5
|
+
import { mount } from '@tests/utils';
|
|
6
|
+
import { describe, expect, it } from 'vitest';
|
|
7
|
+
|
|
8
|
+
describe('HomeDropdown - displayUpload prop', () => {
|
|
9
|
+
it('displays the upload button when displayUpload is true', async () => {
|
|
10
|
+
const wrapper = await mount(HomeDropdown, {
|
|
11
|
+
props: {
|
|
12
|
+
displayUpload: true
|
|
13
|
+
},
|
|
14
|
+
stubs: ['ClassicPopover', 'UserButtonContent', 'AppsIcon', 'AccountIcon', 'DownloadIcon']
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const uploadButton = wrapper.find('a[title="Upload"]');
|
|
18
|
+
expect(uploadButton.exists()).toBe(true);
|
|
19
|
+
expect(uploadButton.attributes('to')).toBe('/main/priv/upload');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('does not display the upload button when displayUpload is false', async () => {
|
|
23
|
+
const wrapper = await mount(HomeDropdown, {
|
|
24
|
+
props: {
|
|
25
|
+
displayUpload: false
|
|
26
|
+
},
|
|
27
|
+
stubs: ['ClassicPopover', 'UserButtonContent', 'AppsIcon', 'AccountIcon', 'DownloadIcon']
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const uploadButton = wrapper.find('a[title="Upload"]');
|
|
31
|
+
expect(uploadButton.exists()).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('does not display the upload button when displayUpload is undefined', async () => {
|
|
35
|
+
const wrapper = await mount(HomeDropdown, {
|
|
36
|
+
props: {},
|
|
37
|
+
stubs: ['ClassicPopover', 'UserButtonContent', 'AppsIcon', 'AccountIcon', 'DownloadIcon']
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const uploadButton = wrapper.find('a[title="Upload"]');
|
|
41
|
+
expect(uploadButton.exists()).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
});
|