diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src')
4 files changed, 74 insertions, 38 deletions
diff --git a/packages/taler-wallet-webextension/src/mui/Modal.tsx b/packages/taler-wallet-webextension/src/mui/Modal.tsx index b24a45d61..7b1cf3f3a 100644 --- a/packages/taler-wallet-webextension/src/mui/Modal.tsx +++ b/packages/taler-wallet-webextension/src/mui/Modal.tsx @@ -81,9 +81,9 @@ export function Modal({ return ( <Portal - ref={handlePortalRef} - container={container} - // disablePortal={disablePortal} + // ref={mountNodeRef} + // container={container} + // disablePortal={disablePortal} > <div class={[_class, baseStyle].join(" ")} diff --git a/packages/taler-wallet-webextension/src/mui/Portal.tsx b/packages/taler-wallet-webextension/src/mui/Portal.tsx index f9be021f0..2026d7e5a 100644 --- a/packages/taler-wallet-webextension/src/mui/Portal.tsx +++ b/packages/taler-wallet-webextension/src/mui/Portal.tsx @@ -92,7 +92,7 @@ export const Portal = forwardRef(function Portal( ) : ( <Fragment /> ); -}); +} as any); function getContainer(container: any): any { return typeof container === "function" ? container() : container; diff --git a/packages/taler-wallet-webextension/src/utils/index.ts b/packages/taler-wallet-webextension/src/utils/index.ts index 2323c7b21..a1b2d5f14 100644 --- a/packages/taler-wallet-webextension/src/utils/index.ts +++ b/packages/taler-wallet-webextension/src/utils/index.ts @@ -26,8 +26,7 @@ function getJsonIfOk(r: Response): Promise<any> { } throw new Error( - `Try another server: (${r.status}) ${ - r.statusText || "internal server error" + `Try another server: (${r.status}) ${r.statusText || "internal server error" }`, ); } @@ -100,7 +99,7 @@ export function compose<SType extends { status: string }, PType>( const viewComponent = viewMap[statusName] as unknown as StateFunc<SType>; return createElement(viewComponent, state); } - TheComponent.name = `${name}`; + // TheComponent.name = `${name}`; return TheComponent; } diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts index 4d36bc740..62097c3e4 100644 --- a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts +++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts @@ -239,44 +239,81 @@ describe("DepositPage states", () => { expect(r.currency).eq(currency); expect(r.account.value).eq(accountSelected); expect(r.amount.value).eq("0"); - expect(r.depositHandler.onClick).undefined; - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - - r.amount.onInput("10"); - } - - expect(await waitForStateUpdate()).true; - - { - const r = pullLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(accountSelected); - expect(r.amount.value).eq("10"); expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); expect(r.depositHandler.onClick).undefined; - - r.amount.onInput("3"); - } - - expect(await waitForStateUpdate()).true; - - { - const r = pullLastResultOrThrow(); - if (r.status !== "ready") expect.fail(); - expect(r.cancelHandler.onClick).not.undefined; - expect(r.currency).eq(currency); - expect(r.account.value).eq(accountSelected); - expect(r.amount.value).eq("3"); - expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); - expect(r.depositHandler.onClick).not.undefined; } await assertNoPendingUpdate(); - expect(handler.getCallingQueueState()).eq("empty") }); + // it("should calculate the fee upon entering amount ", async () => { + // const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = + // mountHook(() => + // useComponentState( + // { currency, onCancel: nullFunction, onSuccess: nullFunction }, + // { + // getBalance: async () => + // ({ + // balances: [{ available: `${currency}:1` }], + // } as Partial<BalancesResponse>), + // listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }), + // getFeeForDeposit: withSomeFee, + // } as Partial<typeof wxApi> as any, + // ), + // ); + + // { + // const { status } = getLastResultOrThrow(); + // expect(status).equal("loading"); + // } + + // await waitNextUpdate(); + + // { + // const r = getLastResultOrThrow(); + // if (r.status !== "ready") expect.fail(); + // expect(r.cancelHandler.onClick).not.undefined; + // expect(r.currency).eq(currency); + // expect(r.account.value).eq(accountSelected); + // expect(r.amount.value).eq("0"); + // expect(r.depositHandler.onClick).undefined; + // expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + + // r.amount.onInput("10"); + // } + + // expect(await waitForStateUpdate()).true; + + // { + // const r = pullLastResultOrThrow(); + // if (r.status !== "ready") expect.fail(); + // expect(r.cancelHandler.onClick).not.undefined; + // expect(r.currency).eq(currency); + // expect(r.account.value).eq(accountSelected); + // expect(r.amount.value).eq("10"); + // expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + // expect(r.depositHandler.onClick).undefined; + + // r.amount.onInput("3"); + // } + + // expect(await waitForStateUpdate()).true; + + // { + // const r = pullLastResultOrThrow(); + // if (r.status !== "ready") expect.fail(); + // expect(r.cancelHandler.onClick).not.undefined; + // expect(r.currency).eq(currency); + // expect(r.account.value).eq(accountSelected); + // expect(r.amount.value).eq("3"); + // expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); + // expect(r.depositHandler.onClick).not.undefined; + // } + + // await assertNoPendingUpdate(); + // expect(handler.getCallingQueueState()).eq("empty") + // }); + it("should calculate the fee upon entering amount ", async () => { const { handler, mock } = createWalletApiMock(); const props = { currency, onCancel: nullFunction, onSuccess: nullFunction } |