Merge pull request #3428 from poanetwork/vb-fix-address-tokens-search

Fix address tokens search
pull/3432/head
Victor Baranov 4 years ago committed by GitHub
commit f92bab912b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 ### 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 - [#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 - [#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 - [#3408](https://github.com/poanetwork/blockscout/pull/3408) - Fix (total) difficulty display

@ -1,5 +1,6 @@
import $ from 'jquery' import $ from 'jquery'
import { formatAllUsdValues } from './currency' import { formatAllUsdValues } from './currency'
import { TokenBalanceDropdownSearch } from './token_balance_dropdown_search'
const tokenBalanceDropdown = (element) => { const tokenBalanceDropdown = (element) => {
const $element = $(element) const $element = $(element)
@ -20,4 +21,12 @@ const tokenBalanceDropdown = (element) => {
export function loadTokenBalanceDropdown () { export function loadTokenBalanceDropdown () {
$('[data-token-balance-dropdown]').each((_index, element) => tokenBalanceDropdown(element)) $('[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 $element = $(element)
const $tokensCount = $element.find('[data-tokens-count]') const $tokensCount = $element.find('[data-tokens-count]')
const $tokens = $element.find('[data-token-name]') 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)) $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 next
|> AddressPage.click_balance_dropdown_toggle() |> AddressPage.click_balance_dropdown_toggle()
|> AddressPage.fill_balance_dropdown_search("ato") |> AddressPage.fill_balance_dropdown_search("ato")
|> assert_has(AddressPage.token_balance(count: 2)) |> assert_has(AddressPage.token_balance(count: 1))
|> assert_has(AddressPage.token_type(count: 2)) |> assert_has(AddressPage.token_type(count: 1))
|> assert_has(AddressPage.token_type_count(type: "ERC-721", text: "1")) |> assert_has(AddressPage.token_type_count(type: "ERC-721", text: "1"))
end end
@ -388,8 +388,8 @@ defmodule BlockScoutWeb.ViewingAddressesTest do
next next
|> AddressPage.click_balance_dropdown_toggle() |> AddressPage.click_balance_dropdown_toggle()
|> AddressPage.fill_balance_dropdown_search("T2") |> AddressPage.fill_balance_dropdown_search("T2")
|> assert_has(AddressPage.token_balance(count: 2)) |> assert_has(AddressPage.token_balance(count: 1))
|> assert_has(AddressPage.token_type(count: 2)) |> assert_has(AddressPage.token_type(count: 1))
|> assert_has(AddressPage.token_type_count(type: "ERC-20", text: "1")) |> assert_has(AddressPage.token_type_count(type: "ERC-20", text: "1"))
end end

Loading…
Cancel
Save