From 8c9c075bd6a5ccc352bb7571c6ce8a08ea0b617b Mon Sep 17 00:00:00 2001 From: Yusef Habib Fernandez Date: Wed, 22 Jan 2025 15:22:21 +0100 Subject: [PATCH] fix logic to display primary button --- frontend/src/lib/pages/Portfolio.svelte | 2 +- frontend/src/tests/lib/pages/Portfolio.spec.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/pages/Portfolio.svelte b/frontend/src/lib/pages/Portfolio.svelte index a0ec4e498e1..02f5eea2a1a 100644 --- a/frontend/src/lib/pages/Portfolio.svelte +++ b/frontend/src/lib/pages/Portfolio.svelte @@ -90,7 +90,7 @@ // This helps guide users to stake their tokens when possible let hasNoStakedTokensCardAPrimaryAction: boolean; $: hasNoStakedTokensCardAPrimaryAction = - stakedTokensCard === "empty" && heldTokensCard !== "empty"; + stakedTokensCard === "empty" && heldTokensCard === "full"; // Global loading state that tracks if either held or staked tokens are loading // TotalAssetsCard will show this if either held or staked are loading diff --git a/frontend/src/tests/lib/pages/Portfolio.spec.ts b/frontend/src/tests/lib/pages/Portfolio.spec.ts index 78518dc39ff..c95a4276d20 100644 --- a/frontend/src/tests/lib/pages/Portfolio.spec.ts +++ b/frontend/src/tests/lib/pages/Portfolio.spec.ts @@ -467,6 +467,20 @@ describe("Portfolio page", () => { "$0.00" ); }); + + it("should not display a primary action when the staked tokens card loads before the held tokens card", async () => { + const loadingToken = createUserTokenLoading({}); + + const po = renderPage({ + userTokens: [loadingToken], + tableProjects: [], + }); + + expect(await po.getNoStakedTokensCarPo().isPresent()).toEqual(true); + expect(await po.getNoStakedTokensCarPo().hasPrimaryAction()).toEqual( + false + ); + }); }); describe("TotalAssetsCard", () => {