@@ -102,7 +102,7 @@ export const AddressCard = ({
102
102
103
103
const { handles } = metadata ;
104
104
105
- const adaHandleIcon = < AdaHandleIcon width = { ICON_SIZE } height = { ICON_SIZE } /> ;
105
+ const adaHandleIcon = < AdaHandleIcon width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-ada-handle-icon" /> ;
106
106
107
107
if ( handles . length === 1 ) {
108
108
return (
@@ -112,14 +112,15 @@ export const AddressCard = ({
112
112
action = "copy"
113
113
tooltipLabel = { t ( 'core.addressCard.handle.copy.tooltip' ) }
114
114
onCopy = { doToast }
115
+ testId = "address-ada-handle"
115
116
/>
116
117
) ;
117
118
}
118
119
119
120
const items : MenuProps [ 'items' ] = handles . map ( ( item , idx ) => ( {
120
121
label : (
121
122
< Flex gap = "$8" alignItems = "center" justifyContent = "space-between" >
122
- < span > { item } </ span >
123
+ < span data-testid = "adress-ada-handle-dropdown-item" > { item } </ span >
123
124
< Tooltip title = { t ( 'core.addressCard.handle.copy.tooltip' ) } >
124
125
< CopyToClipboard text = { item } >
125
126
< CopyIcon
@@ -137,7 +138,7 @@ export const AddressCard = ({
137
138
icon : adaHandleIcon
138
139
} ) ) ;
139
140
140
- return < AddressDisplayItem label = { items . length } icon = { adaHandleIcon } items = { items } /> ;
141
+ return < AddressDisplayItem label = { items . length } icon = { adaHandleIcon } items = { items } testId = "address-ada-handle" /> ;
141
142
} , [ metadata , doToast , t ] ) ;
142
143
143
144
const renderBalanceData = useMemo ( ( ) => {
@@ -146,7 +147,11 @@ export const AddressCard = ({
146
147
}
147
148
148
149
return (
149
- < AddressDisplayItem label = { metadata . balance } icon = { < AdaSymbolIcon width = { ICON_SIZE } height = { ICON_SIZE } /> } />
150
+ < AddressDisplayItem
151
+ label = { metadata . balance }
152
+ icon = { < AdaSymbolIcon width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-ada-icon" /> }
153
+ testId = "address-ada"
154
+ />
150
155
) ;
151
156
} , [ metadata ] ) ;
152
157
@@ -155,12 +160,12 @@ export const AddressCard = ({
155
160
{
156
161
label : `${ metadata . tokens . amount } ${ t ( 'core.addressCard.tokens.label' ) } ` ,
157
162
key : 'tokens' ,
158
- icon : < TokensIcon width = { ICON_SIZE } height = { ICON_SIZE } />
163
+ icon : < TokensIcon width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-tokens-icon" />
159
164
} ,
160
165
{
161
166
label : `${ metadata . tokens . nfts || 0 } ${ t ( 'core.addressCard.nfts.label' ) } ` ,
162
167
key : 'nfts' ,
163
- icon : < NftsIcon width = { ICON_SIZE } height = { ICON_SIZE } />
168
+ icon : < NftsIcon width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-nfts-icon" />
164
169
}
165
170
] ,
166
171
[ metadata , t ]
@@ -174,8 +179,10 @@ export const AddressCard = ({
174
179
const items : MenuProps [ 'items' ] = getTokenMenuItems ( ) ;
175
180
176
181
const customDropdownRender = ( menu : React . ReactElement ) => (
177
- < Box className = { styles . customRender } >
178
- < Box py = "$4" > { t ( 'core.addressCard.nativeTokens.label' ) } </ Box >
182
+ < Box className = { styles . customRender } testId = "address-tokens-dropdown" >
183
+ < Box py = "$4" testId = "address-tokens-dropdown-label" >
184
+ { t ( 'core.addressCard.nativeTokens.label' ) }
185
+ </ Box >
179
186
< Divider h = "$1" className = { styles . divider } />
180
187
{ React . cloneElement ( menu ) }
181
188
</ Box >
@@ -185,8 +192,9 @@ export const AddressCard = ({
185
192
< AddressDisplayItem
186
193
label = { items . length }
187
194
items = { items }
188
- icon = { < AssetsIcon width = { ICON_SIZE } height = { ICON_SIZE } /> }
195
+ icon = { < AssetsIcon width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-tokens-icon" /> }
189
196
dropdownRender = { customDropdownRender }
197
+ testId = "address-tokens"
190
198
/>
191
199
) ;
192
200
} , [ metadata , isMetadataGrouped , getTokenMenuItems , t ] ) ;
@@ -207,7 +215,7 @@ export const AddressCard = ({
207
215
return {
208
216
label : metadata . stakePool ,
209
217
key : 'stake-pool' ,
210
- icon : < StakePoolIcon width = { ICON_SIZE } height = { ICON_SIZE } />
218
+ icon : < StakePoolIcon width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-stake-pool-icon" />
211
219
} ;
212
220
}
213
221
} ) ;
@@ -216,7 +224,10 @@ export const AddressCard = ({
216
224
< AddressDisplayItem
217
225
label = { t ( 'core.addressCard.more.label' ) }
218
226
items = { items }
219
- icon = { < MoreIcon className = { styles . moreIcon } width = { ICON_SIZE } height = { ICON_SIZE } /> }
227
+ icon = {
228
+ < MoreIcon className = { styles . moreIcon } width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-more-icon" />
229
+ }
230
+ testId = "address-more"
220
231
/>
221
232
) ;
222
233
} , [ metadata , getTokenMenuItems , t ] ) ;
@@ -226,14 +237,14 @@ export const AddressCard = ({
226
237
< div className = { styles . qrCodeContainer } data-testid = "address-card-qr-code-container" >
227
238
< QRCode data = { address } options = { useMemo ( ( ) => getQRCodeOptions ?.( ) , [ getQRCodeOptions ] ) } />
228
239
</ div >
229
- < Flex className = { styles . infoContainer } flexDirection = "column" gap = "$8" >
240
+ < Flex className = { styles . infoContainer } flexDirection = "column" gap = "$8" testId = "address-card-details" >
230
241
< Flex justifyContent = "space-between" alignItems = "center" w = "$fill" >
231
242
{ ! name && tagWith && (
232
- < Flex alignItems = "center" className = { styles . tag } >
243
+ < Flex alignItems = "center" className = { styles . tag } testId = "address-card-title" >
233
244
{ tagWith . label }
234
245
{ tagWith . tooltip && (
235
246
< Tooltip title = { tagWith . tooltip } >
236
- < InfoCircleOutlined />
247
+ < InfoCircleOutlined data-testid = "address-card-title-info-icon" />
237
248
</ Tooltip >
238
249
) }
239
250
</ Flex >
@@ -258,11 +269,12 @@ export const AddressCard = ({
258
269
< p className = { styles . address } data-testid = "address-card-address" >
259
270
{ isPopupView ? addEllipsis ( address , ADDRESS_HEAD_ELLIPSIS_LENGTH , ADDRESS_TAIL_ELLIPSIS_LENGTH ) : address }
260
271
</ p >
261
- < Flex style = { { flexWrap : 'wrap' } } >
272
+ < Flex style = { { flexWrap : 'wrap' } } testId = "address-card-assets" >
262
273
{ isUnused && (
263
274
< AddressDisplayItem
264
275
label = { t ( 'core.addressCard.unused.label' ) }
265
- icon = { < CheckIcon width = { ICON_SIZE } height = { ICON_SIZE } /> }
276
+ icon = { < CheckIcon width = { ICON_SIZE } height = { ICON_SIZE } data-testid = "address-card-unused-address-icon" /> }
277
+ testId = "address-card-unused-address"
266
278
/>
267
279
) }
268
280
{ metadata ?. handles ?. length > 0 && renderHandleData }
@@ -272,6 +284,7 @@ export const AddressCard = ({
272
284
< AddressDisplayItem
273
285
label = { metadata . stakePool }
274
286
icon = { < StakePoolIcon width = { ICON_SIZE } height = { ICON_SIZE } /> }
287
+ testId = "address-stake-pool"
275
288
/>
276
289
) }
277
290
{ isMetadataGrouped && renderAdditionalData }
0 commit comments