@playpilot/tpi 8.28.0 → 8.29.0-beta.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.28.0",
3
+ "version": "8.29.0-beta.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -1,122 +1,122 @@
1
- import type { InsertPosition } from './position'
2
-
3
- export type ConfigResponse = {
4
- /**
5
- * Used to exclude URL matching a regex pattern. If a url matches, nothing is executed beyond fetching the config.
6
- * The url should never be indexed.
7
- */
8
- exclude_urls_pattern?: string
9
-
10
- /**
11
- * Used to inject custom styling for the links, modal, and popover. All styling is done via CSS variables. The passed
12
- * string should not contain a selector.
13
- * For example:
14
- * `--some-variable: some-value;`
15
- *
16
- * rather than:
17
- * `body { --some-variable: some-value; }`
18
- */
19
- custom_style?: string
20
-
21
- /**
22
- * The primary selector for the entire article from which text will be selected. Should contain as little content as
23
- * possible. Should match all pages. May contain multiple selectors like `.article, .listicle`.
24
- */
25
- html_selector?: string
26
-
27
- /**
28
- * Some pages contain elements that can't easily be excluded via the `html_selector`. These elements can instead be
29
- * excluded via this property. May contain multiple selectors like `.footer, .ad`.
30
- */
31
- exclude_elements_selector?: string
32
-
33
- /**
34
- * Disable all injections from showing on pages without editorial mode enabled
35
- */
36
- disable_public_injections?: boolean
37
-
38
- /**
39
- * Region to fall back on if other methods of getting the region fail. This should be equal to the region most relevant
40
- * to the partner. Should be lowercase.
41
- */
42
- fallback_region?: string
43
-
44
- /**
45
- * Disclaimer text that is shown above playlinks in title cards used to replace the default text
46
- */
47
- playlinks_disclaimer_text?: string
48
-
49
- /**
50
- * Some partners may want to display titles without affiliate links, which currently comes down to no playlinks.
51
- * This can also be set via the config on the script itself.
52
- */
53
- no_affiliate?: boolean
54
-
55
- /**
56
- * Whether or not we can insert retargeting pixels. Not all third parties allow this and it is disabled by default
57
- */
58
- allow_retargeting_pixels?: boolean
59
-
60
- /**
61
- * By default affiliate links (playlinks) will render as links even without consent, as a disclaimer is given. Set to true to require explicit consent, rendering as static text without consent.
62
- */
63
- require_affiliate_consent?: boolean
64
-
65
- /**
66
- * Scroll reveal posters that show on mobile are enabled by default. Use this option to disable them.
67
- */
68
- disable_scroll_reveal_posters?: boolean
69
-
70
- /**
71
- * Playlinks are merged by default, when this option is enabled playlinks will instead be shown categorized.
72
- */
73
- categorize_playlinks?: boolean
74
-
75
- /**
76
- * By default no user identifiable data is tracked. This can be changed using this option. User ids are stored in localStorage and sent along with any tracking request.
77
- */
78
- allow_user_id_tracking?: boolean
79
-
80
- /**
81
- * The sid for the current domain, used for tracking
82
- */
83
- domain_sid?: string
84
-
85
- /**
86
- * The sid for the organization the domain belongs to, used for tracking. Can be empty.
87
- */
88
- organization_sid?: string
89
-
90
- /**
91
- * The following options are all relevant for in text disclaimers, which renders as a disclaimer text within the article,
92
- * rather than only inside of title cards.
93
- * Change the text content using `in_text_disclaimer_text`.
94
- * Change where the element is inserted using `in_text_disclaimer_selector`, by default it will insert before the first text element.
95
- * Change the insert position using `in_text_disclaimer_insert_position`, by default it will insert before the given selector.
96
- */
97
- in_text_disclaimer_enabled?: boolean
98
- in_text_disclaimer_text?: string
99
- in_text_disclaimer_selector?: string
100
- in_text_disclaimer_insert_position?: InsertPosition
101
-
102
- /**
103
- * Open TPI links in explore rather than in modals in the article
104
- */
105
- open_tpi_links_in_explore?: boolean
106
-
107
- /**
108
- * These options are all relevant for the Explore component, which can be inserted as a widget on any page or as a modal.
109
- * `explore_navigation_selector` is used to select the navigation element that should be copied and inserted _after_.
110
- * `explore_navigation_label` will end up being the label of the navigation item, defaults to `Streaming Guide`.
111
- * `explore_navigation_path` is the path that the navigation item will lead to, this will be set up by the third party.
112
- * `explore_navigation_insert_position` is used to determine if the navigation item should be inserted before or after the given selector.
113
- * `explore_insert_cta_in_tpi` is used to insert a call to action in modals which opens the explore page as a modal.
114
- */
115
- explore_navigation_selector?: string
116
- explore_navigation_label?: string
117
- explore_navigation_path?: string
118
- explore_navigation_insert_position?: InsertPosition
119
- explore_insert_cta_in_tpi?: boolean
120
- explore_custom_style?: string
121
- explore_use_router?: boolean
122
- }
1
+ import type { InsertPosition } from './position'
2
+
3
+ export type ConfigResponse = {
4
+ /**
5
+ * Used to exclude URL matching a regex pattern. If a url matches, nothing is executed beyond fetching the config.
6
+ * The url should never be indexed.
7
+ */
8
+ exclude_urls_pattern?: string
9
+
10
+ /**
11
+ * Used to inject custom styling for the links, modal, and popover. All styling is done via CSS variables. The passed
12
+ * string should not contain a selector.
13
+ * For example:
14
+ * `--some-variable: some-value;`
15
+ *
16
+ * rather than:
17
+ * `body { --some-variable: some-value; }`
18
+ */
19
+ custom_style?: string
20
+
21
+ /**
22
+ * The primary selector for the entire article from which text will be selected. Should contain as little content as
23
+ * possible. Should match all pages. May contain multiple selectors like `.article, .listicle`.
24
+ */
25
+ html_selector?: string
26
+
27
+ /**
28
+ * Some pages contain elements that can't easily be excluded via the `html_selector`. These elements can instead be
29
+ * excluded via this property. May contain multiple selectors like `.footer, .ad`.
30
+ */
31
+ exclude_elements_selector?: string
32
+
33
+ /**
34
+ * Disable all injections from showing on pages without editorial mode enabled
35
+ */
36
+ disable_public_injections?: boolean
37
+
38
+ /**
39
+ * Region to fall back on if other methods of getting the region fail. This should be equal to the region most relevant
40
+ * to the partner. Should be lowercase.
41
+ */
42
+ fallback_region?: string
43
+
44
+ /**
45
+ * Disclaimer text that is shown above playlinks in title cards used to replace the default text
46
+ */
47
+ playlinks_disclaimer_text?: string
48
+
49
+ /**
50
+ * Some partners may want to display titles without affiliate links, which currently comes down to no playlinks.
51
+ * This can also be set via the config on the script itself.
52
+ */
53
+ no_affiliate?: boolean
54
+
55
+ /**
56
+ * Whether or not we can insert retargeting pixels. Not all third parties allow this and it is disabled by default
57
+ */
58
+ allow_retargeting_pixels?: boolean
59
+
60
+ /**
61
+ * By default affiliate links (playlinks) will render as links even without consent, as a disclaimer is given. Set to true to require explicit consent, rendering as static text without consent.
62
+ */
63
+ require_affiliate_consent?: boolean
64
+
65
+ /**
66
+ * Scroll reveal posters that show on mobile are enabled by default. Use this option to disable them.
67
+ */
68
+ disable_scroll_reveal_posters?: boolean
69
+
70
+ /**
71
+ * Playlinks are merged by default, when this option is enabled playlinks will instead be shown categorized.
72
+ */
73
+ categorize_playlinks?: boolean
74
+
75
+ /**
76
+ * By default no user identifiable data is tracked. This can be changed using this option. User ids are stored in localStorage and sent along with any tracking request.
77
+ */
78
+ allow_user_id_tracking?: boolean
79
+
80
+ /**
81
+ * The sid for the current domain, used for tracking
82
+ */
83
+ domain_sid?: string
84
+
85
+ /**
86
+ * The sid for the organization the domain belongs to, used for tracking. Can be empty.
87
+ */
88
+ organization_sid?: string
89
+
90
+ /**
91
+ * The following options are all relevant for in text disclaimers, which renders as a disclaimer text within the article,
92
+ * rather than only inside of title cards.
93
+ * Change the text content using `in_text_disclaimer_text`.
94
+ * Change where the element is inserted using `in_text_disclaimer_selector`, by default it will insert before the first text element.
95
+ * Change the insert position using `in_text_disclaimer_insert_position`, by default it will insert before the given selector.
96
+ */
97
+ in_text_disclaimer_enabled?: boolean
98
+ in_text_disclaimer_text?: string
99
+ in_text_disclaimer_selector?: string
100
+ in_text_disclaimer_insert_position?: InsertPosition
101
+
102
+ /**
103
+ * Open TPI links in explore rather than in modals in the article
104
+ */
105
+ open_tpi_links_in_explore?: boolean
106
+
107
+ /**
108
+ * These options are all relevant for the Explore component, which can be inserted as a widget on any page or as a modal.
109
+ * `explore_navigation_selector` is used to select the navigation element that should be copied and inserted _after_.
110
+ * `explore_navigation_label` will end up being the label of the navigation item, defaults to `Streaming Guide`.
111
+ * `explore_navigation_path` is the path that the navigation item will lead to, this will be set up by the third party.
112
+ * `explore_navigation_insert_position` is used to determine if the navigation item should be inserted before or after the given selector.
113
+ * `explore_insert_cta_in_tpi` is used to insert a call to action in modals which opens the explore page as a modal.
114
+ */
115
+ explore_navigation_selector?: string
116
+ explore_navigation_label?: string
117
+ explore_navigation_path?: string
118
+ explore_navigation_insert_position?: InsertPosition
119
+ explore_insert_cta_in_tpi?: boolean
120
+ explore_custom_style?: string
121
+ explore_use_router?: boolean
122
+ }
@@ -6,6 +6,14 @@ export type ParticipantData = {
6
6
  jobs: Job[]
7
7
  image: string | null
8
8
  image_uuid: string | null
9
+ image_metadata?: {
10
+ license_name: string
11
+ license_url: string
12
+ source_text: string
13
+ source_url: string
14
+ author_text: string
15
+ author_url: string
16
+ }
9
17
  gender: string
10
18
  character?: string | null
11
19
  bio?: string | null
@@ -0,0 +1,3 @@
1
+ <svg height="24px" viewBox="0 -960 960 960" width="24px">
2
+ <path fill="currentColor" d="M430-200h100v-180h60v-184q0-27-28.5-41.5T480-620q-53 0-81.5 14.5T370-564v184h60v180Zm-105 88.5q-73-31.5-127.5-86t-86-127.5Q80-398 80-480.5t31.5-155q31.5-72.5 86-127t127.5-86Q398-880 480.5-880t155 31.5q72.5 31.5 127 86t86 127Q880-563 880-480.5T848.5-325q-31.5 73-86 127.5t-127 86Q563-80 480.5-80T325-111.5Zm381.5-142Q800-347 800-480t-93.5-226.5Q613-800 480-800t-226.5 93.5Q160-613 160-480t93.5 226.5Q347-160 480-160t226.5-93.5ZM523-657q17-17 17-43t-17-43q-17-17-43-17t-43 17q-17 17-17 43t17 43q17 17 43 17t43-17Zm-43 177Z"/>
3
+ </svg>
@@ -10,7 +10,7 @@
10
10
  import { trackViaPixel } from '@playpilot/retargeting-tracking'
11
11
  import Popover from './Popover.svelte'
12
12
  import Title from './Title.svelte'
13
- import Participant from './Participant.svelte'
13
+ import Participant from './Participants/Participant.svelte'
14
14
  import TopScroll from './Ads/TopScroll.svelte'
15
15
  import Display from './Ads/Display.svelte'
16
16
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  <script lang="ts">
3
3
  import Modal from './Modal.svelte'
4
- import Participant from '../Participant.svelte'
4
+ import Participant from '../Participants/Participant.svelte'
5
5
  import type { ParticipantData } from '$lib/types/participant'
6
6
  import { TrackingEvent } from '$lib/enums/TrackingEvent'
7
7
  import { track } from '$lib/tracking'
@@ -5,11 +5,12 @@
5
5
  import { openModal } from '$lib/modal'
6
6
  import type { ParticipantData } from '$lib/types/participant'
7
7
  import type { TitleData } from '$lib/types/title'
8
- import ListTitle from './ListTitle.svelte'
9
8
  import { t } from '$lib/localization'
10
9
  import { isRetargetingAllowed } from '$lib/retargeting'
11
10
  import { trackViaPixel } from '@playpilot/retargeting-tracking'
12
11
  import { MetaEvent } from '$lib/enums/TrackingEvent'
12
+ import ParticipantImage from './ParticipantImage.svelte'
13
+ import ListTitle from '../ListTitle.svelte'
13
14
 
14
15
  interface Props {
15
16
  participant: ParticipantData
@@ -54,13 +55,17 @@
54
55
  </script>
55
56
 
56
57
  <div class="header" class:small>
57
- <div class="heading" use:heading={2} id="heading">{name}</div>
58
+ <ParticipantImage {participant} />
58
59
 
59
- {#if birth_date}
60
- <p class="dates">
61
- {t('Born On')} <strong>{formatDate(birth_date)}</strong>{#if death_date}, {t('Died On')} <strong>{formatDate(death_date)}</strong>{/if}
62
- </p>
63
- {/if}
60
+ <div>
61
+ <div class="heading" use:heading={2} id="heading">{name}</div>
62
+
63
+ {#if birth_date}
64
+ <p class="dates">
65
+ {t('Born On')} <strong>{formatDate(birth_date)}</strong>{#if death_date}, {t('Died On')} <strong>{formatDate(death_date)}</strong>{/if}
66
+ </p>
67
+ {/if}
68
+ </div>
64
69
  </div>
65
70
 
66
71
  <div class="content">
@@ -85,13 +90,22 @@
85
90
 
86
91
  <style lang="scss">
87
92
  .header {
88
- padding: margin(4) margin(1) margin(2);
93
+ --participant-image-size: #{margin(6)};
94
+ display: grid;
95
+ grid-template-columns: calc(var(--participant-image-size)) auto;
96
+ align-items: center;
97
+ gap: margin(1);
98
+ padding: margin(3) margin(1) margin(2);
89
99
  font-family: theme(detail-font-family, font-family);
90
100
  font-weight: theme(detail-font-weight, normal);
91
101
  font-size: theme(detail-font-size, font-size-base);
92
102
  line-height: theme(participant-description-line-height, normal);
93
103
  color: theme(detail-text-color, text-color);
94
104
 
105
+ @include desktop {
106
+ --participant-image-size: #{margin(8)};
107
+ }
108
+
95
109
  &.small {
96
110
  padding: margin(1);
97
111
  }
@@ -101,7 +115,7 @@
101
115
  margin: 0;
102
116
  font-family: theme(detail-title-font-family, font-family);
103
117
  font-weight: theme(detail-title-font-weight, lighter);
104
- font-size: theme(detail-title-font-size, margin(1.5));
118
+ font-size: clamp(1.25em, 5vw, 1.5em);
105
119
  line-height: normal;
106
120
  font-style: theme(detail-title-font-style, normal);
107
121
 
@@ -109,6 +123,10 @@
109
123
  margin: 0 0 margin(0.5);
110
124
  font-size: theme(detail-title-small-font-size, margin(1.25));
111
125
  }
126
+
127
+ .small & {
128
+ font-size: 1em;
129
+ }
112
130
  }
113
131
 
114
132
  .dates {
@@ -0,0 +1,130 @@
1
+ <script lang="ts">
2
+ import { t } from '$lib/localization'
3
+ import type { ParticipantData } from '$lib/types/participant'
4
+ import IconAttribution from '../Icons/IconAttribution.svelte'
5
+
6
+ interface Props {
7
+ participant?: ParticipantData | null
8
+ }
9
+
10
+ const { participant = null }: Props = $props()
11
+
12
+ const { image_metadata } = $derived(participant || { image_metadata: null })
13
+
14
+ let showAttribution = $state(false)
15
+
16
+ function toggleAttribution(event: MouseEvent): void {
17
+ event.stopImmediatePropagation()
18
+
19
+ if ((event.target as HTMLElement).nodeName === 'A') return
20
+
21
+ event.preventDefault()
22
+
23
+ showAttribution = !showAttribution
24
+ }
25
+ </script>
26
+
27
+ <div class="image">
28
+ {#if participant?.image}
29
+ <img loading="lazy" src={participant.image} alt="" />
30
+
31
+ {#if image_metadata}
32
+ <button class="attribution-icon" onclick={toggleAttribution}>
33
+ <IconAttribution />
34
+ </button>
35
+ {/if}
36
+ {/if}
37
+
38
+ {#if participant && image_metadata && showAttribution}
39
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
40
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
41
+ <div class="attribution-overlay" onclick={toggleAttribution}>
42
+ <a href={image_metadata.source_url} target="_blank" rel="external nofollow noreferrer">{image_metadata.source_text}</a>
43
+ {t('By')}
44
+ <a href={image_metadata.author_url} target="_blank" rel="external nofollow noreferrer">{image_metadata.author_text}</a>
45
+ /
46
+ <a href={image_metadata.license_url} target="_blank" rel="external nofollow noreferrer">{image_metadata.license_name}</a>
47
+ </div>
48
+ {/if}
49
+ </div>
50
+
51
+ <style lang="scss">
52
+ $item-width: #{var(--participant-image-size, margin(6))};
53
+
54
+ .image {
55
+ position: relative;
56
+ display: block;
57
+ width: $item-width;
58
+ height: $item-width;
59
+ border-radius: theme(border-radius);
60
+ overflow: hidden;
61
+ background: theme(cast-background, lighter);
62
+
63
+ &::before,
64
+ &::after {
65
+ content: '';
66
+ display: block;
67
+ position: absolute;
68
+ width: 50%;
69
+ height: 50%;
70
+ top: 50%;
71
+ left: 50%;
72
+ border-radius: 50%;
73
+ transform: translateX(-50%) translateY(-50%);
74
+ background: currentColor;
75
+ opacity: 0.1;
76
+ }
77
+
78
+ &::after {
79
+ top: 100%;
80
+ width: 75%;
81
+ }
82
+
83
+ img {
84
+ z-index: 1;
85
+ position: relative;
86
+ width: 100%;
87
+ height: auto;
88
+ }
89
+ }
90
+
91
+ .attribution-icon {
92
+ z-index: 2;
93
+ cursor: pointer;
94
+ position: absolute;
95
+ right: 0;
96
+ bottom: 0;
97
+ padding: margin(0.25);
98
+ margin: 0;
99
+ border: 0;
100
+ background: transparent;
101
+ color: rgba(255, 255, 255, 0.75);
102
+
103
+ &:hover {
104
+ color: white;
105
+ }
106
+
107
+ :global(svg) {
108
+ display: block;
109
+ }
110
+ }
111
+
112
+ .attribution-overlay {
113
+ z-index: 1;
114
+ position: absolute;
115
+ top: 0;
116
+ right: 0;
117
+ bottom: 0;
118
+ left: 0;
119
+ padding: margin(0.25);
120
+ background: rgba(0, 0, 0, 0.85);
121
+ font-size: 11px;
122
+ line-height: 1.25;
123
+ white-space: wrap;
124
+ text-align: left;
125
+
126
+ a {
127
+ color: currentColor;
128
+ }
129
+ }
130
+ </style>
@@ -8,6 +8,7 @@
8
8
  import { track } from '$lib/tracking'
9
9
  import type { ParticipantData } from '$lib/types/participant'
10
10
  import type { TitleData } from '$lib/types/title'
11
+ import ParticipantImage from '../Participants/ParticipantImage.svelte'
11
12
  import Rail from './Rail.svelte'
12
13
 
13
14
  interface Props {
@@ -35,8 +36,6 @@
35
36
  participantsByOccurrence[participant.sid] = { participant, count }
36
37
  }
37
38
 
38
- // Sort all participants by their occurrences. If a participant did not occur their positioned will be retained
39
- // relative to where it was before
40
39
  const participantsSortedByCount = Object.values(participantsByOccurrence).sort((a, b) => b.count - a.count)
41
40
 
42
41
  return participantsSortedByCount.map(({ participant }) => participant)
@@ -51,7 +50,10 @@
51
50
  {#await fetchParticipantsForTitle(title)}
52
51
  <Rail {heading}>
53
52
  {#each { length: 5 }}
54
- <div class="participant"></div>
53
+ <div class="participant">
54
+ <ParticipantImage />
55
+ <div class="name">&nbsp;</div>
56
+ </div>
55
57
  {/each}
56
58
  </Rail>
57
59
  {:then participants}
@@ -59,11 +61,9 @@
59
61
  <Rail {heading}>
60
62
  {#each orderParticipantsByPageTextOccurrence(participants).slice(0, 15) as participant}
61
63
  <button class="participant" data-testid="participant" onclick={event => onclick(event, participant)}>
62
- <span class="truncate">{participant.name}</span>
64
+ <ParticipantImage {participant} />
63
65
 
64
- {#if participant.character}
65
- <div class="character truncate">{participant.character}</div>
66
- {/if}
66
+ <div class="name">{participant.name}</div>
67
67
  </button>
68
68
  {/each}
69
69
  </Rail>
@@ -71,22 +71,25 @@
71
71
  {/await}
72
72
 
73
73
  <style lang="scss">
74
+ $item-width: #{theme(rail-size-default, margin(6))};
75
+
74
76
  .participant {
77
+ --participant-image-size: #{$item-width};
75
78
  display: flex;
76
79
  flex-direction: column;
77
- flex: 0 0 10rem;
78
- width: 10rem;
79
- min-height: margin(3.375); // Matches 54 pixels, the height of a card with both name and character
80
- padding: margin(0.5);
81
- border: theme(cast-border, 0);
80
+ flex: 0 0 $item-width;
81
+ gap: margin(0.5);
82
+ width: $item-width;
83
+ padding: 0;
82
84
  border-radius: theme(cast-border-radius, border-radius);
83
- background: theme(cast-background, lighter);
85
+ border: 0;
86
+ background: transparent;
84
87
  cursor: pointer;
85
- font-family: inherit;
86
- text-align: left;
87
88
  color: inherit;
89
+ font-family: inherit;
88
90
  font-size: theme(cast-font-size, font-size-small);
89
91
  line-height: normal;
92
+ text-align: center;
90
93
  white-space: nowrap;
91
94
 
92
95
  &:is(button):hover,
@@ -96,13 +99,10 @@
96
99
  }
97
100
  }
98
101
 
99
- .character {
100
- color: theme(cast-character-text-color, text-color-alt);
101
- font-style: italic;
102
- }
103
-
104
- .truncate {
102
+ .name {
103
+ min-height: 1lh;
105
104
  overflow: hidden;
105
+ color: theme(participant-text-color, text-color-alt) !important;
106
106
  text-overflow: ellipsis;
107
107
  white-space: nowrap;
108
108
  }
@@ -1,7 +1,7 @@
1
1
  import { fireEvent, render, waitFor } from '@testing-library/svelte'
2
2
  import { describe, expect, it, vi, beforeEach } from 'vitest'
3
3
 
4
- import Participant from '../../../routes/components/Participant.svelte'
4
+ import Participant from '../../../../routes/components/Participants/Participant.svelte'
5
5
  import { participants, title } from '$lib/fakeData'
6
6
  import { fetchTitlesForParticipant } from '$lib/api/participants'
7
7
 
@@ -80,4 +80,23 @@ describe('Participant.svelte', () => {
80
80
  expect(queryByText('Credits')).not.toBeTruthy()
81
81
  expect(container.querySelector('.small')).toBeTruthy()
82
82
  })
83
+
84
+ it('Should render image if given', async () => {
85
+ const participantWithImage = { ...participants[0], image: 'some-image.jpg' }
86
+
87
+ const { getByRole } = render(Participant, { participant: participantWithImage })
88
+
89
+ await waitFor(() => {
90
+ expect(getByRole('presentation')).toBeTruthy()
91
+ })
92
+ })
93
+
94
+ it('Should not render image if not given', async () => {
95
+
96
+ const { queryByRole } = render(Participant, { participant: participants[0] })
97
+
98
+ await waitFor(() => {
99
+ expect(queryByRole('presentation')).not.toBeTruthy()
100
+ })
101
+ })
83
102
  })
@@ -36,6 +36,19 @@ describe('ParticipantsRail.svelte', () => {
36
36
  })
37
37
  })
38
38
 
39
+ it('Should render image only for participants with image', async () => {
40
+ const participantsWithImage = [...participants]
41
+ participantsWithImage[0].image = 'some-image.jpg'
42
+
43
+ vi.mocked(fetchParticipantsForTitle).mockResolvedValueOnce(participantsWithImage)
44
+
45
+ const { getAllByRole } = render(ParticipantsRail, { title })
46
+
47
+ await waitFor(() => {
48
+ expect(getAllByRole('presentation')).toHaveLength(1)
49
+ })
50
+ })
51
+
39
52
  it('Should order participants by their number of occurrences on the page', async () => {
40
53
  document.body.innerHTML = `<main>${participants[1].name}. ${participants[2].name}, ${participants[2].name}</main>`
41
54
  vi.mocked(fetchParticipantsForTitle).mockResolvedValueOnce(participants)