@@ -115,18 +115,26 @@ export const CapturedEventsList = () => {
115
115
const renderIndividualView = useCallback (
116
116
( ) => (
117
117
< >
118
- < div className = "control-panel" >
119
- < button className = "icon-button" onClick = { prevItem } >
118
+ < div className = "control-panel" data-testid = "individual-view" >
119
+ < button
120
+ className = "icon-button"
121
+ onClick = { prevItem }
122
+ data-testid = "prev-button"
123
+ >
120
124
< ChevronLeft size = { 16 } />
121
125
</ button >
122
126
{ events . length > 0 ? (
123
- < span >
127
+ < span data-testid = "event-counter" >
124
128
Item { selectedIndex + 1 } of { events . length }
125
129
</ span >
126
130
) : (
127
- < span > No events yet</ span >
131
+ < span data-testid = "no-events" > No events yet</ span >
128
132
) }
129
- < button className = "icon-button" onClick = { nextItem } >
133
+ < button
134
+ className = "icon-button"
135
+ onClick = { nextItem }
136
+ data-testid = "next-button"
137
+ >
130
138
< ChevronRight size = { 16 } />
131
139
</ button >
132
140
</ div >
@@ -143,7 +151,7 @@ export const CapturedEventsList = () => {
143
151
new Set ( events . flatMap ( ( obj ) => Object . keys ( obj ) ) ) ,
144
152
)
145
153
return (
146
- < table className = "table" >
154
+ < table className = "table" data-testid = "table-view" >
147
155
< thead >
148
156
< tr >
149
157
{ allKeys . map ( ( key ) => (
@@ -170,41 +178,67 @@ export const CapturedEventsList = () => {
170
178
171
179
return (
172
180
< >
173
- < button className = "toggle-button" onClick = { toggleWindow } >
181
+ < button
182
+ data-testid = "toggle-button"
183
+ className = "toggle-button"
184
+ onClick = { toggleWindow }
185
+ >
174
186
{ isOpen ? < X size = { 24 } /> : < Icon /> }
175
187
</ button >
176
188
177
189
{ isOpen && (
178
190
< div
191
+ data-testid = "debug-window"
179
192
className = "debug-window"
180
193
style = { {
181
194
bottom : `calc(20px + ${ position . y } px)` ,
182
195
right : `calc(16px - ${ position . x } px)` ,
183
196
cursor : isDragging ? 'grabbing' : 'auto' ,
184
197
} }
185
198
>
186
- < div className = "debug-header" ref = { dragRef } onMouseDown = { onMouseDown } >
199
+ < div
200
+ className = "debug-header"
201
+ ref = { dragRef }
202
+ onMouseDown = { onMouseDown }
203
+ data-testid = "debug-header"
204
+ >
187
205
< span className = "header-title" > React Capture Events</ span >
188
206
< div className = "header-actions" >
189
- < button className = "icon-button" onClick = { clearAllEvents } >
207
+ < button
208
+ className = "icon-button"
209
+ onClick = { clearAllEvents }
210
+ data-testid = "clear-button"
211
+ >
190
212
< Trash size = { 16 } />
191
213
</ button >
192
- < button className = "icon-button" onClick = { refresh } >
214
+ < button
215
+ className = "icon-button"
216
+ onClick = { refresh }
217
+ data-testid = "refresh-button"
218
+ >
193
219
< RefreshCcw size = { 16 } />
194
220
</ button >
195
- < button className = "icon-button" onClick = { toggleViewType } >
221
+ < button
222
+ className = "icon-button"
223
+ onClick = { toggleViewType }
224
+ data-testid = "toggle-view-button"
225
+ >
196
226
{ viewType === 'individual' ? (
197
227
< TableIcon size = { 16 } />
198
228
) : (
199
229
< List size = { 16 } />
200
230
) }
201
231
</ button >
202
- < button className = "icon-button" onClick = { toggleWindow } >
232
+ < button
233
+ className = "icon-button"
234
+ onClick = { toggleWindow }
235
+ data-testid = "close-button"
236
+ >
203
237
< X size = { 16 } />
204
238
</ button >
205
239
</ div >
206
240
</ div >
207
- < div className = "debug-content" >
241
+ < div className = "debug-content" data-testid = "debug-content" >
208
242
{ viewType === 'individual'
209
243
? renderIndividualView ( )
210
244
: renderTableView ( ) }
0 commit comments