@playpilot/tpi 3.8.2 → 3.10.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.
@@ -22,6 +22,7 @@ describe('Playlinks.svelte', () => {
22
22
  { name: 'Some playlink', logo_url: 'logo', extra_info: { category: 'SVOD' } },
23
23
  { name: 'Some other playlink', logo_url: 'logo', extra_info: { category: 'SVOD' } },
24
24
  ]
25
+ // @ts-ignore
25
26
  const { getByText } = render(Playlinks, { playlinks, title })
26
27
 
27
28
  expect(getByText('Some playlink')).toBeTruthy()
@@ -29,7 +30,7 @@ describe('Playlinks.svelte', () => {
29
30
  })
30
31
 
31
32
  it('Should show empty state when no playlinks were given', () => {
32
- /** @type {PlaylinkData[]} */
33
+ /** @type {import('$lib/types/playlink').PlaylinkData[]} */
33
34
  const playlinks = []
34
35
  const { container } = render(Playlinks, { playlinks, title })
35
36
 
@@ -43,6 +44,7 @@ describe('Playlinks.svelte', () => {
43
44
  { name: 'Some rent playlink', logo_url: 'logo', extra_info: { category: 'RENT' } },
44
45
  { name: 'Some other playlink', logo_url: 'logo', extra_info: { category: 'other' } },
45
46
  ]
47
+ // @ts-ignore
46
48
  const { getByText, getAllByText } = render(Playlinks, { playlinks, title })
47
49
 
48
50
  expect(getAllByText('Stream')).toHaveLength(2)
@@ -55,6 +57,7 @@ describe('Playlinks.svelte', () => {
55
57
  { name: 'Some playlink', logo_url: 'logo', extra_info: { category: 'SVOD' } },
56
58
  { name: 'Some other playlink', logo_url: 'logo', extra_info: { category: 'SVOD' } },
57
59
  ]
60
+ // @ts-ignore
58
61
  const { getByText } = render(Playlinks, { playlinks, title })
59
62
 
60
63
  await fireEvent.click(getByText(playlinks[0].name))
@@ -68,6 +71,7 @@ describe('Playlinks.svelte', () => {
68
71
  const playlinks = [
69
72
  { name: 'Some playlink', logo_url: 'logo', extra_info: { category: 'SVOD' } },
70
73
  ]
74
+ // @ts-ignore
71
75
  const { getByText } = render(Playlinks, { playlinks, title })
72
76
 
73
77
  await fireEvent.click(getByText(playlinks[0].name))
@@ -82,20 +86,36 @@ describe('Playlinks.svelte', () => {
82
86
  { name: 'Some playlink', logo_url: '', extra_info: { category: 'RENT' } },
83
87
  { name: 'Some playlink', logo_url: null, extra_info: { category: 'other' } },
84
88
  ]
89
+ // @ts-ignore
85
90
  const { getAllByText } = render(Playlinks, { playlinks, title })
86
91
 
87
92
  expect(getAllByText('Some playlink')).toHaveLength(1)
88
93
  })
89
94
 
90
- it('Should not have list class by default', async () => {
95
+ it('Should not have list class by default', () => {
91
96
  const { container } = render(Playlinks, { playlinks: [], title })
92
97
 
93
98
  expect(container.querySelector('.list')).not.toBeTruthy()
94
99
  })
95
100
 
96
- it('Should have list class when prop is given', async () => {
101
+ it('Should have list class when prop is given', () => {
97
102
  const { container } = render(Playlinks, { playlinks: [], title, list: true })
98
103
 
99
104
  expect(container.querySelector('.list')).toBeTruthy()
100
105
  })
106
+
107
+ it('Should highlight and replace category text for playlinks that have highlighted as true', () => {
108
+ const playlinks = [
109
+ { name: 'Some playlink', logo_url: 'logo', extra_info: { category: 'SVOD' } },
110
+ { name: 'Some other playlink', logo_url: 'logo', highlighted: true, cta_text: '', extra_info: { category: 'BUY' } },
111
+ { name: 'Some highlighted playlink', logo_url: 'logo', highlighted: true, cta_text: 'Some CTA', extra_info: { category: 'BUY' } },
112
+ ]
113
+ // @ts-ignore
114
+ const { getByText } = render(Playlinks, { playlinks, title })
115
+
116
+ expect(getByText('Some playlink').closest('.playlink')?.classList).not.toContain('highlighted')
117
+ expect(getByText('Some other playlink').closest('.playlink')?.classList).not.toContain('highlighted')
118
+ expect(getByText('Some highlighted playlink').closest('.playlink')?.classList).toContain('highlighted')
119
+ expect(getByText('Some CTA')).toBeTruthy()
120
+ })
101
121
  })