@linktr.ee/messaging-react 4.4.7 → 4.4.8-rc-1788251276
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/{AttachmentCard-DSekwIOA.js → AttachmentCard-BaZk77fe.js} +136 -125
- package/dist/AttachmentCard-BaZk77fe.js.map +1 -0
- package/dist/AttachmentCard-ZpYg622K.cjs +2 -0
- package/dist/AttachmentCard-ZpYg622K.cjs.map +1 -0
- package/dist/{Card-BS6Fza2a.cjs → Card-4irOjGaI.cjs} +2 -2
- package/dist/{Card-BS6Fza2a.cjs.map → Card-4irOjGaI.cjs.map} +1 -1
- package/dist/{Card-BhwBkgxI.js → Card-BdyQhysm.js} +2 -2
- package/dist/{Card-BhwBkgxI.js.map → Card-BdyQhysm.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +915 -907
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/AttachmentCard/MediaPlayer.test.tsx +9 -5
- package/src/components/AttachmentCard/MediaPlayer.tsx +3 -5
- package/src/components/AttachmentCard/Thumbnail.test.tsx +4 -0
- package/src/components/ChannelActionsMenu/ChannelActionsMenu.test.tsx +18 -10
- package/src/components/ChannelActionsMenu/index.tsx +13 -4
- package/src/components/ChannelList/ChannelListContext.test.tsx +7 -5
- package/src/components/ChannelList/CustomChannelPreview.test.tsx +7 -5
- package/src/components/ChannelList/index.test.tsx +1 -0
- package/src/components/ChannelView.test.tsx +20 -13
- package/src/components/CustomLinkPreviewList/CustomLinkPreviewList.test.tsx +4 -3
- package/src/components/CustomMessage/CustomMessage.test.tsx +6 -5
- package/src/components/CustomMessage/MessageTag.test.tsx +6 -0
- package/src/components/CustomMessage/SentMessageDeliveryStatus.test.tsx +19 -9
- package/src/components/CustomMessage/StreamAttachmentMessage.test.tsx +12 -5
- package/src/components/CustomMessage/TipMessage/TipMessage.test.tsx +3 -0
- package/src/components/CustomMessageInput/CustomMessageInput.test.tsx +16 -7
- package/src/components/FaqList/FaqList.test.tsx +20 -12
- package/src/components/LinkAttachment/LinkAttachment.test.tsx +27 -14
- package/src/components/LinkAttachment/components/_shared/BubbleTail.test.tsx +1 -0
- package/src/components/LinkAttachment/components/_shared/CardBody.test.tsx +6 -6
- package/src/components/LinkAttachment/components/_shared/CardCta.test.tsx +8 -5
- package/src/components/LinkAttachment/components/_shared/CardShell.test.tsx +7 -5
- package/src/components/LinkAttachment/components/_shared/CardThumbnail.test.tsx +3 -8
- package/src/components/MessageAttachment/MessageAttachment.behavior.test.tsx +22 -15
- package/src/components/MessageAttachment/MessageAttachment.test.tsx +117 -60
- package/src/components/MessageAttachment/_shared/Bubble.test.tsx +2 -0
- package/src/components/MessageAttachment/_shared/CarouselNav.test.tsx +5 -4
- package/src/components/MessageAttachment/_shared/CompactDocumentRow.test.tsx +4 -3
- package/src/components/MessageAttachment/_shared/DismissButton.test.tsx +4 -3
- package/src/components/MessageAttachment/_shared/DownloadAction.test.tsx +8 -5
- package/src/components/MessageAttachment/_shared/DownloadAction.tsx +4 -10
- package/src/components/MessageAttachment/_shared/ImageViewer.test.tsx +6 -3
- package/src/components/MessageAttachment/_shared/MediaStackGrid.test.tsx +11 -4
- package/src/components/MessageAttachment/_shared/PdfViewer.test.tsx +5 -3
- package/src/components/MessageAttachment/_shared/VideoViewer.test.tsx +12 -3
- package/src/components/MessageAttachment/_shared/ViewerShell.test.tsx +13 -6
- package/src/components/MessageAttachment/_shared/useCarousel.test.tsx +10 -4
- package/src/components/MessageBubble/MessageBubble.test.tsx +8 -0
- package/src/components/RichCard/RichCard.test.tsx +10 -2
- package/src/components/_shared/Spinner.test.tsx +75 -0
- package/src/components/_shared/Spinner.tsx +51 -0
- package/dist/AttachmentCard-BbsjzdLJ.cjs +0 -2
- package/dist/AttachmentCard-BbsjzdLJ.cjs.map +0 -1
- package/dist/AttachmentCard-DSekwIOA.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { userEvent, renderWithProviders, screen } from '../../test/utils'
|
|
4
4
|
|
|
5
5
|
import { triggerDownload } from './_shared/triggerDownload'
|
|
6
6
|
import { bubbleVariantForState, bubbleGroupPositionFromStream } from './types'
|
|
@@ -14,7 +14,8 @@ vi.mock('./_shared/triggerDownload', () => ({
|
|
|
14
14
|
const mockedDownload = vi.mocked(triggerDownload)
|
|
15
15
|
|
|
16
16
|
describe('MessageAttachment behavior', () => {
|
|
17
|
-
it('renders file rows with precedence, fallback names, and cancellation', () => {
|
|
17
|
+
it('renders file rows with precedence, fallback names, and cancellation', async () => {
|
|
18
|
+
const user = userEvent.setup()
|
|
18
19
|
const onClick = vi.fn(() => false)
|
|
19
20
|
const { rerender } = renderWithProviders(
|
|
20
21
|
<MessageAttachment.File.Sent
|
|
@@ -32,14 +33,14 @@ describe('MessageAttachment behavior', () => {
|
|
|
32
33
|
)
|
|
33
34
|
expect(screen.getByText('first.pdf')).toBeInTheDocument()
|
|
34
35
|
expect(screen.getByText('second.pdf')).toBeInTheDocument()
|
|
35
|
-
|
|
36
|
+
await user.click(screen.getByRole('button', { name: 'Download first.pdf' }))
|
|
36
37
|
expect(onClick).toHaveBeenCalledWith(0)
|
|
37
38
|
expect(mockedDownload).not.toHaveBeenCalled()
|
|
38
39
|
|
|
39
40
|
rerender(
|
|
40
41
|
<MessageAttachment.File.Sent src="https://cdn.example.com/fallback.txt" />
|
|
41
42
|
)
|
|
42
|
-
|
|
43
|
+
await user.click(
|
|
43
44
|
screen.getByRole('button', { name: 'Download fallback.txt' })
|
|
44
45
|
)
|
|
45
46
|
expect(mockedDownload).toHaveBeenCalledWith(
|
|
@@ -48,10 +49,12 @@ describe('MessageAttachment behavior', () => {
|
|
|
48
49
|
)
|
|
49
50
|
})
|
|
50
51
|
|
|
51
|
-
it('renders no file when inputs are absent and supports composer dismissal', () => {
|
|
52
|
+
it('renders no file when inputs are absent and supports composer dismissal', async () => {
|
|
53
|
+
const user = userEvent.setup()
|
|
52
54
|
const { container } = renderWithProviders(
|
|
53
55
|
<MessageAttachment.File.Received />
|
|
54
56
|
)
|
|
57
|
+
// eslint-disable-next-line testing-library/no-node-access -- the null-rendering DOM contract has no semantic query.
|
|
55
58
|
expect(container.firstChild).toBeNull()
|
|
56
59
|
const onDismiss = vi.fn()
|
|
57
60
|
renderWithProviders(
|
|
@@ -60,11 +63,12 @@ describe('MessageAttachment behavior', () => {
|
|
|
60
63
|
onDismiss={onDismiss}
|
|
61
64
|
/>
|
|
62
65
|
)
|
|
63
|
-
|
|
66
|
+
await user.click(screen.getByRole('button', { name: 'Dismiss attachment' }))
|
|
64
67
|
expect(onDismiss).toHaveBeenCalledOnce()
|
|
65
68
|
})
|
|
66
69
|
|
|
67
|
-
it('renders image stacks, forwards loading, and supports click cancellation', () => {
|
|
70
|
+
it('renders image stacks, forwards loading, and supports click cancellation', async () => {
|
|
71
|
+
const user = userEvent.setup()
|
|
68
72
|
const onClick = vi.fn(() => false)
|
|
69
73
|
renderWithProviders(
|
|
70
74
|
<MessageAttachment.Image.Sent
|
|
@@ -79,12 +83,13 @@ describe('MessageAttachment behavior', () => {
|
|
|
79
83
|
)
|
|
80
84
|
expect(screen.getAllByRole('img')[0]).toHaveAttribute('loading', 'lazy')
|
|
81
85
|
expect(screen.getAllByRole('img')).toHaveLength(2)
|
|
82
|
-
|
|
86
|
+
await user.click(screen.getByRole('button', { name: 'Open image 2 of 2' }))
|
|
83
87
|
expect(onClick).toHaveBeenCalledWith(1)
|
|
84
88
|
expect(screen.queryByTestId('image-viewer')).not.toHaveAttribute('open')
|
|
85
89
|
})
|
|
86
90
|
|
|
87
|
-
it('opens images at the clicked index and suffixes a shared filename', () => {
|
|
91
|
+
it('opens images at the clicked index and suffixes a shared filename', async () => {
|
|
92
|
+
const user = userEvent.setup()
|
|
88
93
|
renderWithProviders(
|
|
89
94
|
<MessageAttachment.Image.Sent
|
|
90
95
|
filename="photos.jpg"
|
|
@@ -94,7 +99,7 @@ describe('MessageAttachment behavior', () => {
|
|
|
94
99
|
]}
|
|
95
100
|
/>
|
|
96
101
|
)
|
|
97
|
-
|
|
102
|
+
await user.click(screen.getByRole('button', { name: 'Open image 2 of 2' }))
|
|
98
103
|
expect(screen.getByTestId('image-viewer')).toHaveAttribute(
|
|
99
104
|
'aria-label',
|
|
100
105
|
'photos.jpg (2)'
|
|
@@ -105,7 +110,8 @@ describe('MessageAttachment behavior', () => {
|
|
|
105
110
|
)
|
|
106
111
|
})
|
|
107
112
|
|
|
108
|
-
it('renders video posters and posterless first-frame previews', () => {
|
|
113
|
+
it('renders video posters and posterless first-frame previews', async () => {
|
|
114
|
+
const user = userEvent.setup()
|
|
109
115
|
const onDismiss = vi.fn()
|
|
110
116
|
const { rerender } = renderWithProviders(
|
|
111
117
|
<MessageAttachment.Video.Composer
|
|
@@ -119,7 +125,7 @@ describe('MessageAttachment behavior', () => {
|
|
|
119
125
|
expect(
|
|
120
126
|
screen.getByRole('img', { name: 'Video 1 thumbnail' })
|
|
121
127
|
).toHaveAttribute('src', '/poster.jpg')
|
|
122
|
-
|
|
128
|
+
await user.click(screen.getByRole('button', { name: 'Dismiss attachment' }))
|
|
123
129
|
expect(onDismiss).toHaveBeenCalledOnce()
|
|
124
130
|
rerender(
|
|
125
131
|
<MessageAttachment.Video.Sent src="https://cdn.example.com/video.mp4" />
|
|
@@ -172,7 +178,8 @@ describe('MessageAttachment behavior', () => {
|
|
|
172
178
|
expect(screen.queryByLabelText('Video 1 thumbnail')).not.toBeInTheDocument()
|
|
173
179
|
})
|
|
174
180
|
|
|
175
|
-
it('supports PDF titles, download actions, dismiss, and viewer index', () => {
|
|
181
|
+
it('supports PDF titles, download actions, dismiss, and viewer index', async () => {
|
|
182
|
+
const user = userEvent.setup()
|
|
176
183
|
const onDismiss = vi.fn()
|
|
177
184
|
renderWithProviders(
|
|
178
185
|
<MessageAttachment.Pdf.Composer
|
|
@@ -182,7 +189,7 @@ describe('MessageAttachment behavior', () => {
|
|
|
182
189
|
/>
|
|
183
190
|
)
|
|
184
191
|
expect(screen.getByText('Quarterly report')).toBeInTheDocument()
|
|
185
|
-
|
|
192
|
+
await user.click(screen.getByRole('button', { name: 'Dismiss attachment' }))
|
|
186
193
|
expect(onDismiss).toHaveBeenCalledOnce()
|
|
187
194
|
|
|
188
195
|
renderWithProviders(
|
|
@@ -193,7 +200,7 @@ describe('MessageAttachment behavior', () => {
|
|
|
193
200
|
]}
|
|
194
201
|
/>
|
|
195
202
|
)
|
|
196
|
-
|
|
203
|
+
await user.click(screen.getByRole('button', { name: 'Open two.pdf' }))
|
|
197
204
|
expect(screen.getAllByTestId('pdf-viewer').at(-1)).toHaveAttribute(
|
|
198
205
|
'aria-label',
|
|
199
206
|
'two.pdf'
|