fix: long symbols wrap on TxApproval and TransactionDetail, and SuccessTx keeps its amount and recipient (closes #743)
TxApproval and TransactionDetail cut off a long symbol, amount or description at the edge of the screen. These lines now wrap. SuccessTx hid its Amount and To lines whenever it had a decoded action, even one that showed neither. Each line is now hidden only when a readable decoded line shows the same thing. A swap with no Amount line now shows its amount on SuccessTx, as WaitTx and ErrorTx do. Model: opus-5-5
This commit was merged in pull request #744.
This commit is contained in:
@@ -231,6 +231,15 @@ async function approveSwap(data, response, value = 0n) {
|
||||
await click("btn-approve-tx");
|
||||
}
|
||||
|
||||
// A later popup resumes the wait, and the receipt is there.
|
||||
async function receiptArrives() {
|
||||
mockReceipt = { blockNumber: 1 };
|
||||
txStatus.restoreWait();
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
}
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
txStatus.endWait();
|
||||
mockReceipt = null;
|
||||
@@ -287,20 +296,27 @@ describe.each([
|
||||
expect(node("error-tx-summary").textContent).toBe(expected);
|
||||
});
|
||||
|
||||
// The success screen shows the approval screen's decoded lines in place
|
||||
// of the amount, so the ETH value is not on it either.
|
||||
test("the success screen has no amount line of its own", async () => {
|
||||
// The success screen has an Amount line of its own only when the approval
|
||||
// screen's decoded lines have none. The ETH value is on neither.
|
||||
test("the success screen's amount", async () => {
|
||||
await approveSwap(v4SwapData(actions), { txHash: TX_HASH });
|
||||
mockReceipt = { blockNumber: 1 };
|
||||
// A later popup resumes the wait, and the receipt is there.
|
||||
txStatus.restoreWait();
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
}
|
||||
const summary = node("success-tx-summary").parentElement;
|
||||
expect(summary.classList.contains("hidden")).toBe(true);
|
||||
await receiptArrives();
|
||||
const summary = node("success-tx-summary");
|
||||
expect(summary.parentElement.classList.contains("hidden")).toBe(
|
||||
!expected.startsWith("Unknown"),
|
||||
);
|
||||
expect(summary.textContent).toBe(expected);
|
||||
expect(node("success-tx-decoded").innerHTML).not.toContain("0.0000");
|
||||
});
|
||||
|
||||
// The Protocol line of the decoded lines shows the router.
|
||||
test("the success screen has no To line of its own", async () => {
|
||||
await approveSwap(v4SwapData(actions), { txHash: TX_HASH });
|
||||
await receiptArrives();
|
||||
const to = node("success-tx-to").parentElement;
|
||||
expect(to.classList.contains("hidden")).toBe(true);
|
||||
expect(node("success-tx-decoded").innerHTML).toContain(ROUTER);
|
||||
});
|
||||
});
|
||||
|
||||
// A swap paid in native ETH has a Token In of "ETH (native)" and no Amount
|
||||
@@ -339,6 +355,14 @@ describe.each([
|
||||
);
|
||||
expect(node("error-tx-summary").textContent).toBe("1.0000 ETH");
|
||||
});
|
||||
|
||||
test("the success screen shows the ETH the transaction sends", async () => {
|
||||
await approveSwap(v4SwapData(actions), { txHash: TX_HASH }, ONE_ETH);
|
||||
await receiptArrives();
|
||||
const summary = node("success-tx-summary");
|
||||
expect(summary.parentElement.classList.contains("hidden")).toBe(false);
|
||||
expect(summary.textContent).toBe("1.0000 ETH");
|
||||
});
|
||||
});
|
||||
|
||||
// https://git.eeqj.de/sneak/AutistMask/issues/722: a WRAP_ETH of 1 ETH into the
|
||||
|
||||
Reference in New Issue
Block a user