Skip to content

Commit

Permalink
Merge branch 'staging' into support-multi-currency-format
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlei authored Jun 27, 2023
2 parents 2ac6946 + 99f00d1 commit 17583b9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
6 changes: 5 additions & 1 deletion public/locales/ja-JP/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"network_name_mainnet": "Mainnet",
"network_name_devnet": "Devnet",
"network_name_amm": "AMM-Devnet",
"network_name_hooks_testnet": "Hooks-Testnet",
"network_name_custom": "Custom",
"app.meta.description": "XRPLネットワークエクスプローラ",
"app.meta.author": "Ripple",
Expand Down Expand Up @@ -448,5 +449,8 @@
"peer_crawled_context": null,
"xchainbridge": null,
"language_en-US": null,
"language_ja-JP": null
"language_ja-JP": null,
"xchain_account_claim_count": null,
"xchain_account_create_count": null,
"min_signer_quorum": null
}
10 changes: 6 additions & 4 deletions src/containers/Header/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ export const Search = ({ callback = () => {} }: SearchProps) => {
const history = useHistory()

const handleSearch = async (id: string) => {
const type = await getIdType(id, socket)

const strippedId = id.replace(/^["']|["']$/g, '')
const type = await getIdType(strippedId, socket)
track('search', {
search_term: id,
search_term: strippedId,
search_category: type,
})
history.push(
type === 'invalid' ? `/search/${id}` : `/${type}/${normalize(id, type)}`,
type === 'invalid'
? `/search/${strippedId}`
: `/${type}/${normalize(strippedId, type)}`,
)
callback()
}
Expand Down
18 changes: 18 additions & 0 deletions src/containers/Header/test/Search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ describe('Search component', () => {
const paystring = 'blunden$paystring.crypto.com'
const paystringWithAt = '[email protected]'
const validator = 'nHUFE9prPXPrHcG3SkwP1UzAQbSphqyQkQK9ATXLZsfkezhhda3p'
const addressWithQuotes = '"rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX"'
const addressWithSpace = ' rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX '
const addressWithSingleQuote = '"rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX'

const hash =
'59239EA78084F6E2F288473F8AE02F3E6FC92F44BDE59668B5CAE361D3D32838'
Expand Down Expand Up @@ -84,6 +87,21 @@ describe('Search component', () => {
await flushPromises()
expect(window.location.pathname).toEqual(`/accounts/${rippleAddress}`)

input.instance().value = addressWithQuotes
input.simulate('keyDown', { key: 'Enter' })
await flushPromises()
expect(window.location.pathname).toEqual(`/accounts/${rippleAddress}`)

input.instance().value = addressWithSingleQuote
input.simulate('keyDown', { key: 'Enter' })
await flushPromises()
expect(window.location.pathname).toEqual(`/accounts/${rippleAddress}`)

input.instance().value = addressWithSpace
input.simulate('keyDown', { key: 'Enter' })
await flushPromises()
expect(window.location.pathname).toEqual(`/accounts/${rippleAddress}`)

input.instance().value = rippleXAddress
input.simulate('keyDown', { key: 'Enter' })
await flushPromises()
Expand Down

0 comments on commit 17583b9

Please sign in to comment.