diff --git a/frontend/src/lib/components/accounts/IcrcWalletPage.svelte b/frontend/src/lib/components/accounts/IcrcWalletPage.svelte index e43a973366d..75fdbcdb0f2 100644 --- a/frontend/src/lib/components/accounts/IcrcWalletPage.svelte +++ b/frontend/src/lib/components/accounts/IcrcWalletPage.svelte @@ -20,7 +20,7 @@ hasAccounts, } from "$lib/utils/accounts.utils"; import { replacePlaceholders } from "$lib/utils/i18n.utils"; - import { IconDots, Island, Spinner } from "@dfinity/gix-components"; + import { IconDots, Island, Spinner, Tag } from "@dfinity/gix-components"; import type { Principal } from "@dfinity/principal"; import { TokenAmountV2, isNullish, nonNullish } from "@dfinity/utils"; import type { Writable } from "svelte/store"; @@ -221,6 +221,12 @@ > + + {#if isImportedToken} + {$i18n.import_token.imported_token} + {/if} {#if $$slots["info-card"]} diff --git a/frontend/src/tests/lib/pages/IcrcWallet.spec.ts b/frontend/src/tests/lib/pages/IcrcWallet.spec.ts index 1073d2ea0c9..fe167efc910 100644 --- a/frontend/src/tests/lib/pages/IcrcWallet.spec.ts +++ b/frontend/src/tests/lib/pages/IcrcWallet.spec.ts @@ -6,6 +6,7 @@ import { CKETHSEPOLIA_INDEX_CANISTER_ID, CKETHSEPOLIA_LEDGER_CANISTER_ID, CKETHSEPOLIA_UNIVERSE_CANISTER_ID, + CKETH_LEDGER_CANISTER_ID, } from "$lib/constants/cketh-canister-ids.constants"; import { AppPath } from "$lib/constants/routes.constants"; import { pageStore } from "$lib/derived/page.derived"; @@ -528,6 +529,24 @@ describe("IcrcWallet", () => { }); }); + it('displays "Imported token" tag', async () => { + const po = await renderWallet({}); + expect(await po.getWalletPageHeadingPo().hasImportedTokenTag()).toEqual( + true + ); + }); + + it('should not display "Imported token" tag for not imported tokens', async () => { + page.mock({ + data: { universe: CKETH_LEDGER_CANISTER_ID.toText() }, + routeId: AppPath.Wallet, + }); + const po = await renderWallet({}); + expect(await po.getWalletPageHeadingPo().hasImportedTokenTag()).toEqual( + false + ); + }); + it("should remove imported tokens", async () => { let resolveSetImportedTokens; const spyOnSetImportedTokens = vi diff --git a/frontend/src/tests/page-objects/WalletPageHeading.page-object.ts b/frontend/src/tests/page-objects/WalletPageHeading.page-object.ts index 9b6ac3d2d71..1184a07f00a 100644 --- a/frontend/src/tests/page-objects/WalletPageHeading.page-object.ts +++ b/frontend/src/tests/page-objects/WalletPageHeading.page-object.ts @@ -35,4 +35,8 @@ export class WalletPageHeadingPo extends BasePageObject { this.root.byTestId("wallet-page-heading-principal") ).getFullText(); } + + async hasImportedTokenTag(): Promise { + return this.isPresent("imported-token-tag"); + } }