Fix address tokens search

pull/3428/head
Victor Baranov 4 years ago
parent edefbbf3ca
commit 34010cded8
  1. 1
      CHANGELOG.md
  2. 9
      apps/block_scout_web/assets/js/lib/token_balance_dropdown.js
  3. 10
      apps/block_scout_web/assets/js/lib/token_balance_dropdown_search.js
  4. 8
      apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs

@ -15,6 +15,7 @@
### Fixes
- [#3428](https://github.com/poanetwork/blockscout/pull/3428) - Fix address tokens search
- [#3424](https://github.com/poanetwork/blockscout/pull/3424) - Fix display of long NFT IDs
- [#3422](https://github.com/poanetwork/blockscout/pull/3422) - Fix contract reader: tuple type
- [#3408](https://github.com/poanetwork/blockscout/pull/3408) - Fix (total) difficulty display

@ -1,5 +1,6 @@
import $ from 'jquery'
import { formatAllUsdValues } from './currency'
import { TokenBalanceDropdownSearch } from './token_balance_dropdown_search'
const tokenBalanceDropdown = (element) => {
const $element = $(element)
@ -20,4 +21,12 @@ const tokenBalanceDropdown = (element) => {
export function loadTokenBalanceDropdown () {
$('[data-token-balance-dropdown]').each((_index, element) => tokenBalanceDropdown(element))
$('[data-token-balance-dropdown]').on('hidden.bs.dropdown', _event => {
$('[data-filter-dropdown-tokens]').val('').trigger('input')
})
$('[data-token-balance-dropdown]').on('input', function (event) {
TokenBalanceDropdownSearch(this, event)
})
}

@ -29,7 +29,7 @@ const hideEmptyType = (container) => {
}
}
const TokenBalanceDropdownSearch = (element, event) => {
export function TokenBalanceDropdownSearch (element, event) {
const $element = $(element)
const $tokensCount = $element.find('[data-tokens-count]')
const $tokens = $element.find('[data-token-name]')
@ -41,11 +41,3 @@ const TokenBalanceDropdownSearch = (element, event) => {
$tokensCount.html($tokensCount.html().replace(/\d+/g, $tokens.not('.d-none').length))
}
$('[data-token-balance-dropdown]').on('hidden.bs.dropdown', _event => {
$('[data-filter-dropdown-tokens]').val('').trigger('input')
})
$('[data-token-balance-dropdown]').on('input', function (event) {
TokenBalanceDropdownSearch(this, event)
})

@ -373,8 +373,8 @@ defmodule BlockScoutWeb.ViewingAddressesTest do
next
|> AddressPage.click_balance_dropdown_toggle()
|> AddressPage.fill_balance_dropdown_search("ato")
|> assert_has(AddressPage.token_balance(count: 2))
|> assert_has(AddressPage.token_type(count: 2))
|> assert_has(AddressPage.token_balance(count: 1))
|> assert_has(AddressPage.token_type(count: 1))
|> assert_has(AddressPage.token_type_count(type: "ERC-721", text: "1"))
end
@ -388,8 +388,8 @@ defmodule BlockScoutWeb.ViewingAddressesTest do
next
|> AddressPage.click_balance_dropdown_toggle()
|> AddressPage.fill_balance_dropdown_search("T2")
|> assert_has(AddressPage.token_balance(count: 2))
|> assert_has(AddressPage.token_type(count: 2))
|> assert_has(AddressPage.token_balance(count: 1))
|> assert_has(AddressPage.token_type(count: 1))
|> assert_has(AddressPage.token_type_count(type: "ERC-20", text: "1"))
end

Loading…
Cancel
Save