@playpilot/tpi 8.37.2 → 8.38.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 +6 -6
- package/dist/link-injections.js +2 -2
- package/dist/mount.css +1 -1
- package/dist/mount.js +4 -4
- package/package.json +1 -1
- package/src/lib/injectionElements.ts +1 -1
- package/src/routes/components/Participants/Participant.svelte +8 -2
- package/src/routes/components/Participants/ParticipantImage.svelte +1 -1
- package/src/tests/lib/injectionElements.test.js +4 -2
- package/src/tests/routes/components/Editorial/ManualInjection.test.js +2 -2
- package/src/tests/routes/components/Participants/Participant.test.js +6 -5
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ export function getLinkInjectionElements(parentElement: HTMLElement, excludeElem
|
|
|
17
17
|
if (validElements.includes(element)) continue
|
|
18
18
|
if (excludeElementsSelector && element.matches(excludeElementsSelector)) continue
|
|
19
19
|
|
|
20
|
-
if (/^(A|BUTTON|SCRIPT|NOSCRIPT|STYLE|IFRAME|FIGCAPTION|TIME|LABEL|BLOCKQUOTE|H1)$/.test(element.tagName)) continue
|
|
20
|
+
if (/^(A|BUTTON|SCRIPT|NOSCRIPT|STYLE|IFRAME|FIGCAPTION|TIME|LABEL|BLOCKQUOTE|H1|H2|H3|H4|H5)$/.test(element.tagName)) continue
|
|
21
21
|
|
|
22
22
|
// Ignore elements that are visibly hidden as they are likely only for screen readers.
|
|
23
23
|
// These elements can be hidden via display: none or via a tiny width or perhaps even a clip path.
|
|
@@ -49,10 +49,12 @@
|
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<div class="header" class:small>
|
|
52
|
-
|
|
52
|
+
{#if participant.image}
|
|
53
|
+
<ParticipantImage {participant} />
|
|
54
|
+
{/if}
|
|
53
55
|
|
|
54
56
|
<div>
|
|
55
|
-
<div class="heading" use:heading={2} id="heading">{name}</div>
|
|
57
|
+
<div class="heading" class:no-image={!participant.image} use:heading={2} id="heading">{name}</div>
|
|
56
58
|
|
|
57
59
|
{#if description}
|
|
58
60
|
<p class="description" class:expanded={descriptionExpanded}>
|
|
@@ -126,6 +128,10 @@
|
|
|
126
128
|
font-size: theme(detail-title-small-font-size, margin(1.25));
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
&.no-image {
|
|
132
|
+
margin-top: margin(0.5);
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
.small & {
|
|
130
136
|
font-size: 1.25em;
|
|
131
137
|
}
|
|
@@ -79,9 +79,11 @@ describe('injectionElements.ts', () => {
|
|
|
79
79
|
expect(getLinkInjectionElements(parent)[1].tagName).toBe('OL')
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
it('Should ignore links, buttons, script tags, style tags, iframes,
|
|
82
|
+
it('Should ignore links, buttons, script tags, style tags, iframes, headings, and more', () => {
|
|
83
83
|
document.body.innerHTML = `<section>
|
|
84
84
|
<h1>Some header</h1>
|
|
85
|
+
<h2>Some header</h2>
|
|
86
|
+
<h3>Some header</h3>
|
|
85
87
|
|
|
86
88
|
<a>I am a link</a>
|
|
87
89
|
<button>And I am a button</button>
|
|
@@ -97,7 +99,7 @@ describe('injectionElements.ts', () => {
|
|
|
97
99
|
|
|
98
100
|
<div>
|
|
99
101
|
<a>I am another link</a>
|
|
100
|
-
<
|
|
102
|
+
<span>Some smaller header</span>
|
|
101
103
|
<p>And finally, some text</p>
|
|
102
104
|
</div>
|
|
103
105
|
</section>`
|
|
@@ -152,9 +152,9 @@ describe('ManualInjection.svelte', () => {
|
|
|
152
152
|
vi.mocked(searchTitles).mockResolvedValueOnce([title])
|
|
153
153
|
vi.mocked(getIndexOfSelection).mockReturnValueOnce({ start: 0, end: 0 })
|
|
154
154
|
|
|
155
|
-
document.body.innerHTML = '<main><
|
|
155
|
+
document.body.innerHTML = '<main><span>Some title</span> <p>Some paragraph</p></main>'
|
|
156
156
|
|
|
157
|
-
const container = document.querySelector('
|
|
157
|
+
const container = document.querySelector('span')
|
|
158
158
|
|
|
159
159
|
// @ts-ignore
|
|
160
160
|
window.getSelection = vi.fn(() => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fireEvent, render, waitFor } from '@testing-library/svelte'
|
|
1
|
+
import { fireEvent, getByTestId, render, waitFor } from '@testing-library/svelte'
|
|
2
2
|
import { describe, expect, it, vi, beforeEach } from 'vitest'
|
|
3
3
|
|
|
4
4
|
import Participant from '../../../../routes/components/Participants/Participant.svelte'
|
|
@@ -124,18 +124,19 @@ describe('Participant.svelte', () => {
|
|
|
124
124
|
it('Should render image if given', async () => {
|
|
125
125
|
const participantWithImage = { ...participants[0], image: 'some-image.jpg' }
|
|
126
126
|
|
|
127
|
-
const {
|
|
127
|
+
const { getByTestId } = render(Participant, { participant: participantWithImage })
|
|
128
128
|
|
|
129
129
|
await waitFor(() => {
|
|
130
|
-
expect(
|
|
130
|
+
expect(getByTestId('participant-image')).toBeTruthy()
|
|
131
131
|
})
|
|
132
132
|
})
|
|
133
133
|
|
|
134
134
|
it('Should not render image if not given', async () => {
|
|
135
|
-
const {
|
|
135
|
+
const { queryByTestId } = render(Participant, { participant: participants[0] })
|
|
136
136
|
|
|
137
137
|
await waitFor(() => {
|
|
138
|
-
expect(
|
|
138
|
+
expect(queryByTestId('participant-image')).not.toBeTruthy()
|
|
139
|
+
expect(queryByTestId('participant-image')).not.toBeTruthy()
|
|
139
140
|
})
|
|
140
141
|
})
|
|
141
142
|
|