aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/context/devContext.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/context/devContext.ts')
-rw-r--r--packages/taler-wallet-webextension/src/context/devContext.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/taler-wallet-webextension/src/context/devContext.ts b/packages/taler-wallet-webextension/src/context/devContext.ts
index 0344df057..7ed6858a7 100644
--- a/packages/taler-wallet-webextension/src/context/devContext.ts
+++ b/packages/taler-wallet-webextension/src/context/devContext.ts
@@ -20,7 +20,7 @@
*/
import { createContext, h, VNode } from "preact";
-import { useContext, useState } from "preact/hooks";
+import { useContext } from "preact/hooks";
import { useLocalStorage } from "../hooks/useLocalStorage";
interface Type {
@@ -34,6 +34,10 @@ const Context = createContext<Type>({
export const useDevContext = (): Type => useContext(Context);
+export const DevContextProviderForTesting = ({ value, children }: { value: boolean, children: any }): VNode => {
+ return h(Context.Provider, { value: { devMode: value, toggleDevMode: () => { null } }, children });
+};
+
export const DevContextProvider = ({ children }: { children: any }): VNode => {
const [value, setter] = useLocalStorage("devMode");
const devMode = value === "true";