@@ -28,6 +28,7 @@ import { Popover, PopoverContent, PopoverTrigger } from './ui/popover';
2828import { Tabs , TabsContent , TabsList , TabsTrigger } from './ui/tabs' ;
2929import { Textarea } from './ui/textarea' ;
3030import { Tooltip , TooltipContent , TooltipTrigger } from './ui/tooltip' ;
31+ import { DataTests } from '../lib/data-tests' ;
3132
3233const MAX_TRANSACTION_SIZE = 1048576 ; // 1MB
3334
@@ -99,10 +100,15 @@ export function TransactionDecoder<T>({
99100 < div className = "relative flex flex-col gap-4 items-center justify-center px-4 w-full" >
100101 < div className = "flex flex-col items-center gap-y-8 py-8 w-full" >
101102 < div className = "gap-4 text-foreground flex flex-col items-center justify-center text-center" >
102- < h1 className = "text-xl sm:text-2xl md:text-3xl lg:text-4xl font-semibold leading-tight tracking-tight" >
103+ < h1
104+ data-test = { DataTests . transaction_decoder_title }
105+ className = "text-xl sm:text-2xl md:text-3xl lg:text-4xl font-semibold leading-tight tracking-tight"
106+ >
103107 { title }
104108 </ h1 >
105- < p className = "text-muted-foreground" > { subtitle } </ p >
109+ < p data-test = { DataTests . transaction_decoder_subtitle } className = "text-muted-foreground" >
110+ { subtitle }
111+ </ p >
106112 </ div >
107113 < div className = "flex flex-col gap-4 max-w-5xl w-full mx-auto" >
108114 < Card >
@@ -113,7 +119,7 @@ export function TransactionDecoder<T>({
113119 </ span >
114120 < div className = "flex items-center gap-2" >
115121 < Dialog >
116- < DialogTrigger asChild >
122+ < DialogTrigger data-test = { DataTests . transaction_decoder_info_trigger } asChild >
117123 < Button size = "icon" variant = "outline" >
118124 < InfoIcon />
119125 </ Button >
@@ -237,6 +243,7 @@ export function TransactionDecoder<T>({
237243 ( rawTxInvalid || rawTxTooLarge ) && 'border-destructive focus-visible:ring-destructive' ,
238244 ) }
239245 aria-invalid = { rawTxInvalid || rawTxTooLarge }
246+ data-test = { DataTests . transaction_decoder_textarea }
240247 placeholder = { placeholder }
241248 id = { textareaId }
242249 value = { rawTransaction }
@@ -280,6 +287,7 @@ export function TransactionDecoder<T>({
280287 < span className = "text-xl font-semibold" > Output</ span >
281288 < div className = "flex items-center justify-between gap-2 overflow-hidden" >
282289 < div
290+ data-test = { DataTests . transaction_decoder_transaction_hash }
283291 className = { cn (
284292 'flex items-center gap-2 bg-transparent dark:bg-input/30 rounded-md p-2 text-sm border border-input min-w-0' ,
285293 hash ? 'text-foreground' : 'text-muted-foreground' ,
@@ -365,13 +373,21 @@ export function TransactionDecoderTabs<T>({
365373 </ TabsList >
366374 { decodedTransaction ? (
367375 < >
368- < TabsContent className = "space-y-6 overflow-y-auto" value = "summary" >
376+ < TabsContent
377+ data-test = { DataTests . transaction_decoder_tab_content }
378+ className = "space-y-6 overflow-y-auto"
379+ value = "summary"
380+ >
369381 < div className = "space-y-3" >
370382 { decodedTransaction && renderSummary && renderSummary ( decodedTransaction ) }
371383 </ div >
372384 </ TabsContent >
373385
374- < TabsContent value = "json" className = "max-h-96 overflow-y-auto border-border border rounded-md p-2 relative" >
386+ < TabsContent
387+ data-test = { DataTests . transaction_decoder_tab_content }
388+ value = "json"
389+ className = "max-h-96 overflow-y-auto border-border border rounded-md p-2 relative"
390+ >
375391 < div className = "flex items-center sticky right-0 top-0 justify-end gap-2 z-10" >
376392 < CopyButtonIcon
377393 variant = "outline"
@@ -401,7 +417,7 @@ export function TransactionDecoderTabs<T>({
401417 </ TabsContent >
402418 </ >
403419 ) : (
404- < TransactionDecoderEmptyState />
420+ < TransactionDecoderEmptyState data-test = { DataTests . transaction_decoder_empty_state } />
405421 ) }
406422 </ Tabs >
407423 </ div >
0 commit comments