add text on listing component to show active lock amount

This commit is contained in:
RcleydsonR
2023-02-24 00:57:34 -03:00
parent d686c0b9bc
commit 8f45016532
5 changed files with 39 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ const etherStore = useEtherStore();
const props = defineProps<{
validDeposits: ValidDeposit[];
walletTransactions: WalletTransaction[];
activeLockAmount: Number;
}>();
const emit = defineEmits(["depositWithdrawn"]);
@@ -139,7 +140,7 @@ showInitialItems();
<template>
<div class="blur-container" v-if="loadingWalletTransactions">
<SpinnerComponent width="8" height="8" fillColor="white"></SpinnerComponent>
<SpinnerComponent width="8" height="8"></SpinnerComponent>
</div>
<div class="blur-container" v-if="!loadingWalletTransactions">
<div
@@ -154,7 +155,12 @@ showInitialItems();
<p class="text-xl leading-7 font-semibold text-gray-900">
{{ getRemaining() }} BRZ
</p>
<p class="text-xs leading-4 font-medium text-gray-600"></p>
<div class="flex gap-2">
<span class="text-xs leading-4 font-normal text-gray-400">{{
activeLockAmount != 0 ? `com ${activeLockAmount} BRZ em lock` : ""
}}</span>
<img alt="info image" src="@/assets/info.svg" />
</div>
</div>
</div>
<div class="pt-5">

View File

@@ -17,6 +17,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: [],
walletTransactions: [],
activeLockAmount: 0,
},
});
@@ -28,6 +29,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: [],
walletTransactions: MockWalletTransactions,
activeLockAmount: 0,
},
});
@@ -41,6 +43,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: MockValidDeposits,
walletTransactions: MockWalletTransactions,
activeLockAmount: 0,
},
});
const btn = wrapper.find("button");
@@ -60,6 +63,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: MockValidDeposits,
walletTransactions: MockWalletTransactions,
activeLockAmount: 0,
},
});
wrapper.vm.$emit("depositWithdrawn");
@@ -68,4 +72,16 @@ describe("ListingComponent.vue", () => {
expect(wrapper.emitted("depositWithdrawn")).toBeTruthy();
});
test("Test should render lock info when active lock amount is greater than 0", () => {
const wrapper = mount(ListingComponent, {
props: {
validDeposits: MockValidDeposits,
walletTransactions: [],
activeLockAmount: 50,
},
});
expect(wrapper.html()).toContain("com 50 BRZ em lock");
});
});