diff --git a/explorer/src/lib/components/__tests__/TransactionDetails.spec.js b/explorer/src/lib/components/__tests__/TransactionDetails.spec.js index 370393b275..15a0d379ee 100644 --- a/explorer/src/lib/components/__tests__/TransactionDetails.spec.js +++ b/explorer/src/lib/components/__tests__/TransactionDetails.spec.js @@ -1,5 +1,5 @@ import { afterAll, afterEach, describe, expect, it, vi } from "vitest"; -import { cleanup, render } from "@testing-library/svelte"; +import { cleanup, fireEvent, render } from "@testing-library/svelte"; import { apiTransaction } from "$lib/mock-data"; import { transformTransaction } from "$lib/chain-info"; import { TransactionDetails } from "../"; @@ -14,12 +14,16 @@ const baseProps = { data: transformTransaction(apiTransaction.data[0]), error: null, loading: false, + payload: + "db0794770322802a22905c4364511f3186e6184085f875dbb9f11a3ae914766c020000000000000014bc23b875c67d0dbecfdd45f5964f3fea7188aff2035730c8802", }; describe("Transaction Details", () => { vi.useFakeTimers(); vi.setSystemTime(new Date(2024, 4, 20)); + afterEach(cleanup); + afterAll(() => { vi.useRealTimers(); }); @@ -29,4 +33,12 @@ describe("Transaction Details", () => { expect(container.firstChild).toMatchSnapshot(); }); + + it("renders the Transaction Details component with the payload visible", async () => { + const { container, getByRole } = render(TransactionDetails, baseProps); + + await fireEvent.click(getByRole("switch")); + + expect(container.firstChild).toMatchSnapshot(); + }); }); diff --git a/explorer/src/lib/components/__tests__/__snapshots__/TransactionDetails.spec.js.snap b/explorer/src/lib/components/__tests__/__snapshots__/TransactionDetails.spec.js.snap index 130d08bcec..3dfac36e17 100644 --- a/explorer/src/lib/components/__tests__/__snapshots__/TransactionDetails.spec.js.snap +++ b/explorer/src/lib/components/__tests__/__snapshots__/TransactionDetails.spec.js.snap @@ -56,7 +56,7 @@ exports[`Transaction Details > renders the Transaction Details component 1`] = `
- 4877687c2dbf154248d3ddee9ba0d81e3431f39056f82a46819da041d4ac0e04 + 4877687c2dbf154248d3ddee9ba0d81...431f39056f82a46819da041d4ac0e04
renders the Transaction Details component 1`] = ` `; + +exports[`Transaction Details > renders the Transaction Details component with the payload visible 1`] = ` +
+
+
+

+ Transaction Details +

+ + + +
+ +
+
+ + + + + + + ID +
+ +
+ 4877687c2dbf154248d3ddee9ba0d81...431f39056f82a46819da041d4ac0e04 +
+ +
+ + + + + + + block height +
+ +
+ 487,166 +
+ +
+ + + + + + + Status +
+ +
+ + success + + +
+ +
+ + + + + + + timestamp +
+ +
+ +
+ +
+ + + + + + + type +
+ +
+ + transfer + + +
+ +
+ + + + + + + transaction fee +
+ +
+ 0.000290766 DUSK ($0.000145383) +
+ +
+ + + + + + + gas price +
+ +
+ 0.000000001 DUSK ($0.000000001) +
+ +
+ + + + + + + transaction gas limit +
+ +
+ 0.50 + DUSK +
+ +
+ + + + + + + gas spent +
+ +
+ 0.000290766 + DUSK +
+ +
+ + + + + + + payload + + +
+ +
+ +
+
+ + db0794770322802a22905c4364511f3186e6184085f875dbb9f11a3ae914766c020000000000000014bc23b875c67d0dbecfdd45f5964f3fea7188aff2035730c8802 + + + +
+ + + +
+ +
+ + +
+ + + + +
+`; diff --git a/explorer/src/lib/components/transaction-details/TransactionDetails.css b/explorer/src/lib/components/transaction-details/TransactionDetails.css index 13a47256e3..395fbe72f6 100644 --- a/explorer/src/lib/components/transaction-details/TransactionDetails.css +++ b/explorer/src/lib/components/transaction-details/TransactionDetails.css @@ -1,6 +1,6 @@ .transaction-details__list { display: grid; - grid-template-columns: 1fr; + grid-template-columns: minmax(0, 1fr); font-size: 0.875rem; column-gap: 1.875rem; padding: 0 1.125rem; @@ -24,6 +24,7 @@ padding: 0.625rem 0.875rem; line-height: 1.3125rem; width: 100%; + overflow-x: auto; } .transaction-details__payload-switch { @@ -38,7 +39,7 @@ .transaction-details__list { display: inline-grid; - grid-template-columns: 1fr 3fr; + grid-template-columns: minmax(0, auto) minmax(0, 3fr); } .transaction-details__payload { diff --git a/explorer/src/lib/components/transaction-details/TransactionDetails.svelte b/explorer/src/lib/components/transaction-details/TransactionDetails.svelte index 16c56c79da..901899a91a 100644 --- a/explorer/src/lib/components/transaction-details/TransactionDetails.svelte +++ b/explorer/src/lib/components/transaction-details/TransactionDetails.svelte @@ -1,7 +1,7 @@