diff options
author | Sebastian <sebasjm@gmail.com> | 2022-09-10 23:21:44 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-09-10 23:21:44 -0300 |
commit | e4f3acfeb2ae6a24c579e7ba8d89625f398d2ee6 (patch) | |
tree | a71787f25c9a6093ef16c7f36dec1d2e7cd94312 /packages/taler-wallet-webextension/src/hooks | |
parent | dda90b51f6fc6fca48a68bc53088e1ed3f018a21 (diff) | |
download | wallet-core-e4f3acfeb2ae6a24c579e7ba8d89625f398d2ee6.tar.xz |
fix #7343
Diffstat (limited to 'packages/taler-wallet-webextension/src/hooks')
-rw-r--r-- | packages/taler-wallet-webextension/src/hooks/useTalerActionURL.test.ts | 8 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/hooks/useTalerActionURL.ts | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.test.ts b/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.test.ts index c00d6d7f6..61fe86e3a 100644 --- a/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.test.ts +++ b/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.test.ts @@ -20,11 +20,13 @@ import { h, VNode } from "preact"; import { expect } from "chai"; describe("useTalerActionURL hook", () => { + it("should be set url to undefined when dismiss", async () => { const ctx = ({ children }: { children: any }): VNode => { return h(IoCProviderForTesting, { value: { findTalerUriInActiveTab: async () => "asd", + findTalerUriInClipboard: async () => "qwe", }, children, }); @@ -42,7 +44,10 @@ describe("useTalerActionURL hook", () => { { const [url, setDismissed] = getLastResultOrThrow(); - expect(url).equals("asd"); + expect(url).deep.equals({ + location: "clipboard", + uri: "qwe" + }); setDismissed(true); } @@ -53,7 +58,6 @@ describe("useTalerActionURL hook", () => { if (url !== undefined) throw Error("invalid"); expect(url).undefined; } - await assertNoPendingUpdate(); }); }); diff --git a/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.ts b/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.ts index 74d7cbbd9..e1b08278b 100644 --- a/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.ts +++ b/packages/taler-wallet-webextension/src/hooks/useTalerActionURL.ts @@ -52,7 +52,8 @@ export function useTalerActionURL(): [ } } check(); - }); + }, [setTalerActionUrl]); + const url = dismissed ? undefined : talerActionUrl; return [url, setDismissed]; } |