diff options
author | Sebastian <sebasjm@gmail.com> | 2022-05-26 15:55:14 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-05-26 15:57:12 -0300 |
commit | 24162c1086c017305253c78280a82bfa9a572b1e (patch) | |
tree | 6842f44dad3fc029d44349527df8d0b09b92852d /packages/taler-wallet-webextension/src/test-utils.ts | |
parent | 72d936eaf99ad1d5ee156ba8f156a983f4ec613c (diff) | |
download | wallet-core-24162c1086c017305253c78280a82bfa9a572b1e.tar.gz wallet-core-24162c1086c017305253c78280a82bfa9a572b1e.tar.bz2 wallet-core-24162c1086c017305253c78280a82bfa9a572b1e.zip |
transaction details template
mayor change in the template of the transaction details for every
transaction
more work needs to be done in wallet core for tip and refund to show
more information about the merchant like logo and website
Diffstat (limited to 'packages/taler-wallet-webextension/src/test-utils.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/test-utils.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/taler-wallet-webextension/src/test-utils.ts b/packages/taler-wallet-webextension/src/test-utils.ts index eceda616f..9e219daa6 100644 --- a/packages/taler-wallet-webextension/src/test-utils.ts +++ b/packages/taler-wallet-webextension/src/test-utils.ts @@ -26,22 +26,27 @@ options.requestAnimationFrame = (fn: () => void) => { export function createExample<Props>( Component: FunctionalComponent<Props>, - props: Partial<Props>, + props: Partial<Props> | (() => Partial<Props>), ): ComponentChildren { + //FIXME: props are evaluated on build time + // in some cases we want to evaluated the props on render time so we can get some relative timestamp + // check how we can build evaluatedProps in render time + const evaluatedProps = typeof props === "function" ? props() : props const Render = (args: any): VNode => create(Component, args); - Render.args = props; + Render.args = evaluatedProps; return Render; } export function createExampleWithCustomContext<Props, ContextProps>( Component: FunctionalComponent<Props>, - props: Partial<Props>, + props: Partial<Props> | (() => Partial<Props>), ContextProvider: FunctionalComponent<ContextProps>, contextProps: Partial<ContextProps>, ): ComponentChildren { + const evaluatedProps = typeof props === "function" ? props() : props const Render = (args: any): VNode => create(Component, args); const WithContext = (args: any): VNode => create(ContextProvider, { ...contextProps, children: [Render(args)] } as any); - WithContext.args = props + WithContext.args = evaluatedProps return WithContext } |