@playpilot/tpi 8.21.8-beta.1 → 8.21.8
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
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import Rail from './Rail.svelte'
|
|
6
6
|
import type { TitleData } from '$lib/types/title'
|
|
7
7
|
import { openModal } from '$lib/modal'
|
|
8
|
-
import { exploreTitleUrl
|
|
8
|
+
import { exploreTitleUrl } from '$lib/routes'
|
|
9
9
|
import { generateRandomHash } from '$lib/hash'
|
|
10
10
|
import { getFirstTitleWithAvailableTrailer } from '$lib/trailer'
|
|
11
11
|
import { useExploreRouter } from '$lib/explore'
|
|
@@ -174,14 +174,15 @@
|
|
|
174
174
|
onresize={() => slider?.reposition()}>
|
|
175
175
|
{#each titles as title, index}
|
|
176
176
|
{@const expanded = isExpanded(title)}
|
|
177
|
-
{@const href = navigateToExplore ? exploreTitleUrl(title) : titleUrl(title)}
|
|
178
177
|
{@const onclick = (event: MouseEvent): void => openTitle(event, titles, index)}
|
|
179
178
|
|
|
180
179
|
<div class="title" class:expanded data-testid="title">
|
|
181
180
|
<div class="media">
|
|
182
181
|
{#if expanded}
|
|
183
182
|
<div class="video" out:fade={{ delay: 200, duration: 200 }}>
|
|
184
|
-
|
|
183
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
184
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
185
|
+
<div class="video-overlay" title="" {onclick}></div>
|
|
185
186
|
|
|
186
187
|
{#if !!title.embeddable_url}
|
|
187
188
|
<YouTubeEmbed bind:this={embed} embeddable_url={title.embeddable_url!} muted loop captions showMuteControls />
|
|
@@ -190,15 +191,19 @@
|
|
|
190
191
|
{/if}
|
|
191
192
|
</div>
|
|
192
193
|
{:else}
|
|
193
|
-
|
|
194
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
195
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
196
|
+
<div class="poster" {onclick}>
|
|
194
197
|
<TitlePoster {title} width={96} height={144} />
|
|
195
|
-
</
|
|
198
|
+
</div>
|
|
196
199
|
{/if}
|
|
197
200
|
</div>
|
|
198
201
|
|
|
199
|
-
|
|
202
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
203
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
204
|
+
<span class="heading" {onclick} data-testid="heading">
|
|
200
205
|
{title.title}
|
|
201
|
-
</
|
|
206
|
+
</span>
|
|
202
207
|
|
|
203
208
|
{#if aside}
|
|
204
209
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
@@ -36,16 +36,15 @@ describe('TitlesRail.svelte', () => {
|
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
it('Should render all titles', async () => {
|
|
39
|
-
const { getAllByTestId
|
|
39
|
+
const { getAllByTestId } = render(TitlesRail, { titles: [title, title] })
|
|
40
40
|
|
|
41
41
|
expect(getAllByTestId('title')).toHaveLength(2)
|
|
42
|
-
expect(getAllByRole('link')[0].getAttribute('href')).toBe(`https://www.playpilot.com/series/${title.slug}/`)
|
|
43
42
|
})
|
|
44
43
|
|
|
45
44
|
it('Should fire openModal when title is clicked', async () => {
|
|
46
|
-
const {
|
|
45
|
+
const { getByText } = render(TitlesRail, { titles: [title] })
|
|
47
46
|
|
|
48
|
-
await fireEvent.click(
|
|
47
|
+
await fireEvent.click(getByText(title.title))
|
|
49
48
|
|
|
50
49
|
expect(openModal).toHaveBeenCalledWith({
|
|
51
50
|
type: 'titles-rail',
|
|
@@ -57,9 +56,9 @@ describe('TitlesRail.svelte', () => {
|
|
|
57
56
|
|
|
58
57
|
it('Should fire given onclick function when title is clicked', async () => {
|
|
59
58
|
const onclick = vi.fn()
|
|
60
|
-
const {
|
|
59
|
+
const { getByText } = render(TitlesRail, { titles: [title], onclick })
|
|
61
60
|
|
|
62
|
-
await fireEvent.click(
|
|
61
|
+
await fireEvent.click(getByText(title.title))
|
|
63
62
|
|
|
64
63
|
expect(onclick).toHaveBeenCalledWith(title)
|
|
65
64
|
})
|
|
@@ -215,11 +214,10 @@ describe('TitlesRail.svelte', () => {
|
|
|
215
214
|
})
|
|
216
215
|
|
|
217
216
|
it('Should navigate to explore page rather than open modal when navigateToExplore is true', async () => {
|
|
218
|
-
const {
|
|
217
|
+
const { getByText } = render(TitlesRail, { titles: [title], navigateToExplore: true })
|
|
219
218
|
|
|
220
|
-
await fireEvent.click(
|
|
219
|
+
await fireEvent.click(getByText(title.title))
|
|
221
220
|
|
|
222
|
-
expect(getAllByRole('link')[0].getAttribute('href')).toContain(`?route=modal&sid=${title.sid}`)
|
|
223
221
|
expect(window.location.href).toContain(`?route=modal&sid=${title.sid}`)
|
|
224
222
|
expect(openModal).not.toHaveBeenCalledWith()
|
|
225
223
|
})
|