fix: a saved SuccessTx in another shape reopens as itself, and long amounts wrap (closes #740)
The popup refused a saved SuccessTx whose decoded record was in a shape it did not expect, and showed Home. SuccessTx already shows only the lines it can read, so the popup no longer checks the record first. A long amount or token symbol was cut off at the edge of the screen. The Amount figure, each decoded amount and the token symbol now wrap. WaitTx and ErrorTx share the line that shows the symbol, so they gain this too. Model: opus-5-5
This commit is contained in:
@@ -416,20 +416,6 @@ const CONTRACT = [
|
||||
views: ["success-tx"],
|
||||
restored: false,
|
||||
},
|
||||
{
|
||||
value: { hash: "0x1", to: ADDRESS, decoded: { details: 7 } },
|
||||
views: ["success-tx"],
|
||||
restored: false,
|
||||
},
|
||||
{
|
||||
value: {
|
||||
hash: "0x1",
|
||||
to: ADDRESS,
|
||||
decoded: { details: [{ address: 42 }] },
|
||||
},
|
||||
views: ["success-tx"],
|
||||
restored: false,
|
||||
},
|
||||
// error-tx passes on `data.message`, same dereference.
|
||||
{
|
||||
value: { message: "boom" },
|
||||
@@ -1082,3 +1068,51 @@ describe("a restore-only hostile value onto", () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// A saved decoded record comes back from storage, in whatever shape it is in.
|
||||
// SuccessTx reopens as itself and shows only the lines it can read.
|
||||
describe("a popup reopened on a SuccessTx with a decoded record in another shape", () => {
|
||||
function savedSuccess(decoded) {
|
||||
return restoringOnto("success-tx", {
|
||||
viewData: {
|
||||
amount: "1.0000",
|
||||
symbol: "ETH",
|
||||
to: ADDRESS,
|
||||
hash: "0x1",
|
||||
chainId: "0x1",
|
||||
decoded,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
test.each([
|
||||
7,
|
||||
"text",
|
||||
[1, 2],
|
||||
{ details: 7 },
|
||||
{ details: [null] },
|
||||
{ details: [7] },
|
||||
{ details: [{ address: 42 }] },
|
||||
{ details: [{ label: "Steps", value: "text", address: 42 }] },
|
||||
])("%j shows the amount and the recipient", async (decoded) => {
|
||||
const page = await bootPopup(savedSuccess(decoded));
|
||||
expect(page.pageErrors).toEqual([]);
|
||||
expect(page.visibleViews()).toEqual(["success-tx"]);
|
||||
expect(page.hidden("success-tx-decoded")).toBe(true);
|
||||
expect(page.text("success-tx-summary")).toBe("1.0000 ETH");
|
||||
expect(page.node("success-tx-to").innerHTML).toContain(ADDRESS);
|
||||
});
|
||||
|
||||
test("a line it can read is shown", async () => {
|
||||
const page = await bootPopup(
|
||||
savedSuccess({
|
||||
details: [null, { label: "Steps", value: "V3_SWAP_EXACT_IN" }],
|
||||
}),
|
||||
);
|
||||
expect(page.pageErrors).toEqual([]);
|
||||
expect(page.visibleViews()).toEqual(["success-tx"]);
|
||||
expect(page.node("success-tx-decoded").innerHTML).toContain(
|
||||
"V3_SWAP_EXACT_IN",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user