@playpilot/tpi 8.35.2 → 8.36.0
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/dist/editorial.mount.js +9 -9
- package/dist/link-injections.js +1 -1
- package/dist/mount.css +1 -1
- package/dist/mount.js +7 -7
- package/package.json +1 -1
- package/src/lib/api/providers.ts +3 -1
- package/src/lib/data/translations.ts +40 -0
- package/src/lib/fakeData.ts +6 -0
- package/src/lib/types/filter.d.ts +5 -2
- package/src/lib/types/participant.d.ts +1 -1
- package/src/routes/components/Explore/Filter/Filter.svelte +11 -5
- package/src/routes/components/Explore/Filter/FilterSorting.svelte +5 -4
- package/src/routes/components/Explore/Routes/ExploreResults.svelte +13 -8
- package/src/routes/components/GridTitle.svelte +11 -4
- package/src/routes/components/Icons/IconAttribution.svelte +1 -1
- package/src/routes/components/Modals/Modal.svelte +1 -1
- package/src/routes/components/Modals/ParticipantModal.svelte +1 -5
- package/src/routes/components/Participants/Participant.svelte +76 -135
- package/src/routes/components/Participants/ParticipantImage.svelte +2 -1
- package/src/tests/lib/api/providers.test.js +9 -0
- package/src/tests/routes/components/Explore/Filter/Filter.test.js +2 -1
- package/src/tests/routes/components/Participants/Participant.test.js +59 -21
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount } from 'svelte'
|
|
3
2
|
import { heading } from '$lib/actions/heading'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import type { ParticipantData } from '$lib/types/participant'
|
|
3
|
+
import type { Job, ParticipantData } from '$lib/types/participant'
|
|
4
|
+
import type { ExploreFilter, ExploreTitleSorting } from '$lib/types/filter'
|
|
7
5
|
import type { TitleData } from '$lib/types/title'
|
|
8
6
|
import { Sorting } from '$lib/enums/Sorting'
|
|
9
7
|
import { t } from '$lib/localization'
|
|
@@ -11,67 +9,42 @@
|
|
|
11
9
|
import { trackViaPixel } from '@playpilot/retargeting-tracking'
|
|
12
10
|
import { MetaEvent } from '$lib/enums/TrackingEvent'
|
|
13
11
|
import ParticipantImage from './ParticipantImage.svelte'
|
|
14
|
-
import
|
|
15
|
-
import
|
|
12
|
+
import ExploreResults from '../Explore/Routes/ExploreResults.svelte'
|
|
13
|
+
import Filter from '../Explore/Filter/Filter.svelte'
|
|
16
14
|
import Button from '../Button.svelte'
|
|
15
|
+
import { openModal } from '$lib/modal'
|
|
17
16
|
|
|
18
17
|
interface Props {
|
|
19
18
|
participant: ParticipantData
|
|
20
19
|
small?: boolean
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
type TitleSorting = { label: string; value: (typeof Sorting)[keyof typeof Sorting] }
|
|
24
|
-
|
|
25
22
|
const { participant, small = false }: Props = $props()
|
|
26
23
|
|
|
27
|
-
const { name,
|
|
24
|
+
const { name, description } = $derived(participant)
|
|
28
25
|
|
|
29
|
-
const
|
|
26
|
+
const filter: ExploreFilter = $state({})
|
|
27
|
+
const sortings: ExploreTitleSorting[] = [
|
|
30
28
|
{ label: 'Popularity', value: Sorting.Popular },
|
|
31
29
|
{ label: 'Top Rated', value: Sorting.Best },
|
|
32
30
|
{ label: 'IMDb Rating', value: Sorting.IMDb },
|
|
33
31
|
{ label: 'Year', value: Sorting.Chronological },
|
|
34
32
|
]
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
let page = $state(1)
|
|
40
|
-
let hasMorePages = $state(true)
|
|
41
|
-
let loading = $state(true)
|
|
42
|
-
let currentSorting = $state(sortings[0])
|
|
34
|
+
let clientWidth = $state(0)
|
|
35
|
+
let currentJob: 'all' | Job = $state('all')
|
|
36
|
+
let descriptionExpanded: boolean = $state(false)
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+
const filterWithParticipant: ExploreFilter = $derived({
|
|
39
|
+
...filter,
|
|
40
|
+
participant_sid: { type: 'string', value: participant.sid },
|
|
41
|
+
participant_job: { type: 'string', value: currentJob === 'all' ? null : currentJob }
|
|
42
|
+
})
|
|
45
43
|
|
|
46
44
|
if (isRetargetingAllowed()) trackViaPixel(MetaEvent.ParticipantView, { participant: participant.name })
|
|
47
45
|
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
return date.toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' })
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function loadMore(): Promise<void> {
|
|
54
|
-
loading = true
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
const results = await fetchTitlesForParticipant(participant, { page, sorting: currentSorting.value })
|
|
58
|
-
|
|
59
|
-
titles = [...titles, ...results]
|
|
60
|
-
hasMorePages = results?.length >= pageSize
|
|
61
|
-
} catch {
|
|
62
|
-
hasMorePages = false
|
|
63
|
-
} finally {
|
|
64
|
-
loading = false
|
|
65
|
-
page += 1
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function setSorting(sorting: TitleSorting): void {
|
|
70
|
-
currentSorting = sorting
|
|
71
|
-
titles = []
|
|
72
|
-
page = 1
|
|
73
|
-
|
|
74
|
-
loadMore()
|
|
46
|
+
function onTitleClick(event: MouseEvent, titles: TitleData[], index: number): void {
|
|
47
|
+
openModal({ event, type: 'titles-rail', data: titles, props: { initialIndex: index } })
|
|
75
48
|
}
|
|
76
49
|
</script>
|
|
77
50
|
|
|
@@ -81,60 +54,46 @@
|
|
|
81
54
|
<div>
|
|
82
55
|
<div class="heading" use:heading={2} id="heading">{name}</div>
|
|
83
56
|
|
|
84
|
-
{#if
|
|
85
|
-
<p class="
|
|
86
|
-
{
|
|
57
|
+
{#if description}
|
|
58
|
+
<p class="description" class:expanded={descriptionExpanded}>
|
|
59
|
+
{description}
|
|
87
60
|
</p>
|
|
61
|
+
|
|
62
|
+
<div class="read-more">
|
|
63
|
+
<Button variant="link" onclick={() => descriptionExpanded = !descriptionExpanded}>
|
|
64
|
+
{descriptionExpanded ? t('Read Less') : t('Read More')}
|
|
65
|
+
</Button>
|
|
66
|
+
</div>
|
|
88
67
|
{/if}
|
|
89
68
|
</div>
|
|
90
69
|
</div>
|
|
91
70
|
|
|
92
|
-
<div class="content">
|
|
93
|
-
{#if !small
|
|
71
|
+
<div class="content" class:small bind:clientWidth>
|
|
72
|
+
{#if !small}
|
|
94
73
|
<div class="list-header">
|
|
95
74
|
<div class="heading subheading" use:heading={3} id="credits">{t('Credits')}</div>
|
|
75
|
+
</div>
|
|
96
76
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
{/snippet}
|
|
104
|
-
|
|
105
|
-
{#snippet content()}
|
|
106
|
-
<div class="sortings">
|
|
107
|
-
{#each sortings as sorting}
|
|
108
|
-
<Button variant="link" onclick={() => setSorting(sorting)}>{t(sorting.label)}</Button>
|
|
109
|
-
{/each}
|
|
110
|
-
</div>
|
|
111
|
-
{/snippet}
|
|
112
|
-
</Dropdown>
|
|
113
|
-
</div>
|
|
77
|
+
<div class="jobs">
|
|
78
|
+
{#each ['all', ...participant.jobs] as job}
|
|
79
|
+
<Button variant="border" size="large" active={currentJob === job} onclick={() => currentJob = job as 'all' | Job}>
|
|
80
|
+
{t('Job: ' + job)}
|
|
81
|
+
</Button>
|
|
82
|
+
{/each}
|
|
114
83
|
</div>
|
|
115
|
-
{/if}
|
|
116
84
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<ListTitle {title} compact={small} onclick={(event) => openModal({ event, data: title })} />
|
|
120
|
-
{/each}
|
|
85
|
+
<Filter {filter} {sortings} limit={clientWidth < 700} hideActive />
|
|
86
|
+
{/if}
|
|
121
87
|
|
|
122
|
-
|
|
123
|
-
{#each { length: 6 }}
|
|
124
|
-
<div class="skeleton" data-testid="skeleton"></div>
|
|
125
|
-
{/each}
|
|
126
|
-
{:else if hasMorePages}
|
|
127
|
-
<button class="more" onclick={loadMore}>{t('Show More')}</button>
|
|
128
|
-
{/if}
|
|
129
|
-
</div>
|
|
88
|
+
<ExploreResults forceGrid hidePlaylinks filter={filterWithParticipant} {onTitleClick} />
|
|
130
89
|
</div>
|
|
131
90
|
|
|
132
91
|
<style lang="scss">
|
|
133
92
|
.header {
|
|
134
|
-
--participant-image-size: #{margin(
|
|
93
|
+
--participant-image-size: #{margin(5)};
|
|
135
94
|
display: grid;
|
|
136
|
-
grid-template-columns: calc(var(--participant-image-size))
|
|
137
|
-
align-items:
|
|
95
|
+
grid-template-columns: var(--participant-image-size) calc(100% - var(--participant-image-size) - margin(1));
|
|
96
|
+
align-items: start;
|
|
138
97
|
gap: margin(1);
|
|
139
98
|
padding: margin(3) margin(1) margin(2);
|
|
140
99
|
font-family: theme(detail-font-family, font-family);
|
|
@@ -145,11 +104,13 @@
|
|
|
145
104
|
|
|
146
105
|
@include desktop {
|
|
147
106
|
--participant-image-size: #{margin(8)};
|
|
107
|
+
padding: margin(3) margin(2) margin(2);
|
|
148
108
|
}
|
|
149
109
|
|
|
150
110
|
&.small {
|
|
151
111
|
--participant-image-size: #{margin(6)};
|
|
152
|
-
padding: margin(1);
|
|
112
|
+
padding: margin(1) margin(1) 0;
|
|
113
|
+
align-items: center;
|
|
153
114
|
}
|
|
154
115
|
}
|
|
155
116
|
|
|
@@ -162,19 +123,14 @@
|
|
|
162
123
|
font-style: theme(detail-title-font-style, normal);
|
|
163
124
|
|
|
164
125
|
&.subheading {
|
|
165
|
-
margin: 0;
|
|
166
126
|
font-size: theme(detail-title-small-font-size, margin(1.25));
|
|
167
127
|
}
|
|
168
128
|
|
|
169
129
|
.small & {
|
|
170
|
-
font-size:
|
|
130
|
+
font-size: 1.25em;
|
|
171
131
|
}
|
|
172
132
|
}
|
|
173
133
|
|
|
174
|
-
.dates {
|
|
175
|
-
margin: margin(0.5) 0 0;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
134
|
.content {
|
|
179
135
|
padding: 0 margin(1) margin(1);
|
|
180
136
|
color: theme(detail-text-color, text-color);
|
|
@@ -184,16 +140,38 @@
|
|
|
184
140
|
line-height: normal;
|
|
185
141
|
font-style: normal;
|
|
186
142
|
|
|
143
|
+
@include desktop {
|
|
144
|
+
padding: 0 margin(2) margin(2);
|
|
145
|
+
|
|
146
|
+
&.small {
|
|
147
|
+
padding: 0 margin(1) margin(1);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
187
151
|
::view-transition-old(content),
|
|
188
152
|
::view-transition-new(content) {
|
|
189
153
|
height: 100%;
|
|
190
154
|
}
|
|
191
155
|
}
|
|
192
156
|
|
|
193
|
-
.
|
|
194
|
-
display:
|
|
195
|
-
|
|
196
|
-
|
|
157
|
+
.description {
|
|
158
|
+
display: -webkit-box;
|
|
159
|
+
-webkit-box-orient: vertical;
|
|
160
|
+
margin: margin(0.5) 0 0;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
-webkit-line-clamp: 3;
|
|
163
|
+
line-clamp: 3;
|
|
164
|
+
color: theme(text-color-alt);
|
|
165
|
+
|
|
166
|
+
&.expanded {
|
|
167
|
+
display: block;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.read-more {
|
|
172
|
+
:global(.button) {
|
|
173
|
+
font-weight: bold;
|
|
174
|
+
}
|
|
197
175
|
}
|
|
198
176
|
|
|
199
177
|
.list-header {
|
|
@@ -203,47 +181,10 @@
|
|
|
203
181
|
margin-bottom: margin(0.5);
|
|
204
182
|
}
|
|
205
183
|
|
|
206
|
-
.
|
|
207
|
-
min-height: margin(7.25);
|
|
208
|
-
border-radius: theme(playlink-border-radius, border-radius);
|
|
209
|
-
background: theme(detail-background-light, lighter);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.more {
|
|
213
|
-
cursor: pointer;
|
|
214
|
-
appearance: none;
|
|
215
|
-
padding: margin(0.5) margin(1);
|
|
216
|
-
border: 0;
|
|
217
|
-
border-radius: theme(participants-load-more-border-radius, border-radius);
|
|
218
|
-
background: theme(participants-load-more-background, content);
|
|
219
|
-
color: inherit;
|
|
220
|
-
font-size: inherit;
|
|
221
|
-
font-family: inherit;
|
|
222
|
-
|
|
223
|
-
&:hover {
|
|
224
|
-
filter: brightness(1.2);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.sort {
|
|
184
|
+
.jobs {
|
|
229
185
|
display: flex;
|
|
230
|
-
|
|
231
|
-
gap: margin(0.
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.sortings {
|
|
236
|
-
:global(.button) {
|
|
237
|
-
display: block;
|
|
238
|
-
width: 100%;
|
|
239
|
-
padding: margin(0.5) margin(1);
|
|
240
|
-
text-align: left;
|
|
241
|
-
white-space: nowrap;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
:global(.button:hover) {
|
|
245
|
-
background: theme(content-light);
|
|
246
|
-
border-radius: 0;
|
|
247
|
-
}
|
|
186
|
+
flex-wrap: wrap;
|
|
187
|
+
gap: margin(0.5);
|
|
188
|
+
margin-bottom: margin(0.5);
|
|
248
189
|
}
|
|
249
190
|
</style>
|
|
@@ -3,6 +3,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
|
3
3
|
import { api } from '$lib/api/api'
|
|
4
4
|
import { fetchProviders } from '$lib/api/providers'
|
|
5
5
|
import { getApiToken } from '$lib/token'
|
|
6
|
+
import { title } from '$lib/fakeData'
|
|
6
7
|
|
|
7
8
|
vi.mock('$lib/token', () => ({
|
|
8
9
|
getApiToken: vi.fn(),
|
|
@@ -33,5 +34,13 @@ describe('$lib/api/ads', () => {
|
|
|
33
34
|
|
|
34
35
|
await expect(async () => await fetchProviders()).rejects.toThrow()
|
|
35
36
|
})
|
|
37
|
+
|
|
38
|
+
it('Should remove duplicates', async () => {
|
|
39
|
+
vi.mocked(api).mockResolvedValueOnce([title.providers[0], title.providers[0]])
|
|
40
|
+
|
|
41
|
+
const response = await fetchProviders()
|
|
42
|
+
|
|
43
|
+
expect(response).toEqual([title.providers[0]])
|
|
44
|
+
})
|
|
36
45
|
})
|
|
37
46
|
})
|
|
@@ -25,8 +25,9 @@ describe('Filter.svelte', () => {
|
|
|
25
25
|
it('Should not limit the number of filter items shown after pressing expand button', async () => {
|
|
26
26
|
const { getByText, getAllByTestId } = render(Filter, { filter: {} })
|
|
27
27
|
|
|
28
|
-
await fireEvent.click(getByText('
|
|
28
|
+
await fireEvent.click(getByText('Show more'))
|
|
29
29
|
|
|
30
|
+
expect(getByText('Show less')).toBeTruthy()
|
|
30
31
|
expect(getAllByTestId('filter-item')).toHaveLength(7)
|
|
31
32
|
})
|
|
32
33
|
|
|
@@ -3,15 +3,15 @@ import { describe, expect, it, vi, beforeEach } from 'vitest'
|
|
|
3
3
|
|
|
4
4
|
import Participant from '../../../../routes/components/Participants/Participant.svelte'
|
|
5
5
|
import { participants, title } from '$lib/fakeData'
|
|
6
|
-
import {
|
|
6
|
+
import { fetchTitles } from '$lib/api/titles'
|
|
7
7
|
import { Sorting } from '$lib/enums/Sorting'
|
|
8
8
|
|
|
9
9
|
vi.mock('$lib/tracking', () => ({
|
|
10
10
|
track: vi.fn(),
|
|
11
11
|
}))
|
|
12
12
|
|
|
13
|
-
vi.mock('$lib/api/
|
|
14
|
-
|
|
13
|
+
vi.mock('$lib/api/titles', () => ({
|
|
14
|
+
fetchTitles: vi.fn(),
|
|
15
15
|
}))
|
|
16
16
|
|
|
17
17
|
describe('Participant.svelte', () => {
|
|
@@ -19,18 +19,20 @@ describe('Participant.svelte', () => {
|
|
|
19
19
|
vi.resetAllMocks()
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
it('Should call
|
|
22
|
+
it('Should call fetchTitles on mount', async () => {
|
|
23
23
|
render(Participant, { participant: participants[0] })
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
await waitFor(() => {
|
|
26
|
+
expect(fetchTitles).toHaveBeenCalled()
|
|
27
|
+
})
|
|
26
28
|
})
|
|
27
29
|
|
|
28
30
|
it('Should render fetched titles after showing skeletons', async () => {
|
|
29
|
-
vi.mocked(
|
|
31
|
+
vi.mocked(fetchTitles).mockResolvedValueOnce({ results: [title, title], next: 'next', previous: 'previous' })
|
|
30
32
|
|
|
31
33
|
const { getAllByTestId } = render(Participant, { participant: participants[0] })
|
|
32
34
|
|
|
33
|
-
expect(getAllByTestId('skeleton')).toHaveLength(
|
|
35
|
+
expect(getAllByTestId('skeleton')).toHaveLength(24)
|
|
34
36
|
|
|
35
37
|
await waitFor(() => {
|
|
36
38
|
expect(getAllByTestId('title')).toHaveLength(2)
|
|
@@ -38,41 +40,68 @@ describe('Participant.svelte', () => {
|
|
|
38
40
|
})
|
|
39
41
|
|
|
40
42
|
it('Should not show load more button while loading and when fewer than page size of titles are fetched', async () => {
|
|
41
|
-
vi.mocked(
|
|
43
|
+
vi.mocked(fetchTitles).mockResolvedValueOnce({ results: [title, title], next: null, previous: 'previous' })
|
|
42
44
|
|
|
43
|
-
const {
|
|
45
|
+
const { queryByLabelText, getAllByTestId } = render(Participant, { participant: participants[0] })
|
|
44
46
|
|
|
45
|
-
expect(
|
|
47
|
+
expect(queryByLabelText('Show more movies & shows')).not.toBeTruthy()
|
|
46
48
|
|
|
47
49
|
await waitFor(() => {
|
|
48
50
|
expect(getAllByTestId('title')).toHaveLength(2)
|
|
49
51
|
})
|
|
50
52
|
|
|
51
|
-
expect(
|
|
53
|
+
expect(queryByLabelText('Show more movies & shows')).not.toBeTruthy()
|
|
52
54
|
})
|
|
53
55
|
|
|
54
56
|
it('Should show load more button after loading and if more than page size of titles are fetched', async () => {
|
|
55
|
-
const resolved = Array(30).fill(title)
|
|
56
|
-
vi.mocked(
|
|
57
|
+
const resolved = ({ results: Array(30).fill(title), next: 'next', previous: 'previous' })
|
|
58
|
+
vi.mocked(fetchTitles).mockResolvedValueOnce(resolved)
|
|
57
59
|
|
|
58
|
-
const {
|
|
60
|
+
const { getByLabelText } = render(Participant, { participant: participants[0] })
|
|
59
61
|
|
|
60
62
|
await waitFor(() => {
|
|
61
|
-
expect(
|
|
63
|
+
expect(getByLabelText('Show more movies & shows')).toBeTruthy()
|
|
62
64
|
})
|
|
63
65
|
})
|
|
64
66
|
|
|
65
67
|
it('Should fetch more titles when load more button is clicked', async () => {
|
|
66
|
-
const resolved = Array(30).fill(title)
|
|
67
|
-
vi.mocked(
|
|
68
|
+
const resolved = ({ results: Array(30).fill(title), next: 'next', previous: 'previous' })
|
|
69
|
+
vi.mocked(fetchTitles).mockResolvedValueOnce(resolved)
|
|
70
|
+
|
|
71
|
+
const { getByLabelText } = render(Participant, { participant: participants[0] })
|
|
72
|
+
|
|
73
|
+
await waitFor(() => getByLabelText('Show more movies & shows'))
|
|
74
|
+
|
|
75
|
+
await fireEvent.click(getByLabelText('Show more movies & shows'))
|
|
76
|
+
|
|
77
|
+
expect(fetchTitles).toHaveBeenCalledWith({ page: 2, page_size: expect.any(Number), participant_job: null, participant_sid: participants[0].sid })
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('Should include participant role in fetchTitles when selected and refetch', async () => {
|
|
81
|
+
const resolved = ({ results: Array(30).fill(title), next: 'next', previous: 'previous' })
|
|
82
|
+
vi.mocked(fetchTitles).mockResolvedValueOnce(resolved)
|
|
68
83
|
|
|
69
84
|
const { getByText } = render(Participant, { participant: participants[0] })
|
|
70
85
|
|
|
71
|
-
await
|
|
86
|
+
await fireEvent.click(getByText('Actor'))
|
|
87
|
+
|
|
88
|
+
await waitFor(() => {
|
|
89
|
+
expect(fetchTitles).toHaveBeenCalledWith(expect.objectContaining({ participant_job: 'actor' }))
|
|
90
|
+
})
|
|
91
|
+
})
|
|
72
92
|
|
|
73
|
-
|
|
93
|
+
it('Should include selected sorting specific to participants', async () => {
|
|
94
|
+
const resolved = ({ results: Array(30).fill(title), next: 'next', previous: 'previous' })
|
|
95
|
+
vi.mocked(fetchTitles).mockResolvedValueOnce(resolved)
|
|
74
96
|
|
|
75
|
-
|
|
97
|
+
const { getByText } = render(Participant, { participant: participants[0] })
|
|
98
|
+
|
|
99
|
+
await fireEvent.click(getByText('Sort by'))
|
|
100
|
+
await fireEvent.click(getByText('Year'))
|
|
101
|
+
|
|
102
|
+
await waitFor(() => {
|
|
103
|
+
expect(fetchTitles).toHaveBeenCalledWith(expect.objectContaining({ ordering: Sorting.Chronological }))
|
|
104
|
+
})
|
|
76
105
|
})
|
|
77
106
|
|
|
78
107
|
it('Should render as small variant when given', () => {
|
|
@@ -93,11 +122,20 @@ describe('Participant.svelte', () => {
|
|
|
93
122
|
})
|
|
94
123
|
|
|
95
124
|
it('Should not render image if not given', async () => {
|
|
96
|
-
|
|
97
125
|
const { queryByRole } = render(Participant, { participant: participants[0] })
|
|
98
126
|
|
|
99
127
|
await waitFor(() => {
|
|
100
128
|
expect(queryByRole('presentation')).not.toBeTruthy()
|
|
101
129
|
})
|
|
102
130
|
})
|
|
131
|
+
|
|
132
|
+
it('Should render description and toggle more on click of Read more button', async () => {
|
|
133
|
+
const { getByText } = render(Participant, { participant: participants[0] })
|
|
134
|
+
|
|
135
|
+
expect(getByText(participants[0].description)).toBeTruthy()
|
|
136
|
+
|
|
137
|
+
await fireEvent.click(getByText('Read more'))
|
|
138
|
+
|
|
139
|
+
expect(getByText('Read less')).toBeTruthy()
|
|
140
|
+
})
|
|
103
141
|
})
|